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 |
---|---|---|---|---|---|---|
Retrieves all available entity type identifiers. | def get_entity_type_identifiers
get_entity_types_related_to Occi::Core::Entity.kind.type_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def entity_types\n @entity_types ||= metadata.xpath('//EntityType').collect {|entity| entity.attributes['Name'].value}\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end",
"def index\n @entity_types = EntityType.all\n end",
"def entity_types\n @entity_types ||= parent_tokenizer.class.all_entity_types\n end",
"def entity_types\n @entity_types ||= schemas.map do |namespace, schema|\n schema.entity_types.map do |entity_type|\n \"#{namespace}.#{entity_type}\"\n end\n end.flatten\n end",
"def entity_types\n @entity_types ||= schemas.map do |namespace, schema|\n schema.entity_types.map do |entity_type|\n \"#{namespace}.#{entity_type}\"\n end\n end.flatten\n end",
"def get_entities(type)\n @entities[type.name]\n end",
"def get_entity_types_related_to(type_identifier)\n Occi::Log.debug(\"Getting entity type identifiers related to #{type_identifier}\")\n collection = @model.get type_identifier\n collection.kinds.collect { |kind| kind.type_identifier }\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def index\n @identifier_types = IdentifierType.all\n end",
"def id_types\n identifiers.map(&:type).uniq\n end",
"def default_entity_types(*args)\n Epiphany::Tokenizer::Cache.all_entity_types\n end",
"def default_entity_types(*args)\n Epiphany::Tokenizer::Cache.all_entity_types\n end",
"def list_entities project_id:, entity_type_id:\n # [START dialogflow_list_entities]\n # project_id = \"Your Google Cloud project ID\"\n # entity_type_id = \"Existing Entity Type ID\"\n\n require \"google/cloud/dialogflow\"\n\n entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new\n parent = entity_types_client.class.entity_type_path project_id, entity_type_id\n\n entities = entity_types_client.get_entity_type(parent).entities\n\n entities.each do |entity|\n puts \"Entity value: #{entity.value}\"\n puts \"Entity synonyms: #{entity.synonyms}\"\n end\n # [END dialogflow_list_entities]\nend",
"def get_link_type_identifiers\n get_entity_types_related_to Occi::Core::Link.kind.type_identifier\n end",
"def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend",
"def get_workspace_entity_types(workspace_namespace, workspace_name)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}/entities\"\n process_firecloud_request(:get, path)\n end",
"def entities_list\n raise 'Not implemented'\n end",
"def entities_used\n entities_arr = Array.new\n @entities.each do |entity|\n entities_arr << entity.id unless entities_arr.include?(entity.id)\n end\n return entities_arr\n end",
"def entities_of_type(type)\n @entities.select { |entity| entity['type'] == type }.map { |entity| Entity.new entity }\n end",
"def ids\n @@enums_by_id.keys\n end",
"def index\n @identification_types = IdentificationType.all\n end",
"def entity_classes\n @entity_classes ||= []\n end",
"def get_entity_type_identifier(type)\n get_type_identifier(type, Occi::Core::Entity.kind)\n end",
"def index\n @identity_types = IdentityType.all\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def retrieve_all_entities\n response = self.execute(\"RetrieveAllEntities\", {\n EntityFilters: \"Entity\",\n RetrieveAsIfPublished: true\n },\n Metadata::RetrieveAllEntitiesResponse)\n end",
"def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end",
"def index\n @entity_types = EntityType.order('id').page(params[:page])\n \n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def find_entities\n []\n end",
"def allowed_types\n [ Entities::Domain, \n Entities::Host, \n Entities::Organization, \n Entities::SearchString, \n Entities::Person]\nend",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def entity_ids(domain)\n @providers[domain].map do |block|\n block.call(domain)\n end.flatten.compact\n end",
"def allowed_types\n [ Entities::SearchString, \n Entities::Organization, \n Entities::Domain, \n Entities::Host,\n Entities::Person, \n Entities::Username, \n Entities::Account]\nend",
"def entities\n @entities ||= []\n end",
"def asset_type_ids\n assets.scope.uniq.pluck(:asset_type_id)\n end",
"def allowed_entity_types\n [\n GlobalConstant::EntityGroupDraft.theme_entity_type,\n GlobalConstant::EntityGroupDraft.registration_entity_type,\n GlobalConstant::EntityGroupDraft.kyc_entity_type,\n GlobalConstant::EntityGroupDraft.dashboard_entity_type\n ]\n end",
"def allowed_types\n [ Entities::SearchString, \n Entities::Organization, \n Entities::DnsRecord, \n Entities::Host,\n Entities::EmailAddress,\n Entities::Person, \n Entities::Username, \n Entities::Account]\nend",
"def ids(type)\n Document.where(:typ => type).select(:ide).collect { |d| d[:ide] }.uniq.sort\n end",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def dbpedia_types\n _response_entity.fetch(\"type\", [])\n end",
"def ingested_ids\n ingested_ids_by_type.flatten\n end",
"def ingested_ids\n ingested_ids_by_type.flatten\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def show\n @h_identifier_types = {}\n IdentifierType.all.map{|it| @h_identifier_types[it.id] = it}\n end",
"def index\n @entity_types = EntityType.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entity_types }\n end\n end",
"def native_entities\r\n entities = []\r\n for type, type_entities in @types\r\n if type == QuadFace\r\n entities.concat( type_entities.keys.map { |quad| quad.faces } )\r\n else\r\n entities.concat( type_entities.keys )\r\n end\r\n end\r\n entities\r\n end",
"def entities\n @entities\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def find_entity_ids(*query)\n query = create_query(*query)\n path = \"entities/#{query.type}\"\n data = { where: query.constraints, offset: query.offset,\n limit: query.limit, orderBy: query.order_by }\n service.post(path, data).map {|e| e[:id]}\n end",
"def id_mapping_types\n @id_mapping_types ||= extract_classes_with_true(:track_imported_ids, configuration)\n end",
"def entities\n _entities\n end",
"def entities\n _entities\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n entity_container.entity_sets\n end",
"def entity_sets\n @entity_sets ||= metadata.xpath('//EntitySet').map do |entity|\n [\n entity.attributes['Name'].value,\n entity.attributes['EntityType'].value\n ]\n end.to_h\n end",
"def index\n @type_identifications = TypeIdentification.all\n end",
"def type\n entity_type.name\n end",
"def collected_entities entity_type, viewer=nil\n entity_type = entity_type.to_s\n if viewer == self\n assoc = entity_type.to_s\n scope = self.method(assoc).call\n scope = scope.where.not(owner_id: id) if entity_type == \"List\"\n scope\n else\n arr = collection_pointers.where(entity_type: entity_type, private: false).map(&:entity)\n arr = arr.keep_if { |l| l.owner != self } if entity_type == \"List\"\n arr\n end\n end",
"def allowed_types\n [ Entities::Account,\n Entities::DnsRecord, \n Entities::DnsServer, \n Entities::DocFile,\n Entities::EmailAddress,\n Entities::FacebookAccount,\n Entities::Finding,\n Entities::Host, \n Entities::LocalImage,\n Entities::RemoteImage,\n Entities::KloutAccount,\n Entities::NetBlock,\n Entities::NetSvc,\n Entities::Organization,\n Entities::ParsableFile,\n Entities::ParsableText,\n Entities::PdfFile,\n Entities::Person,\n Entities::PhysicalLocation, \n Entities::SearchString, \n Entities::TwitterAccount,\n Entities::Username,\n Entities::WebApplication,\n Entities::WebForm,\n Entities::WebPage,\n Entities::XlsFile ]\n end",
"def get_workspace_entities_by_type(workspace_namespace, workspace_name, entity_type)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}/entities/#{entity_type}\"\n process_firecloud_request(:get, path)\n end",
"def index\n @egc_server_types = EgcServerType.all\n end",
"def org_types\n organizations.map(&:organization_type)\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def entities\n @entities ||= begin\n acc = {}\n @api.routes.filter_map(&:entity).each do |entity|\n collect_entities(acc, entity)\n end\n acc.keys.sort_by(&:name)\n end\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def get_tags(tenant_id, entity_type_id,entity_id)\n return @instance.get_tags(tenant_id, entity_type_id,entity_id)\n end",
"def entity_type\n return @entity_type\n end",
"def index\n breadcrumb_for_collections(@collection)\n semantic_breadcrumb @collection.name, @collection\n semantic_breadcrumb \"Entity Types\"\n @entity_types = @collection.entity_types\n end",
"def identifiers(filter = Set.new)\n list(filter).entities.map { |ent| ent['occi.core.id'] }\n end",
"def allowed_types\n [ Entities::DnsRecord, \n Entities::Host, \n Entities::Organization, \n Entities::User]\nend",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def enumeration_types\n @enumeration_types ||= Search::ENUMERATION_TYPES\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end",
"def identifiers\n return [] if __getobj__.blank?\n\n __getobj__.identifier if __getobj__.respond_to?(:identifier)\n end",
"def index\n @article_types = ArticleType.all\n end",
"def get_mixin_type_identifiers\n identifiers = []\n\n get_mixin_types.each do |mixin_type|\n identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type\n end\n\n identifiers\n end",
"def get_all\n Rutodo::Database::Todo.map(&:as_entity)\n end",
"def entities viewerid=nil\n tagging_query(viewerid).to_a.map(&:entity)\n end",
"def index\n @platform_account_types = PlatformAccountType.all\n end",
"def all\n Ribs.with_handle(self.database) do |h|\n h.all(self.metadata.persistent_class.entity_name)\n end\n end",
"def show\n @entity_types = EntityType.where(collection_id: @document.collection_id)\n @document.adjust_offset(true)\n end",
"def index\n @vendor_item_types = VendorItemType.all\n end",
"def entities\n @entities ||= Entity.from_models(self, @models)\n end",
"def find_all(klass)\n ds = @model_class.where(:class_type=>klass.to_s)\n ds.all.map {|r| r[:id] }\n end",
"def service_types_generated \n types = [ ServiceTypeValue[:fulltext], ServiceTypeValue[:holding], ServiceTypeValue[:table_of_contents], ServiceTypeValue[:relevant_link] ]\n \n return types\n end",
"def all_ids(_context)\n raise NotImplementedError\n end",
"def index\n @email_types = EmailType.all\n end",
"def index\n @exp_entry_identifiers = ExpEntryIdentifier.all\n end",
"def index\n @entities = Entity.all\n end",
"def index\n @entities = Entity.all\n end",
"def entities_key\n entities_name.underscore.to_sym\n end",
"def show\n @entity_types = EntityType.where(project_id: @document.project_id)\n @document.adjust_offset(true)\n end"
] | [
"0.7877693",
"0.7785234",
"0.7623249",
"0.74239135",
"0.70781195",
"0.70505285",
"0.70373416",
"0.7035693",
"0.7035693",
"0.6972683",
"0.6924417",
"0.6717979",
"0.6654311",
"0.6612976",
"0.6455192",
"0.6455192",
"0.6282917",
"0.6266731",
"0.6251797",
"0.6141238",
"0.61367184",
"0.6128625",
"0.6118355",
"0.6076589",
"0.6040713",
"0.60085285",
"0.60054237",
"0.60026115",
"0.59860104",
"0.59860104",
"0.5968199",
"0.59608",
"0.59584814",
"0.5954565",
"0.592463",
"0.5891736",
"0.58869636",
"0.587411",
"0.5868236",
"0.585168",
"0.5825236",
"0.5819189",
"0.58138204",
"0.57974625",
"0.5780191",
"0.5773947",
"0.5773947",
"0.57710063",
"0.5770472",
"0.57678026",
"0.5746501",
"0.57398427",
"0.57345533",
"0.5724502",
"0.5712497",
"0.5707567",
"0.57028466",
"0.57028466",
"0.5697521",
"0.5697521",
"0.5697521",
"0.5686646",
"0.5677614",
"0.5667589",
"0.56506974",
"0.5594631",
"0.5577382",
"0.5544822",
"0.55336547",
"0.55269164",
"0.552519",
"0.5516268",
"0.5512668",
"0.5501106",
"0.5500537",
"0.5492327",
"0.54840225",
"0.5473887",
"0.54724526",
"0.54633266",
"0.5455864",
"0.5451321",
"0.5430152",
"0.54166156",
"0.5414793",
"0.54129964",
"0.5410849",
"0.5409244",
"0.54074746",
"0.53947943",
"0.5384369",
"0.53594273",
"0.53591615",
"0.53210896",
"0.53189504",
"0.53146887",
"0.5311983",
"0.5311983",
"0.5311344",
"0.5305999"
] | 0.80748206 | 0 |
Retrieves all available resource types. | def get_resource_types
Occi::Log.debug("Getting resource types ...")
collection = @model.get Occi::Core::Resource.kind
collection.kinds.collect { |kind| kind.term }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def type\n Resource::ALL\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def get_report_types\n \n LOGGER.info \"list all report types\"\n Reports::ReportFactory::REPORT_TYPES.collect{ |t| get_uri(t) }.join(\"\\n\")\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def resource_type_filter\n return filter_for(:resource_type_id, \n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], _(\"Resource Type\"))\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def getResourceType() \n @obj.getResourceType() \n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def resource_type_filter\n return filter_for(:resource_type_id,\n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], ResourceType.model_name.human)\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def resource_type_for_node(node)\n result = []\n @resource_type_mapping.each do |class_name, resource_type|\n result << resource_type if node.is_a?(class_name)\n end\n\n result\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def find_all_resources options\n policy_scope(resource_class)\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def list(resource_type_identifier=nil)\n if resource_type_identifier\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\" unless @model.get_by_id resource_type_identifier\n\n # split the type identifier and get the most important part\n uri_part = resource_type_identifier.split('#').last\n\n # request uri-list from the server\n path = uri_part + '/'\n else\n path = '/'\n end\n\n headers = self.class.headers.clone\n headers['Accept'] = 'text/uri-list'\n\n # TODO: remove the gsub OCCI-OS hack\n response = self.class.get(\n @endpoint + path,\n :headers => headers\n ).body.gsub(/\\# uri:\\/(compute|storage|network)\\/[\\n]?/, '').split(\"\\n\").compact\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def get_resource_type()\n return RedXmlResource::TYPE\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def registered_types\n end",
"def resource_scope\n resource_class.all\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def resource_associations(association_type)\n resource_class.reflect_on_all_associations(association_type).map(&:name)\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def collection\n resource_class.all\n end",
"def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end",
"def get_link_types\n Occi::Log.debug(\"Getting link types ...\")\n collection = @model.get Occi::Core::Link.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_activites_supportedtypes()\n @restv9.get_activites_supportedobjecttypes()\n end",
"def itemtype\n types = resource_type || []\n ResourceTypesService.microdata_type(types.first)\n end",
"def types\n self.singleton_class.const_get(:TYPES)\n end",
"def types\n @types ||= []\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def available_settings\n return @@settings_by_type[self.resource_type]\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def resources\n @resources.values\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def name(_prefix = false)\n 'Resource Types'\n end",
"def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end",
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"find_resources: descr: '#{resource_descr.inspect}'\"\n if resource_descr.kind_of? Hash\n can_handle = eval(\"OMF::SFA::Model::#{resource_type.classify}\").respond_to? :handle_rest_get_resource\n if can_handle\n cls = eval(\"OMF::SFA::Model::#{resource_type.classify}\")\n resources = cls.handle_rest_get_resource(resource_descr)\n else\n resources = eval(\"OMF::SFA::Model::#{resource_type.classify}\").where(resource_descr)\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n\n # raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil? || resources.empty?\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil?\n\n resources.map do |r|\n begin\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(r)\n r\n rescue InsufficientPrivilegesException\n nil\n end\n end.compact\n end",
"def all\n describe(resource_uri)\n end",
"def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end",
"def index\n @resources = resource_class.send(:all)\n render json: @resources\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def resource_list\n self.resources\n end",
"def resources\n Typus::Configuration.roles.keys.map do |key|\n Typus::Configuration.roles[key].keys\n end.flatten.sort.uniq.delete_if { |x| models.include?(x) }\n end",
"def types\n load_schema! unless schema_loaded?\n @types\n end",
"def index\n @types = Type.all\n end",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def collect\n resources = []\n\n time = Puppet::Util.thinmark do\n t = @type\n q = @cquery\n\n resources = scope.compiler.resources.find_all do |resource|\n resource.type == t && resource.exported? && (q.nil? || q.call(resource))\n end\n\n found = Puppet::Resource.indirection.\n search(@type, :host => @scope.compiler.node.name, :filter => @equery, :scope => @scope)\n\n found_resources = found.map {|x| x.is_a?(Puppet::Parser::Resource) ? x : x.to_resource(@scope)}\n\n found_resources.each do |item|\n existing = @scope.findresource(item.resource_type, item.title)\n if existing\n unless existing.collector_id == item.collector_id\n raise Puppet::ParseError,\n _(\"A duplicate resource was found while collecting exported resources, with the type and title %{title}\") % { title: item.ref }\n end\n else\n item.exported = false\n @scope.compiler.add_resource(@scope, item)\n resources << item\n end\n end\n end\n\n scope.debug(\"Collected %s %s resource%s in %.2f seconds\" %\n [resources.length, @type, resources.length == 1 ? \"\" : \"s\", time])\n\n resources\n end",
"def index\n @route_types = RouteType.all\n end",
"def child_types(*args)\n Relationship.resource_types(child_rels(*args))\n end",
"def apply_types\n return unless _types\n\n _types.each do |rdf_type|\n unless resource.type.include? RDF::Vocabulary.find_term(rdf_type)\n resource << RDF::Statement.new(rdf_subject, RDF.type, RDF::Vocabulary.find_term(rdf_type))\n end\n end\n end",
"def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end",
"def types\n types = ActiveRDF::Query.new(N::SourceClass).distinct(:t).where(self,N::RDF::type,:t).execute\n # Add the \"default\" types if necessary\n self.class.default_types.each do |def_type|\n types << def_type unless(types.include?(def_type))\n end\n \n # Make a property list for the types.\n PropertyList.new(N::RDF::type, types, self, source_exists?)\n end",
"def index\n @types = ItemType.all\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def resources\n @resources ||= []\n end",
"def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end",
"def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def resource_type\n return @resource_type\n end",
"def resource_type\n return @resource_type\n end",
"def resource_type\n return @resource_type\n end",
"def resource_type\n return @resource_type\n end",
"def index\n authorize :resquest_type, :index?\n @resquest_types = ResquestType.all\n end",
"def resources\n @resources\n end",
"def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def index\n @qualification_types = QualificationType.all\n end",
"def new\n @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def item_types(refresh: false)\n cname = \"#{name}.item_types\"\n Rails.cache.delete(cname) if refresh\n\n Rails.cache.fetch(cname) do\n list = []\n implementation_classes.each do |imp_class|\n list += imp_class.attribute_names\n .select { |a| Classification::GeneralSelection.use_with_attribute?(a) }\n .map do |a|\n mn = imp_class.model_name.to_s.ns_underscore\n mn = mn.pluralize unless imp_class.respond_to?(:is_activity_log)\n \"#{mn}_#{a}\".to_sym\n end\n end\n\n list\n end\n end",
"def all_items(type = nil)\n if type\n @api_items.select {|k, v| v.kind_of?(TYPE_MAP[type])}.keys\n else\n @api_items.keys\n end\n end",
"def all\n all_by_type.values.flatten\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def read_service_types()\n types = []\n @client.services.each do |type|\n types << type.label\n end\n\n types\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def service_types\n get_info :service_types\n end",
"def resource_all(stack)\n raise NotImplementedError\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def response_types\n @response_types ||= ResponseTypesController.new config\n end"
] | [
"0.8586148",
"0.7548137",
"0.73330396",
"0.7196875",
"0.71729606",
"0.69619936",
"0.69221973",
"0.6907189",
"0.6850253",
"0.68476236",
"0.66748494",
"0.6610756",
"0.6590624",
"0.6531334",
"0.6490618",
"0.64234513",
"0.6422633",
"0.63303614",
"0.62601733",
"0.6220727",
"0.6213554",
"0.6210309",
"0.61985505",
"0.61923283",
"0.61916256",
"0.61886895",
"0.6172029",
"0.616091",
"0.616091",
"0.6117703",
"0.61160254",
"0.61142987",
"0.61136675",
"0.6112401",
"0.6083798",
"0.60496056",
"0.60468984",
"0.6044814",
"0.60269386",
"0.60091835",
"0.6002667",
"0.6002416",
"0.59884655",
"0.5977364",
"0.59510374",
"0.59385633",
"0.5930908",
"0.5918643",
"0.5916579",
"0.59060776",
"0.58985",
"0.5892362",
"0.58921766",
"0.5879977",
"0.58723944",
"0.5871366",
"0.5869407",
"0.5861134",
"0.5856774",
"0.58561474",
"0.5850908",
"0.5848454",
"0.5847839",
"0.5847745",
"0.5840973",
"0.5826919",
"0.58259714",
"0.5824533",
"0.5819429",
"0.5816126",
"0.58133453",
"0.58018553",
"0.5800912",
"0.57919884",
"0.578408",
"0.57749486",
"0.5772091",
"0.57676405",
"0.57676405",
"0.57676405",
"0.57676405",
"0.57348996",
"0.57306314",
"0.57121825",
"0.5709709",
"0.5709709",
"0.5709709",
"0.57097083",
"0.5705619",
"0.5692216",
"0.56824344",
"0.5675741",
"0.5671535",
"0.5660785",
"0.564573",
"0.563984",
"0.56363845",
"0.5635533",
"0.5632966",
"0.5632114"
] | 0.8548611 | 1 |
Retrieves all available resource type identifiers. | def get_resource_type_identifiers
get_entity_types_related_to Occi::Core::Resource.kind.type_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def id_types\n identifiers.map(&:type).uniq\n end",
"def index\n @identifier_types = IdentifierType.all\n end",
"def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def asset_type_ids\n assets.scope.uniq.pluck(:asset_type_id)\n end",
"def type\n Resource::ALL\n end",
"def resource_type_filter\n return filter_for(:resource_type_id, \n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], _(\"Resource Type\"))\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def get_report_types\n \n LOGGER.info \"list all report types\"\n Reports::ReportFactory::REPORT_TYPES.collect{ |t| get_uri(t) }.join(\"\\n\")\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def resource_associations(association_type)\n resource_class.reflect_on_all_associations(association_type).map(&:name)\n end",
"def list(resource_type_identifier=nil)\n if resource_type_identifier\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\" unless @model.get_by_id resource_type_identifier\n\n # split the type identifier and get the most important part\n uri_part = resource_type_identifier.split('#').last\n\n # request uri-list from the server\n path = uri_part + '/'\n else\n path = '/'\n end\n\n headers = self.class.headers.clone\n headers['Accept'] = 'text/uri-list'\n\n # TODO: remove the gsub OCCI-OS hack\n response = self.class.get(\n @endpoint + path,\n :headers => headers\n ).body.gsub(/\\# uri:\\/(compute|storage|network)\\/[\\n]?/, '').split(\"\\n\").compact\n end",
"def registered_types\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def ids\n @@enums_by_id.keys\n end",
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_resource_type_identifier(type)\n get_type_identifier(type, Occi::Core::Resource.kind)\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def resource_type_filter\n return filter_for(:resource_type_id,\n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], ResourceType.model_name.human)\n end",
"def enumeration_types\n @enumeration_types ||= Search::ENUMERATION_TYPES\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def get_entity_types_related_to(type_identifier)\n Occi::Log.debug(\"Getting entity type identifiers related to #{type_identifier}\")\n collection = @model.get type_identifier\n collection.kinds.collect { |kind| kind.type_identifier }\n end",
"def resource_type_for_node(node)\n result = []\n @resource_type_mapping.each do |class_name, resource_type|\n result << resource_type if node.is_a?(class_name)\n end\n\n result\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def list_operation_definitions(resource_type_path)\n parsed_path = CanonicalPath.parse(resource_type_path.to_s)\n feed_id = parsed_path.feed_id\n resource_type_id = parsed_path.resource_type_id\n ret = http_get(\"/feeds/#{feed_id}/resourceTypes/#{resource_type_id}/operationTypes\")\n ret.map { |ot| ot['id'] }\n end",
"def index\n @identification_types = IdentificationType.all\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def resource_scope\n resource_class.all\n end",
"def itemtype\n types = resource_type || []\n ResourceTypesService.microdata_type(types.first)\n end",
"def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end",
"def list_possible_status_ids\n\tstatustypes = @client.Status.all\n\tstatustypes.each do |status|\n\t\tputs \"#{status.id}\\t#{status.name}\"\n\tend\nend",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def show\n @h_identifier_types = {}\n IdentifierType.all.map{|it| @h_identifier_types[it.id] = it}\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def resources\n Typus::Configuration.roles.keys.map do |key|\n Typus::Configuration.roles[key].keys\n end.flatten.sort.uniq.delete_if { |x| models.include?(x) }\n end",
"def get_link_types\n Occi::Log.debug(\"Getting link types ...\")\n collection = @model.get Occi::Core::Link.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def index\n @qualification_types = QualificationType.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def get_link_type_identifiers\n get_entity_types_related_to Occi::Core::Link.kind.type_identifier\n end",
"def get_activites_supportedtypes()\n @restv9.get_activites_supportedobjecttypes()\n end",
"def all_items(type = nil)\n if type\n @api_items.select {|k, v| v.kind_of?(TYPE_MAP[type])}.keys\n else\n @api_items.keys\n end\n end",
"def get_resource_type()\n return RedXmlResource::TYPE\n end",
"def types\n @types ||= []\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def items_for_type(type)\n all_ids = []\n valid_ids = []\n AllItems.get.each do |item_code, values|\n _item_name, item_type, item_valid = values\n next unless item_type == type\n all_ids << item_code\n valid_ids << item_code if item_valid\n end\n\n [all_ids, valid_ids]\n end",
"def index\n @entity_types = EntityType.all\n end",
"def index\n @identity_types = IdentityType.all\n end",
"def name(_prefix = false)\n 'Resource Types'\n end",
"def index\n @type_identifications = TypeIdentification.all\n end",
"def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end",
"def resources\n @resources.values\n end",
"def resources\n @data.keys\n end",
"def find_all_resources options\n policy_scope(resource_class)\n end",
"def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def all\n all_by_type.values.flatten\n end",
"def get_mixin_type_identifiers\n identifiers = []\n\n get_mixin_types.each do |mixin_type|\n identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type\n end\n\n identifiers\n end",
"def identifier_uris\n return @identifier_uris\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def index\n @types = ItemType.all\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def entity_types\n @entity_types ||= schemas.map do |namespace, schema|\n schema.entity_types.map do |entity_type|\n \"#{namespace}.#{entity_type}\"\n end\n end.flatten\n end",
"def entity_types\n @entity_types ||= schemas.map do |namespace, schema|\n schema.entity_types.map do |entity_type|\n \"#{namespace}.#{entity_type}\"\n end\n end.flatten\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def get_context_types_list\n [\n context_type_meeting_header,\n context_type_category_header,\n context_type_relay_header,\n context_type_team_ranking,\n context_type_result_row,\n context_type_relay_row,\n context_type_ranking_row\n ]\n end",
"def collect\n resources = []\n\n time = Puppet::Util.thinmark do\n t = @type\n q = @cquery\n\n resources = scope.compiler.resources.find_all do |resource|\n resource.type == t && resource.exported? && (q.nil? || q.call(resource))\n end\n\n found = Puppet::Resource.indirection.\n search(@type, :host => @scope.compiler.node.name, :filter => @equery, :scope => @scope)\n\n found_resources = found.map {|x| x.is_a?(Puppet::Parser::Resource) ? x : x.to_resource(@scope)}\n\n found_resources.each do |item|\n existing = @scope.findresource(item.resource_type, item.title)\n if existing\n unless existing.collector_id == item.collector_id\n raise Puppet::ParseError,\n _(\"A duplicate resource was found while collecting exported resources, with the type and title %{title}\") % { title: item.ref }\n end\n else\n item.exported = false\n @scope.compiler.add_resource(@scope, item)\n resources << item\n end\n end\n end\n\n scope.debug(\"Collected %s %s resource%s in %.2f seconds\" %\n [resources.length, @type, resources.length == 1 ? \"\" : \"s\", time])\n\n resources\n end",
"def get_link_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Link.kind.type_identifier\n end",
"def entity_types\n @entity_types ||= metadata.xpath('//EntityType').collect {|entity| entity.attributes['Name'].value}\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def index\n @types = Type.all\n end",
"def ids(type)\n Document.where(:typ => type).select(:ide).collect { |d| d[:ide] }.uniq.sort\n end",
"def id\n Resource::ALL\n end",
"def id\n Resource::ALL\n end",
"def get_context_types_list\n [\n context_type_meeting_header,\n context_type_category_header,\n context_type_relay_header,\n context_type_team_ranking,\n context_type_team_stats,\n context_type_stats,\n context_type_result_row,\n context_type_relay_row,\n context_type_ranking_row,\n context_type_stats_details\n ]\n end",
"def type_names\n @type_names ||= @types.map { |clazz| clazz.name }\n end",
"def service_types\n get_info :service_types\n end",
"def index\n @route_types = RouteType.all\n end",
"def types\n self.singleton_class.const_get(:TYPES)\n end",
"def resource_list\n self.resources\n end",
"def index\n @platform_account_types = PlatformAccountType.all\n end",
"def get_all_types\n types = Hash.new()\n @packages.each do |key, value|\n types[key] = value.stringpool_typestrings.values\n end\n\n return types\n end",
"def getResourceType() \n @obj.getResourceType() \n end",
"def index\n @vendor_role_types = VendorRoleType.all\n end",
"def index\n @reltypes = Reltype.all\n end"
] | [
"0.7927595",
"0.7786789",
"0.7720512",
"0.6979698",
"0.68479896",
"0.67314774",
"0.66892487",
"0.6682988",
"0.6543309",
"0.6467696",
"0.63946545",
"0.6316076",
"0.6258884",
"0.6214816",
"0.62119234",
"0.6149411",
"0.61451304",
"0.61367136",
"0.61224055",
"0.60580385",
"0.6056638",
"0.6054939",
"0.60405177",
"0.5999787",
"0.5975428",
"0.59470266",
"0.59148943",
"0.590537",
"0.5888985",
"0.5878577",
"0.58277124",
"0.58265066",
"0.5816867",
"0.5789977",
"0.57824606",
"0.5774241",
"0.5774241",
"0.5771752",
"0.57484543",
"0.5743218",
"0.5731511",
"0.57305974",
"0.5718828",
"0.5700168",
"0.56977826",
"0.56902254",
"0.56822854",
"0.5682105",
"0.5678",
"0.56720895",
"0.564821",
"0.56444883",
"0.5633835",
"0.5633129",
"0.56114733",
"0.56071115",
"0.5603218",
"0.5593622",
"0.5592765",
"0.5590649",
"0.55724823",
"0.55700886",
"0.55678767",
"0.55643344",
"0.5564098",
"0.55539346",
"0.5550426",
"0.5546044",
"0.55422103",
"0.55390286",
"0.5529149",
"0.552405",
"0.5521087",
"0.5515571",
"0.5512022",
"0.54987115",
"0.5495499",
"0.54889184",
"0.54889184",
"0.5470584",
"0.5462715",
"0.546244",
"0.5462432",
"0.544563",
"0.5436971",
"0.54369223",
"0.5432357",
"0.5432263",
"0.5432263",
"0.5430147",
"0.542762",
"0.54188126",
"0.5415944",
"0.5412037",
"0.5409269",
"0.54039073",
"0.54033303",
"0.5403018",
"0.5398595",
"0.5390872"
] | 0.78809315 | 1 |
Retrieves all available link types. | def get_link_types
Occi::Log.debug("Getting link types ...")
collection = @model.get Occi::Core::Link.kind
collection.kinds.collect { |kind| kind.term }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_link_types\n get_types(Occi::Core::Link.kind)\n end",
"def get_link_type_identifiers\n get_entity_types_related_to Occi::Core::Link.kind.type_identifier\n end",
"def get_link_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Link.kind.type_identifier\n end",
"def index\n @link_types = LinkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @link_types }\n end\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_report_types\n \n LOGGER.info \"list all report types\"\n Reports::ReportFactory::REPORT_TYPES.collect{ |t| get_uri(t) }.join(\"\\n\")\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def direct_types\n (self[\"directTypes\"] || ['*']).map { |t| Registry.get_type(t) }\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def available_related_content_types\n available_related_content.map{|hash| hash['Type'] }\n end",
"def all_links\n Link.all\n end",
"def all_links\n Link.all\n end",
"def all_links\n Link.all\n end",
"def links(type = :local)\n @links = type == :all ? @all_links : @local_links\n end",
"def matching_links(type)\n link_pattern = config.public_send(\"link_#{type}_pattern\")\n return [] unless link_pattern\n\n metadata\n .select { |key| __send__(\"#{type}?\", key) }\n .map { |key, value| Allure::ResultUtils.public_send(\"#{type}_link\", key.to_s, value, link_pattern) }\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def _type\n @link['type']\n end",
"def links\n typed_set(entities, Occi::Core::Link)\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def types\n @types ||= []\n end",
"def index\n @publinktypes = Publinktype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinktypes }\n end\n end",
"def get_activites_supportedtypes()\n @restv9.get_activites_supportedobjecttypes()\n end",
"def relation_types\n Spree::RelationType.where(applies_to: to_relation_name).order(:name)\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def readable_entry_types\n BIDURI['entry_types'].select{|s| s['has_own_page'].nil? || s['has_own_page'] == true}.map{|m| m['entry_type']}\n end",
"def registered_types\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def all_items(type = nil)\n if type\n @api_items.select {|k, v| v.kind_of?(TYPE_MAP[type])}.keys\n else\n @api_items.keys\n end\n end",
"def item_types(refresh: false)\n cname = \"#{name}.item_types\"\n Rails.cache.delete(cname) if refresh\n\n Rails.cache.fetch(cname) do\n list = []\n implementation_classes.each do |imp_class|\n list += imp_class.attribute_names\n .select { |a| Classification::GeneralSelection.use_with_attribute?(a) }\n .map do |a|\n mn = imp_class.model_name.to_s.ns_underscore\n mn = mn.pluralize unless imp_class.respond_to?(:is_activity_log)\n \"#{mn}_#{a}\".to_sym\n end\n end\n\n list\n end\n end",
"def index\n @route_types = RouteType.all\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def category_types\n @category_types.each\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def enumeration_types\n @enumeration_types ||= Search::ENUMERATION_TYPES\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def index\n @types = Type.all\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def index\n @reltypes = Reltype.all\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def types\n types = ActiveRDF::Query.new(N::SourceClass).distinct(:t).where(self,N::RDF::type,:t).execute\n # Add the \"default\" types if necessary\n self.class.default_types.each do |def_type|\n types << def_type unless(types.include?(def_type))\n end\n \n # Make a property list for the types.\n PropertyList.new(N::RDF::type, types, self, source_exists?)\n end",
"def link_for(type)\n if link = self.links.find { |link| link.type == type }\n link.to_s\n end\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def org_types\n organizations.map(&:organization_type)\n end",
"def index\n @types = ItemType.all\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def proper_types\n Page.distinct(:_type).reject { |type| type.constantize.new.entry? }\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def available_types\n @bridge.available_log_types\n end",
"def available_ledgers(type)\n @general_ledgers = search_ledgers.where(type => nil).page params[:page]\n end",
"def types\n load_schema! unless schema_loaded?\n @types\n end",
"def index\n @grouptypes = Grouptype.all\n end",
"def get_linked_resources(resource_type, filters = {})\n Util.convert_to_clever_object Clever.request(:get, get_uri(resource_type), filters)[:data]\n end",
"def getTypeUrlFromTypesObject(types)\n return types.map {|x| x['type']['url']}.compact\nend",
"def index\n @nav_types = NavType.all\n end",
"def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end",
"def possible_node_types(type)\n possible_types(type) & node_types\n end",
"def index\n @connector_types = ConnectorType.all\n end",
"def semanticlink_enum( linktype )\n\t\treturn self.semanticlink_dataset( linktype ).to_enum\n\tend",
"def available_content_types\n if self.api_file.download_url\n return [self.api_file.mime_type]\n else\n return []\n end\n end",
"def index\n @global_links = GlobalLink.all\n @tier_two_links = TierTwoLink.all\n end",
"def all_types\n @mutex.synchronize do\n @types.keys.find_all{ |t_| !t_.is_a?(AnonymousType) }\n end\n end",
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end",
"def index\n @brew_types = BrewType.all\n end",
"def types\n respond_to?(:articleType) ? articleType : []\n end",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def find_social_links_on(type)\n social_url = @@social_links[type] || type\n\n # go through all of the website links of this organization\n @item.links.where(:link_type_id => website_link_type_id).map { |website_link|\n # each_item only iterates through the first 8 items in the response\n # search facebook.com for the organization name\n google_search(@item.name, social_url).collect { |result| result.uri }.select { |social_url|\n # search the organization site for a link to that facebook profile\n # if the result has more than 0 results, add it to the links list\n # (returns a boolean because we are in a select block)\n google_search(\"link:#{social_url} AND\", website_link.link_url).estimated_count > 0 and usable_link?(type, social_url)\n }\n }.flatten\n end",
"def all_links\n Link.all.order(id: :desc)\n end",
"def links\n links = []\n result = self.perform\n links = result.ft_links\n end",
"def node_types\n schema.possible_types(node_interface)\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def all\n all_by_type.values.flatten\n end",
"def index\n @linkers = Linker.all\n end",
"def content_types\n self.values.collect do |hash|\n (hash || {})['type']\n end.compact\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def contact_types\n values = categories.map(&:contact_type_id)\n values.empty? ? @contact_types : values\n end",
"def types\n @types.dup\n end",
"def types\n @types.dup\n end",
"def index\n @application_types = ApplicationType.page(params[:page])\n end",
"def get_exchange_types\n exchange_types = []\n ExchangeType.where(:selectable => true).each do |et|\n exchange_types.push(et.msgid)\n end\n\n if self.exchange_types.empty? or self.exchange_types.include?('exchangetype.open_for_all_offers')\n return exchange_types\n end\n\n return exchange_types & self.exchange_types\n end",
"def recognized_item_types\n\t\t# , 'DocFile', 'DocImage', 'DocPrivate', 'Path'\n\t\t['Article', 'Document', 'Event', 'Group', 'Page', 'Petition', 'Signature', 'User', 'Weblink']\n\tend",
"def type\n Resource::ALL\n end",
"def index\n @rule_types = RuleType.all\n end",
"def is_linktype?(); @type == GRT_LINKTYPE; end",
"def get_all(object_type, opts = {})\n data, _status_code, _headers = get_all_with_http_info(object_type, opts)\n data\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def index\n @system_links = SystemLink.all\n end",
"def index\n @arc_types = ArcType.all\n end",
"def get_all_types\n types = Hash.new()\n @packages.each do |key, value|\n types[key] = value.stringpool_typestrings.values\n end\n\n return types\n end",
"def report_types\n return TrendReport.all_reports\n end"
] | [
"0.81939846",
"0.69282293",
"0.67540115",
"0.6429698",
"0.63668627",
"0.6271843",
"0.6156096",
"0.60497063",
"0.604643",
"0.59481764",
"0.59287405",
"0.588149",
"0.5840851",
"0.5813125",
"0.5807189",
"0.5807189",
"0.5807189",
"0.5793381",
"0.57657623",
"0.5747395",
"0.57368314",
"0.5712112",
"0.57049227",
"0.5668284",
"0.5641282",
"0.56319594",
"0.5631848",
"0.5625108",
"0.55986714",
"0.55936646",
"0.55895823",
"0.55675244",
"0.5565824",
"0.5542087",
"0.553984",
"0.553044",
"0.5519679",
"0.55171865",
"0.55157965",
"0.5513094",
"0.5505948",
"0.548683",
"0.54843426",
"0.54771477",
"0.54396206",
"0.5436485",
"0.5431029",
"0.5429648",
"0.54193157",
"0.5397607",
"0.5394806",
"0.53869617",
"0.5379482",
"0.5346444",
"0.5326194",
"0.5315235",
"0.5311823",
"0.529645",
"0.5276152",
"0.52612877",
"0.52587444",
"0.52367854",
"0.52272916",
"0.52255136",
"0.52227783",
"0.5219572",
"0.52175766",
"0.5217124",
"0.52062",
"0.5201726",
"0.51946896",
"0.5192917",
"0.5188785",
"0.51722723",
"0.51644206",
"0.5158807",
"0.5157613",
"0.5154908",
"0.5151207",
"0.51502454",
"0.5150237",
"0.5149639",
"0.5145289",
"0.5136594",
"0.5123932",
"0.51170963",
"0.511132",
"0.511132",
"0.51106083",
"0.5108204",
"0.51064235",
"0.5100973",
"0.50992024",
"0.50884944",
"0.5084808",
"0.5083424",
"0.5080876",
"0.50802344",
"0.5079713",
"0.5079114"
] | 0.83286625 | 0 |
Retrieves all available link type identifiers. | def get_link_type_identifiers
get_entity_types_related_to Occi::Core::Link.kind.type_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_link_types\n get_types(Occi::Core::Link.kind)\n end",
"def get_link_types\n Occi::Log.debug(\"Getting link types ...\")\n collection = @model.get Occi::Core::Link.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_link_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Link.kind.type_identifier\n end",
"def id_types\n identifiers.map(&:type).uniq\n end",
"def index\n @identifier_types = IdentifierType.all\n end",
"def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end",
"def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end",
"def get_link_type_identifier(type)\n get_type_identifier(type, Occi::Core::Link.kind)\n end",
"def index\n @link_types = LinkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @link_types }\n end\n end",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def get_report_types\n \n LOGGER.info \"list all report types\"\n Reports::ReportFactory::REPORT_TYPES.collect{ |t| get_uri(t) }.join(\"\\n\")\n end",
"def semanticlink_enum( linktype )\n\t\treturn self.semanticlink_dataset( linktype ).to_enum\n\tend",
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def enumeration_types\n @enumeration_types ||= Search::ENUMERATION_TYPES\n end",
"def asset_type_ids\n assets.scope.uniq.pluck(:asset_type_id)\n end",
"def ids\n @@enums_by_id.keys\n end",
"def registered_types\n end",
"def links\n typed_set(entities, Occi::Core::Link)\n end",
"def _type\n @link['type']\n end",
"def all_items(type = nil)\n if type\n @api_items.select {|k, v| v.kind_of?(TYPE_MAP[type])}.keys\n else\n @api_items.keys\n end\n end",
"def all_links\n Link.all\n end",
"def all_links\n Link.all\n end",
"def all_links\n Link.all\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def get_entity_types_related_to(type_identifier)\n Occi::Log.debug(\"Getting entity type identifiers related to #{type_identifier}\")\n collection = @model.get type_identifier\n collection.kinds.collect { |kind| kind.type_identifier }\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def anchor_types\n ANCHOR_LIST_KEYS\n end",
"def links\n\t\t@links.keys\n\tend",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def matching_links(type)\n link_pattern = config.public_send(\"link_#{type}_pattern\")\n return [] unless link_pattern\n\n metadata\n .select { |key| __send__(\"#{type}?\", key) }\n .map { |key, value| Allure::ResultUtils.public_send(\"#{type}_link\", key.to_s, value, link_pattern) }\n end",
"def show\n @h_identifier_types = {}\n IdentifierType.all.map{|it| @h_identifier_types[it.id] = it}\n end",
"def org_types\n organizations.map(&:organization_type)\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def all(id, type, scope = Amico.default_scope_key)\n validate_relationship_type(type)\n count = self.send(\"#{type.to_s}_count\".to_sym, id, scope)\n count > 0 ? self.send(\"#{type}\", id, {:page_size => count}, scope) : []\n end",
"def available_ledgers(type)\n @general_ledgers = search_ledgers.where(type => nil).page params[:page]\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def readable_entry_types\n BIDURI['entry_types'].select{|s| s['has_own_page'].nil? || s['has_own_page'] == true}.map{|m| m['entry_type']}\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def id_mapping_types\n @id_mapping_types ||= extract_classes_with_true(:track_imported_ids, configuration)\n end",
"def index\n @type_identifications = TypeIdentification.all\n end",
"def direct_types\n (self[\"directTypes\"] || ['*']).map { |t| Registry.get_type(t) }\n end",
"def index\n @identification_types = IdentificationType.all\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def available_related_content_types\n available_related_content.map{|hash| hash['Type'] }\n end",
"def types\n @types ||= []\n end",
"def affiliate_account_types\n @affiliate_account_types ||= []\n end",
"def relations_by_type\n relations = {}\n for i in 0..(self.relations.count-1)\n type = self.relations(i).type.first\n relations[type] ||= []\n relations[type] += self.relations(i).id\n end\n relations\n end",
"def category_types\n @category_types.each\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def all_links\n Link.all.order(id: :desc)\n end",
"def index\n @reltypes = Reltype.all\n end",
"def ids(type)\n Document.where(:typ => type).select(:ide).collect { |d| d[:ide] }.uniq.sort\n end",
"def read_links(ltype, id)\n return {} if !v[ltype]\n return {} if !v[ltype][id]\n v[ltype][id]\n end",
"def items_for_type(type)\n all_ids = []\n valid_ids = []\n AllItems.get.each do |item_code, values|\n _item_name, item_type, item_valid = values\n next unless item_type == type\n all_ids << item_code\n valid_ids << item_code if item_valid\n end\n\n [all_ids, valid_ids]\n end",
"def index\n @publinktypes = Publinktype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinktypes }\n end\n end",
"def link_for(type)\n if link = self.links.find { |link| link.type == type }\n link.to_s\n end\n end",
"def all_types\n @mutex.synchronize do\n @types.keys.find_all{ |t_| !t_.is_a?(AnonymousType) }\n end\n end",
"def get_activites_supportedtypes()\n @restv9.get_activites_supportedobjecttypes()\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def list_possible_status_ids\n\tstatustypes = @client.Status.all\n\tstatustypes.each do |status|\n\t\tputs \"#{status.id}\\t#{status.name}\"\n\tend\nend",
"def types\n @types ||= Types.new(@client)\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def link_has_many(reflection)\n \"#{reflection.name.to_s.singularize}_ids\".to_sym\n end",
"def index\n @route_types = RouteType.all\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def relation_types\n Spree::RelationType.where(applies_to: to_relation_name).order(:name)\n end",
"def get_mixin_type_identifiers\n identifiers = []\n\n get_mixin_types.each do |mixin_type|\n identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type\n end\n\n identifiers\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def aliases_of(type)\n all_names = types.keys.find_all do |name|\n types[name] == type\n end\n all_names.delete(type.name)\n all_names\n end",
"def identifier_uris\n return @identifier_uris\n end",
"def types\n @callers.keys\n end",
"def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end",
"def contact_types\n values = categories.map(&:contact_type_id)\n values.empty? ? @contact_types : values\n end",
"def index\n @identity_types = IdentityType.all\n end",
"def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end",
"def consumer_room_types\n result = Array.new\n if self.is_inventory_feeder?\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rtt|\n result << RoomType.find(rtt.room_type_from_id)\n end\n end\n result\n end",
"def get_relationships_of_type(type)\n g_command = get_command(type)\n relationships = self.send(g_command.to_sym)\n end",
"def index\n @types = ItemType.all\n end",
"def index\n @types = Type.all\n end",
"def available_types\n @bridge.available_log_types\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def type_names\n @type_names ||= @types.map { |clazz| clazz.name }\n end",
"def item_types(refresh: false)\n cname = \"#{name}.item_types\"\n Rails.cache.delete(cname) if refresh\n\n Rails.cache.fetch(cname) do\n list = []\n implementation_classes.each do |imp_class|\n list += imp_class.attribute_names\n .select { |a| Classification::GeneralSelection.use_with_attribute?(a) }\n .map do |a|\n mn = imp_class.model_name.to_s.ns_underscore\n mn = mn.pluralize unless imp_class.respond_to?(:is_activity_log)\n \"#{mn}_#{a}\".to_sym\n end\n end\n\n list\n end\n end",
"def list(resource_type_identifier=nil)\n if resource_type_identifier\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\" unless @model.get_by_id resource_type_identifier\n\n # split the type identifier and get the most important part\n uri_part = resource_type_identifier.split('#').last\n\n # request uri-list from the server\n path = uri_part + '/'\n else\n path = '/'\n end\n\n headers = self.class.headers.clone\n headers['Accept'] = 'text/uri-list'\n\n # TODO: remove the gsub OCCI-OS hack\n response = self.class.get(\n @endpoint + path,\n :headers => headers\n ).body.gsub(/\\# uri:\\/(compute|storage|network)\\/[\\n]?/, '').split(\"\\n\").compact\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def type_id\n\t\ttypes_id = [self.type1, self.type2]\n\t\treturn types_id\n\tend",
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def all\n all_by_type.values.flatten\n end",
"def links(type = :local)\n @links = type == :all ? @all_links : @local_links\n end",
"def possible_node_types(type)\n possible_types(type) & node_types\n end",
"def free_type_ids\n @type.var_ids - @ids\n end",
"def node_types\n schema.possible_types(node_interface)\n end"
] | [
"0.78509283",
"0.7835411",
"0.7781284",
"0.6346669",
"0.6222234",
"0.6172147",
"0.60230136",
"0.60179436",
"0.5991234",
"0.58334816",
"0.57899904",
"0.57544655",
"0.5732094",
"0.56883484",
"0.56710947",
"0.56587434",
"0.5650522",
"0.5612827",
"0.5600657",
"0.5600102",
"0.555882",
"0.55546683",
"0.554842",
"0.5547153",
"0.5547153",
"0.5547153",
"0.5544689",
"0.5534605",
"0.55305654",
"0.55135286",
"0.5512706",
"0.55109835",
"0.55097514",
"0.5506325",
"0.54979634",
"0.54911435",
"0.5490131",
"0.5479452",
"0.54609025",
"0.545567",
"0.5452689",
"0.5426647",
"0.5412305",
"0.53902245",
"0.53646076",
"0.5361401",
"0.5360103",
"0.53594184",
"0.53551066",
"0.53509635",
"0.5347314",
"0.53445137",
"0.5336346",
"0.5334387",
"0.5321906",
"0.531093",
"0.5310298",
"0.5306141",
"0.5302397",
"0.52558655",
"0.52377766",
"0.5236569",
"0.522595",
"0.52222943",
"0.52220917",
"0.52203256",
"0.52134705",
"0.5211023",
"0.5197276",
"0.51879174",
"0.5167217",
"0.5159226",
"0.5156823",
"0.51549953",
"0.51538634",
"0.5145514",
"0.5143589",
"0.51363534",
"0.5130994",
"0.512873",
"0.5127239",
"0.51221526",
"0.51219183",
"0.51205266",
"0.5109959",
"0.51081103",
"0.5104691",
"0.5102094",
"0.5095686",
"0.50915927",
"0.5090291",
"0.50824255",
"0.5075881",
"0.5063777",
"0.50622094",
"0.5053294",
"0.5051247",
"0.5047732",
"0.5036453",
"0.50339365"
] | 0.78948075 | 0 |
Looks up a mixin using its name and, optionally, a type as well. Will return mixin's full location (a link) or a description. | def find_mixin(name, type = nil, describe = false)
Occi::Log.debug("Looking for mixin #{name} + #{type} + #{describe}")
# is type valid?
if type
raise "Unknown mixin type! [#{type}]" unless @mixins.has_key? type.to_sym
end
# TODO: extend this code to support multiple matches and regex filters
# should we look for links or descriptions?
if describe
# we are looking for descriptions
if type
# get the first match from either os_tpls or resource_tpls
case
when type == "os_tpl"
get_os_templates.select { |mixin| mixin.term == name }.first
when type == "resource_tpl"
get_resource_templates.select { |template| template.term == name }.first
else
nil
end
else
# try in os_tpls first
found = get_os_templates.select { |os| os.term == name }.first
# then try in resource_tpls
found = get_resource_templates.select {
|template| template.term == name
}.first unless found
found
end
else
# we are looking for links
# prefix mixin name with '#' to simplify the search
name = "#" + name
if type
# return the first match with the selected type
@mixins[type.to_sym].select {
|mixin| mixin.to_s.reverse.start_with? name.reverse
}.first
else
# there is no type preference, return first global match
@mixins.flatten(2).select {
|mixin| mixin.to_s.reverse.start_with? name.reverse
}.first
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_mixin(name)\n @mixins.fetch(name.to_s) { |k| @parent ? @parent.lookup_mixin(k) : nil }\n end",
"def resolve_mixin(mixin, cur_tool, loader)\n mod =\n case mixin\n when ::String\n cur_tool.lookup_mixin(mixin)\n when ::Symbol\n loader.resolve_standard_mixin(mixin.to_s)\n when ::Module\n mixin\n end\n raise ToolDefinitionError, \"Mixin not found: #{mixin.inspect}\" unless mod\n mod\n end",
"def resolve_standard_mixin(name)\n @mixin_lookup.lookup(name)\n end",
"def get_mixins(type = nil)\n if type\n # is type valid?\n raise \"Unknown mixin type! #{type}\" unless @mixins.has_key? type.to_sym\n\n # return mixin of the selected type\n @mixins[type.to_sym]\n else\n # we did not get a type, return all mixins\n mixins = []\n\n # flatten the hash and remove its keys\n get_mixin_types.each do |ltype|\n mixins.concat @mixins[ltype.to_sym]\n end\n\n mixins\n end\n end",
"def update_mixin_from_model(mixin, model)\n return if mixin.blank?\n\n if mixin.kind_of? String\n # it's just an identifier\n model.get_by_id(mixin)\n elsif mixin.kind_of?(::Occi::Core::Mixin)\n # it's already a mix-in\n orig_mixin = model.get_by_id(mixin.type_identifier)\n if orig_mixin\n mixin.location = orig_mixin.location\n mixin.title = orig_mixin.title if mixin.title.blank?\n end\n\n mixin\n else\n # nothing we can do here\n nil\n end\n end",
"def mixin(namespace, type)\n Object.const_get \"#{namespace.name}::#{type}\"\n rescue NameError\n namespace.module_eval \"module #{type}; end\"\n namespace.const_get type\n end",
"def mixin(object) \n mixin_name = split(object)\n \"@mixin #{mixin_name} {}\"\n end",
"def default_mixin_lookup\n ModuleLookup.new.add_path(\"toys/standard_mixins\")\n end",
"def register_mixin(model_type, mixin)\n possible_models = {\n :devices => 'Optopus::Device',\n :events => 'Optopus::Event',\n :locations => 'Optopus::Location',\n :nodes => 'Optopus::Node',\n :roles => 'Optopus::Role',\n :users => 'Optopus::User',\n :networks => 'Optopus::Network',\n :addresses => 'Optopus::Address',\n }\n model = possible_models[model_type]\n raise \"invalid model type, valid types: #{possible_models.keys.join(', ')}\" if model.nil?\n Optopus::Models.register_mixin(model, mixin)\n end",
"def mixin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = MIXIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 162:9: 'mixin'\n match( \"mixin\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end",
"def add_mixin(name, mixin_module = nil, &block)\n name = name.to_s\n if @mixins.key?(name)\n raise ToolDefinitionError,\n \"A mixin named #{name.inspect} has already been defined in tool\" \\\n \" #{display_name.inspect}.\"\n end\n @mixins[name] = mixin_module || Mixin.create(&block)\n self\n end",
"def get_mixin_types\n @mixins.keys.map { |k| k.to_s }\n end",
"def resource_tpl_get(term)\n ###\n # See #resource_tpl_list for details on how to create Occi::Core::Mixin instances.\n # Here you simply select a specific instance with a matching term.\n # Since terms must be unique, you should always return at most one instance.\n ###\n found = resource_tpl_list.to_a.select { |m| m.term == term }.first\n fail Backends::Errors::ResourceNotFoundError, \"Mixin with term #{term.inspect} does not exist!\" unless found\n\n found\n end",
"def sass_mixin\n sass_backtrace.first[:mixin]\n end",
"def extension_prefix\n mixin? ? '@mixin ' : '%'\n end",
"def mixin?\n !!@options[:mixin]\n end",
"def get_mixin_data_for_org(mixin, org=nil)\n base = @yaml.organizations.first[1]\n get_mixin_data_for_level(base, mixin)\n end",
"def register_mixin(target_class,field,mod,options)\n mixin_registry[target_class][field.to_s] = [:single, mod, options]\n end",
"def lookup(name, pack_type = {})\n find(full_pack_name(name, pack_type[:type]))\n end",
"def add_mixin(mixin)\n unless mixin\n raise Occi::Core::Errors::MandatoryArgumentError,\n 'Cannot add a non-existent mixin'\n end\n\n # TODO: handle adding actions\n mixins << mixin\n reset_added_attributes\n end",
"def mixin_specific_behaviour\n raise \"Roles require a name\" if self.name.nil?\n Rails.logger.info(\"Seeing if #{self.name} has a mixin...\")\n begin\n mod = \"barclamp_#{barclamp.name}\".camelize.to_sym\n return self unless Module::const_defined?(mod)\n mod = Module::const_get(mod)\n [\"role\",\n self.name].map{|m|m.tr(\"-\",\"_\").camelize.to_sym}.each do |m|\n return self unless mod.const_defined?(m)\n mod = mod.const_get(m)\n return self unless mod.kind_of?(Module)\n end\n Rails.logger.info(\"Extending #{self.name} with #{mod}\")\n self.extend(mod)\n rescue\n # nothing for now, this code is going away\n end\n end",
"def lookup(name, type: nil)\n # When using SplitChunks or RuntimeChunks the manifest hash will contain an extra object called\n # \"entrypoints\". When the entrypoints key is not present in the manifest, or the name is not\n # found in the entrypoints hash, it will raise a NoMethodError. If this happens, we should try\n # to lookup a single instance of the pack based on the given name.\n manifest_pack_type = manifest_type(type)\n manifest_pack_name = manifest_name(name, manifest_pack_type)\n\n # Lookup the pack in the entrypoints of the manifest\n find('entrypoints')[manifest_pack_name]['assets'][manifest_pack_type]\n rescue NoMethodError\n # Lookup a single instance of the pack.\n find full_pack_name(name, type)\n end",
"def remove_mixin(mixin)\n unless mixin\n raise Occi::Core::Errors::MandatoryArgumentError,\n 'Cannot remove a non-existent mixin'\n end\n\n # TODO: handle removing actions\n mixins.delete mixin\n reset_attributes\n end",
"def lookup(name, pack_type = {})\n compile if compiling?\n\n find(full_pack_name(name, pack_type[:type]))\n end",
"def lookup(name, pack_type = {})\n compile if compiling?\n\n find(full_pack_name(name, pack_type[:type]))\n end",
"def add_mixin(model)\n raise InvalidMixin.new(\"#{model.name} already mixed in to this model\") if mixins.include?(model)\n raise InvalidMixin.new(\"Mixin cannot be a parent\") if ancestors.include?(model)\n \n # for all intents and purposes, by mixing in a model, we are a subtype of that model\n model.add_descendant(self)\n mixins << model\n save\n end",
"def mixin(value)\n @mixins << value\n\n if value.is_a?(String)\n value = YAML.load(File.read(value))\n end\n\n return unless value\n\n value = Section.from_hash(value)\n\n deep_merge!(value.delete(:generic)) if value.has_key?(:generic)\n\n if value.has_key?(Env.to_sym)\n deep_merge!(value[Env.to_sym])\n else\n deep_merge!(value)\n end\n end",
"def lookup(type_name, id)\n try_extensions(:lookup, type_name, id)\n end",
"def lookup(type, name)\n from_table(type, name)\n end",
"def section_name(type, name)\n if type.nil?\n name\n elsif name == 'default'\n type\n else\n \"#{type}:#{name}\"\n end\n end",
"def find(slug)\n type = slug.to_s.demodulize.classify\n\n subclasses.find do |subclass|\n subclass.name.gsub(prefix, '') == type.to_s.gsub(prefix, '')\n end || raise(TypeError.new(type, types.to_sentence))\n end",
"def replace_mixin(old_mixin, new_mixin)\n # TODO: handle replacing actions\n remove_mixin old_mixin\n add_mixin new_mixin\n end",
"def lookup(type_name, resource_name)\n self.class.catalog_lookup(resource.catalog, type_name, resource_name)\n end",
"def extension_strategy\n mixin? ? '@include ' : '@extend %'\n end",
"def get_sound_source(type)\r\n sound = nil\r\n case type\r\n when :play_fitbell\r\n sound = File.join(get_resource_path, \"sound/fitebell.wav\")\r\n when :play_ba\r\n sound = File.join(get_resource_path, \"sound/ba.wav\")\r\n when :play_click4\r\n sound = File.join(get_resource_path, \"sound/click_4bit.wav\")\r\n when :play_mescola\r\n sound = File.join(get_resource_path, \"sound/dealtwocards.wav\")\r\n else\r\n @log.debug(\"Sound not recognized #{type}\")\r\n end #end case\r\n return sound\r\n end",
"def lookup(type_name, id)\n return unless type_name.starts_with?(namespace)\n types.each_pair do |type, graph_type|\n return type.find(id) if graph_type.name == type_name\n end\n nil\n end",
"def find_strategy(type)\n \"Simple::OAuth2::Strategies::#{type.to_s.camelize}\".constantize\n end",
"def build_mixin_body(scope)\n @mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' }\n <<-STYL\nasset-url(key)\n return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:url]} ()\nasset-path(key)\n return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:path]} ()\n STYL\n else\n ''\n end\n end",
"def mixing_in( mixins, content )\n\n def clauses_mixins( mixins, content )\n clauses_to_delete = []\n clauses_to_mixin = []\n \n mixins.each do | mixin, replacer |\n replacer = replacer.to_s.downcase\n clauses_to_delete << mixin if replacer == \"false\"\n clauses_to_mixin << mixin if replacer == \"true\"\n end\n \n clauses_to_delete.each { |m| mixins.delete(m) }\n clauses_to_mixin.each { |m| mixins.delete(m) }\n\n until clauses_to_delete.size == 0\n clauses_to_delete.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /\\[{{(\\S+)}}/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_delete.include?($1)\n content = content.gsub( get_it_all, \"\" )\n clauses_to_delete.delete( mixin ) unless content[pattern]\n end\n end\n\n until clauses_to_mixin.size == 0\n clauses_to_mixin.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /(\\[{{\\S+}})/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_mixin.include?($1)\n content = content.gsub( get_it_all, sub_clause )\n clauses_to_mixin.delete( mixin ) unless content[pattern]\n end\n end\n\n return [content, mixins]\n end\n\n def normal_mixins( mixins, content )\n mixins.each do | mixin, replacer |\n unless mixin =~ /level-\\d/ or mixin =~ /no-reset/ or mixin =~ /no-indent/\n replacer = replacer.to_s\n safe_words = [ \"title\", \"author\", \"date\" ]\n pattern = /({{#{mixin}}})/\n if content =~ pattern\n content = content.gsub( $1, replacer )\n mixins.delete( mixin ) unless safe_words.any?{ |s| s.casecmp(mixin) == 0 }\n end\n end\n end\n return [content, mixins]\n end\n\n clauses_mixed = clauses_mixins( mixins, content )\n mixed = normal_mixins( clauses_mixed[1], clauses_mixed[0] )\n return [ mixed[0], mixed[1] ]\n end",
"def lookup_resource(type, name, run_context)\n begin\n run_context.resource_collection.find(\"#{ type }[#{ name }]\")\n rescue ArgumentError => e\n puts \"You provided invalid arugments to resource_collection.find: #{ e }\"\n rescue RuntimeError => e\n puts \"The resources you searched for were not found: #{ e }\"\n end\n end",
"def add_selector_or_property(line, index)\n\n property = line.match($property_matcher)\n\n if line.match(/[#|\\.][a-zA-Z\\:\\-]+/) || $html_elements.include?(line.match(/\\w+/)[0].to_sym)\n # before immediately adding a child, need to check name against the mixin index and see\n # if it matches a mixin\n $context = $context.add_child(line, index)\n elsif property && property.length == 3\n # this is where I need to look for variables, colors, and functions\n # add property should be split out to its own sub-method that detects these things\n $context.add_property(property)\n\n else\n # there needs to be an else here that looks for traditional() mixin syntax\n # and another like that looks for @directives\n # - @media, @font-face, @keyframes, @extend\n # really some of these should only be allowed at root level\n throw \"Flagrant code error! Syntax error on line #{index} - make sure you are writing a valid selector.\"\n end\nend",
"def get_mixin_type_identifiers\n identifiers = []\n\n get_mixin_types.each do |mixin_type|\n identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type\n end\n\n identifiers\n end",
"def section_by_name(section_name)\n result = nil\n all_sections = sections\n return result unless all_sections\n\n all_sections.each do |section|\n result = section if section['display_name'] == section_name\n end\n result\n end",
"def find_resource(type, name)\n begin\n return resource_collection.lookup(\"#{type}[#{name}]\")\n rescue Chef::Exceptions::ResourceNotFound; end\n\n resource_collection.all_resources.find do |resource|\n resource_name(resource) == type && (name === resource.identity || name === resource.name)\n end\n end",
"def find_by_mixin(mixin)\n raise ArgumentError, 'Mixin is a mandatory argument' unless mixin\n Set.new(entities.select { |elm| elm.mixins.include?(mixin) })\n end",
"def get_helper(name)\n @helpers[name] ||= load_helper(name)\n end",
"def [](name)\n name = name.to_s\n each_section do |section|\n return section if section.name == name\n end\n nil\n end",
"def valid_mixin_parent?(term)\n MIXIN_PARENTS.include? term\n end",
"def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"def get(name)\n module_name = /^#{name.to_s.dup.delete('_')}(?:helper)?$/i\n\n options.namespaces.each do |namespace|\n found = namespace.constants.grep(module_name).first\n return namespace.const_get(found) if found\n end\n\n nil\n end",
"def lookup_path_direct(namespace, path, type); end",
"def load_shared\n @shared_mixins ||= begin\n log_status ' Reading shared mixins from mixins.less'\n read_mixins read_files('less', ['mixins.less'])['mixins.less'], nested: NESTED_MIXINS\n end\n end",
"def section_by_name(section_name); end",
"def mixin_registry\n @mixin_registry ||= Hash.new {|h,k| h[k] = {}}\n end",
"def P(namespace, name = nil, type = nil)\n namespace, name = nil, namespace if name.nil?\n YARD::Registry.resolve(namespace, name, false, true, type)\nend",
"def by_type(type)\n (types['url'].find { |url| url['@type'] == type }).tap do |url|\n raise(StandardError, 'URL details are missing.') if url.nil?\n end['$']\n end",
"def resource_type\n /(\\/api\\/(?<type>\\w+)\\/?)/ =~ full_url\n type.capitalize\n end",
"def find(name)\n @@subclasses.fetch(name.to_s, nil)\n end",
"def find_class_or_module name\n @store.find_class_or_module name\n end",
"def parent_locator(type, name)\n if !@locators.nil? && @locators.key?(self.name) && @locators[self.name].key?(type) && @locators[self.name][type].key?(name)\n @locators[self.name][type][name]\n else\n self.superclass.parent_locator(type, name) unless self.superclass == Object\n end\n end",
"def find_roll name, options = {}\n return if on_the_menu? name\n\n # return specific source roll if specified in the menu\n #\n if source = options[:source]\n require_roll name, File.join(source, name.to_s)\n return\n\n # look through the sources for the first roll that matches.\n # sources are listed in the menu in order of priority\n else\n @sources.each do |source|\n if path = source.rolls[name]\n require_roll name, path\n return\n end\n end\n end\n\n # no roll was found\n Yuyi.say \"You ordered the '#{name}' roll off the menu, but we are fresh out...\", :type => :fail\n Yuyi.say 'Check your menu to make sure a source with your roll is listed.', :type => :warn\n Yuyi.say\n end",
"def find_phoneable\n phoneable_type.to_s.classify.constantize.find(phoneable_id)\n end",
"def find_by_name(name)\n types[name]\n end",
"def glob_for(type)\n Merb.load_paths[type][1]\n end",
"def dir_for(type) Merb.load_paths[type].first end",
"def dir_for(type)\n Merb.load_paths[type].first\n end",
"def display_resource(section)\n section.name\n end",
"def lookup(mime_type)\n if type = Mime::LOOKUP.assoc(mime_type)\n return type.last\n end\n end",
"def hop_type\n case location.type\n when Location::GALAXY\n :galaxy\n when Location::SOLAR_SYSTEM, Location::SS_OBJECT\n :solar_system\n else\n nil\n end\n end",
"def helper(name, controller = nil)\n if controller\n matched_helpers = @helpers.select do |h|\n h.name == name.to_sym && (h.controller.nil? || h.controller == controller)\n end\n else\n matched_helpers = @helpers.select { |h| h.name == name.to_sym && h.controller.nil? }\n end\n matched_helpers.first\n end",
"def get_id_by_type_and_name(type, name)\n check_property(type)\n check_property(name)\n\n result = find({:type => type, :name => name})\n if result.empty?\n nil\n else\n result[0][:id]\n end\n end",
"def get_loader(name)\n @loaders.each do |loader|\n return loader if loader.name == name\n end\n end",
"def type\n if @type\n return @type\n elsif self.sip_accounts.count > 0\n return :sipaccount\n elsif self.conferences.count > 0\n return :conference\n elsif self.users.count > 0\n return :faxreceive\n elsif self.destination == '-vmenu-'\n return :vmenu\n elsif self.destination == '-park-in-'\n return :parkin\n elsif self.destination == '-park-out-'\n return :parkout\n elsif self.destination =~ /-queue-(.*)/\n return :queue\n else\n return nil\n end\n end",
"def [](path)\n (myconcern, remainder) = path.split('/', 2)\n if myconcern.nil? or myconcern == '' then\n return nil\n elsif myconcern == '..' then\n target = parent\n else\n target = collection(myconcern) || resource(myconcern)\n end\n\n if target.nil? then\n return nil\n elsif remainder then\n return target[remainder]\n else\n return target\n end\n end",
"def find(macro_name); end",
"def section(name)\n sections.find { |el| el.name == name.to_s }\n end",
"def magic_mixin(mod)\n # Add the passed module to the inherits_from class variable\n inherits_from = nil\n begin\n inherits_from = self.class_variable_get(\"@@inherits_from\")\n rescue NameError\n inherits_from ||= []\n end\n inherits_from << mod.to_sym\n self.class_variable_set(:@@inherits_from,inherits_from)\n \n # Do the actually class extension using class_exec\n self.class_exec do\n # Grab the module name from the last entry of inherits_from\n # class variable. This is done because class_exec doesn't\n # include the calling methods local variables.\n @@current_mod = @@inherits_from.last\n @@current_mod.to_s.classify.constantize.extend_class(self)\n end\n end",
"def type(type = nil)\n @type = type if type\n @type || name.split('::').last.gsub(/Resource$/, '').underscore\n end",
"def try_route(type, name)\n try_route_with_redis(type, name)\n end",
"def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end",
"def extract_id(self_link, type)\n link = self_link.match(/#{type}\\/(?<id>\\d+)/)\n id = link['id']\nend",
"def get_type_from_path path\n settings.type_paths[path]\nend",
"def get_resource(ty, nm)\n o = self.send \"#{ty}s\".to_sym\n o.detect {|r| r.name == nm }\n end",
"def polymorphic_slug_for(resource)\n Object.const_get(\"::Madmin::Resources::#{resource.send(\"#{key}_type\")}\").new.slug\n end",
"def type_name_with_module(type_name)\n self.name =~ /::/ ? self.name.scan(/(.*)::/).first.first + \"::\" + type_name : type_name\n end",
"def resolve(namespace, name, inheritance = T.unsafe(nil), proxy_fallback = T.unsafe(nil), type = T.unsafe(nil)); end",
"def test_get_location_single\n loc = MiniTest::Mock.new(\"location 1\")\n def loc.name; @delegator; end\n @mp.add_location loc\n assert_equal loc, @mp.get_location(\"location 1\")\n end",
"def get_shower_type\n self.shower_type ? self.shower_type.i18n_description : '?'\n end",
"def reference_name\n name + (section && \"(#{section})\").to_s\n end",
"def get_plugin(name); Ricer::Plugin.by_name(name); end",
"def get_location_template\n return @location_st.get_instance_of\n end",
"def glob_for(type) Merb.load_paths[type][1] end",
"def read_shared_mixins!(mixins_file)\n log_status \" Reading shared mixins from mixins.less\"\n @shared_mixins = get_mixin_names(mixins_file, silent: true)\n NESTED_MIXINS.each do |selector, prefix|\n # we use replace_rules without replacing anything just to use the parsing algorithm\n replace_rules(mixins_file, selector) { |rule|\n @shared_mixins += get_mixin_names(unindent(unwrap_rule_block(rule)), silent: true).map { |name| \"#{prefix}-#{name}\" }\n rule\n }\n end\n @shared_mixins.sort!\n log_file_info \"shared mixins: #{@shared_mixins * ', '}\"\n @shared_mixins\n end",
"def target\n RssLog.all_types.each do |type|\n obj = send(type.to_sym)\n return obj if obj\n end\n nil\n end",
"def find_by_generic(name, type = nil)\n if name.nil?\n return nil\n elsif not name.is_a? String\n name = name.to_s\n end\n\n name = name.downcase\n @ghash.dup.each_value do |o|\n if type.nil?\n if o.generic.downcase == name or o.name.downcase == name or o.alt_names.find {|n| n.downcase == name }\n return o\n end\n else\n if o.is_a? type and (o.generic.downcase == name or o.name.downcase == name or o.alt_names.find {|n| n.downcase == name })\n return o\n end\n end\n end\n\n return nil\n end",
"def load_commentable_first\n \t# /photos/1, or /articles/2,...\n \tresource, id = request.path.split('/')[1,2]\n\n \t# photos -> photo -> 'Photo' -> Photo -> Photo.find\n \t@commentable = resource.singularize.classify.constantize.find(id)\n end",
"def lookup_path_inherited(namespace, path, type); end",
"def navigation_location\n return options[:location] if options[:location]\n klass = resources.last.class\n\n if klass.respond_to?(:model_name)\n resources[0...-1] << klass.model_name.plural.to_sym\n else\n resources\n end\n end",
"def lookup(path)\n manifest = manifests.detect { |m| m.match?(path) }\n if manifest && (asset = manifest.lookup(path))\n return mount(asset)\n end\n path\n end",
"def type_description\n type = LocationType.find_by_code(self.location_type_code)\n if (type)\n type.description\n else\n nil\n end\n end"
] | [
"0.68363106",
"0.62106866",
"0.59954774",
"0.5880233",
"0.5870427",
"0.5768124",
"0.54502344",
"0.5387423",
"0.53281236",
"0.5076696",
"0.4999048",
"0.49348515",
"0.47635597",
"0.47428054",
"0.47157726",
"0.46905813",
"0.4618577",
"0.46107185",
"0.45893195",
"0.45359218",
"0.45302072",
"0.44453344",
"0.4408149",
"0.430282",
"0.4299816",
"0.4291419",
"0.4242458",
"0.4236946",
"0.41848683",
"0.4163321",
"0.4161532",
"0.41298854",
"0.41096833",
"0.4088873",
"0.40840745",
"0.40839309",
"0.4029727",
"0.40287596",
"0.4021206",
"0.40145686",
"0.39913842",
"0.39799964",
"0.3956549",
"0.39499477",
"0.39422047",
"0.3936826",
"0.39082748",
"0.3906672",
"0.3903078",
"0.38959363",
"0.38890243",
"0.38763255",
"0.38708317",
"0.38668588",
"0.38544852",
"0.38494897",
"0.38434315",
"0.38392475",
"0.38256815",
"0.38253218",
"0.38015425",
"0.37965348",
"0.37959054",
"0.37956354",
"0.37875307",
"0.37859008",
"0.3785814",
"0.37737566",
"0.3773643",
"0.3766473",
"0.3762015",
"0.37560093",
"0.37521484",
"0.37481603",
"0.37432307",
"0.37361008",
"0.37333798",
"0.37237653",
"0.3718533",
"0.37128857",
"0.37112477",
"0.37089738",
"0.36906934",
"0.36895996",
"0.36759537",
"0.36735612",
"0.36618787",
"0.36564797",
"0.36523265",
"0.36483866",
"0.36449283",
"0.3640091",
"0.36394998",
"0.36374262",
"0.3633594",
"0.36252755",
"0.36212677",
"0.36204004",
"0.36141804",
"0.3613788"
] | 0.7950162 | 0 |
Retrieves available mixins of a specified type or all available mixins if the type wasn't specified. Mixins are returned in the form of mixin identifiers. | def get_mixins(type = nil)
if type
# is type valid?
raise "Unknown mixin type! #{type}" unless @mixins.has_key? type.to_sym
# return mixin of the selected type
@mixins[type.to_sym]
else
# we did not get a type, return all mixins
mixins = []
# flatten the hash and remove its keys
get_mixin_types.each do |ltype|
mixins.concat @mixins[ltype.to_sym]
end
mixins
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_mixin(name, type = nil, describe = false)\n\n Occi::Log.debug(\"Looking for mixin #{name} + #{type} + #{describe}\")\n\n # is type valid?\n if type\n raise \"Unknown mixin type! [#{type}]\" unless @mixins.has_key? type.to_sym\n end\n\n # TODO: extend this code to support multiple matches and regex filters\n # should we look for links or descriptions?\n if describe\n # we are looking for descriptions\n if type\n # get the first match from either os_tpls or resource_tpls\n case\n when type == \"os_tpl\"\n get_os_templates.select { |mixin| mixin.term == name }.first\n when type == \"resource_tpl\"\n get_resource_templates.select { |template| template.term == name }.first\n else\n nil\n end\n else\n # try in os_tpls first\n found = get_os_templates.select { |os| os.term == name }.first\n\n # then try in resource_tpls\n found = get_resource_templates.select {\n |template| template.term == name\n }.first unless found\n\n found\n end\n else\n # we are looking for links\n # prefix mixin name with '#' to simplify the search\n name = \"#\" + name\n if type\n # return the first match with the selected type\n @mixins[type.to_sym].select {\n |mixin| mixin.to_s.reverse.start_with? name.reverse\n }.first\n else\n # there is no type preference, return first global match\n @mixins.flatten(2).select {\n |mixin| mixin.to_s.reverse.start_with? name.reverse\n }.first\n end\n end\n end",
"def get_mixin_types\n @mixins.keys.map { |k| k.to_s }\n end",
"def register_mixin(model_type, mixin)\n possible_models = {\n :devices => 'Optopus::Device',\n :events => 'Optopus::Event',\n :locations => 'Optopus::Location',\n :nodes => 'Optopus::Node',\n :roles => 'Optopus::Role',\n :users => 'Optopus::User',\n :networks => 'Optopus::Network',\n :addresses => 'Optopus::Address',\n }\n model = possible_models[model_type]\n raise \"invalid model type, valid types: #{possible_models.keys.join(', ')}\" if model.nil?\n Optopus::Models.register_mixin(model, mixin)\n end",
"def get_mixin_type_identifiers\n identifiers = []\n\n get_mixin_types.each do |mixin_type|\n identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type\n end\n\n identifiers\n end",
"def list(mixins = nil)\n if mixins.blank?\n read_storage_fixtures\n else\n filtered_storages = read_storage_fixtures.to_a.select { |s| (s.mixins & mixins).any? }\n ::Occi::Core::Resources.new filtered_storages\n end\n end",
"def components_with_type(type)\n array = []\n @components.each_value do |c|\n array << c.proxy.name if c.proxy.respond_to?(:has_type?) &&\n c.proxy.has_type?(type)\n end\n array\n end",
"def get_applicable_plugins(type)\n PluginManager.get_plugins_by('items', type)\n end",
"def parents_and_mixins\n models = parent.try(:parents_and_mixins) || []\n mixins.each do |mixin_model|\n models |= mixin_model.parents_and_mixins\n end\n models << self\n end",
"def mixin(namespace, type)\n Object.const_get \"#{namespace.name}::#{type}\"\n rescue NameError\n namespace.module_eval \"module #{type}; end\"\n namespace.const_get type\n end",
"def lookup_mixin(name)\n @mixins.fetch(name.to_s) { |k| @parent ? @parent.lookup_mixin(k) : nil }\n end",
"def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance => [:cant_extend, :can_extend],\r\n :objcreation => [:cant_create, :can_create]}\r\n\r\n find_all { |x| facts2typerule[type].index(x.type_interaction) != nil }\r\n end",
"def callbacks_for(type)\n if superclass.respond_to?(:callbacks_for)\n matching_callbacks = superclass.callbacks_for(type)\n else\n matching_callbacks = []\n end\n matching_callbacks += callbacks[type.to_sym] if callbacks[type.to_sym]\n matching_callbacks\n end",
"def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def read_shared_mixins!(mixins_file)\n log_status \" Reading shared mixins from mixins.less\"\n @shared_mixins = get_mixin_names(mixins_file, silent: true)\n NESTED_MIXINS.each do |selector, prefix|\n # we use replace_rules without replacing anything just to use the parsing algorithm\n replace_rules(mixins_file, selector) { |rule|\n @shared_mixins += get_mixin_names(unindent(unwrap_rule_block(rule)), silent: true).map { |name| \"#{prefix}-#{name}\" }\n rule\n }\n end\n @shared_mixins.sort!\n log_file_info \"shared mixins: #{@shared_mixins * ', '}\"\n @shared_mixins\n end",
"def find_by_mixin(mixin)\n raise ArgumentError, 'Mixin is a mandatory argument' unless mixin\n Set.new(entities.select { |elm| elm.mixins.include?(mixin) })\n end",
"def get_relationships_of_type(type)\n g_command = get_command(type)\n relationships = self.send(g_command.to_sym)\n end",
"def joined_by_type(type)\n\t\tArray(self.joined.find_all_by_joinable_type(type))\n\tend",
"def get_models(model_type)\n model_store.get_collection class_for_type(model_type)\n end",
"def get_assets(type, options = {})\n type = type.to_sym\n\n filtered_assets = []\n\n parents.each do |parent|\n filtered_assets.concat(parent.assets[type]) if parent.assets.include? type\n end if parents\n\n filtered_assets.concat(@assets[type]) if @assets.include?(type)\n\n return [] if filtered_assets.nil? or filtered_assets.empty?\n\n if package_name = options[:package]\n filtered_assets = filter_by_package_name(package_name.to_sym,\n filtered_assets)\n end\n\n if set = options[:set]\n filtered_assets = filter_by_set(set.to_sym, filtered_assets)\n end\n\n # Get asset paths and remove duplicates\n filtered_assets = filtered_assets.map do |asset|\n asset.paths(type)\n end.flatten.uniq\n\n # Remove already rendered assets (paths)\n (filtered_assets - @rendered_assets).tap do |assets|\n @rendered_assets.concat(assets)\n end\n end",
"def mixins(*scopes); end",
"def get_types(type)\n result = []\n types = TYPE_CONVERSION_TREE[type]\n if types\n result += types\n types.each do |t|\n result |= get_types(t)\n end\n end\n result\n end",
"def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"def available_plugins(type: :export)\n type = valid_type(type)\n plugins[type].keys.sort\n end",
"def load_shared\n @shared_mixins ||= begin\n log_status ' Reading shared mixins from mixins.less'\n read_mixins read_files('less', ['mixins.less'])['mixins.less'], nested: NESTED_MIXINS\n end\n end",
"def include_into(*klasses)\n klasses.flatten!\n klasses.each do |klass|\n (@@class_mixins[klass] ||= []) << self\n @@class_mixins[klass].uniq!\n end\n end",
"def groups_by_asset_type(type)\n arr = []\n groups.each do |group|\n arr << group if !@bundles[group.to_s].assets(type.to_sym).empty?\n end\n return arr\n end",
"def mixing_in( mixins, content )\n\n def clauses_mixins( mixins, content )\n clauses_to_delete = []\n clauses_to_mixin = []\n \n mixins.each do | mixin, replacer |\n replacer = replacer.to_s.downcase\n clauses_to_delete << mixin if replacer == \"false\"\n clauses_to_mixin << mixin if replacer == \"true\"\n end\n \n clauses_to_delete.each { |m| mixins.delete(m) }\n clauses_to_mixin.each { |m| mixins.delete(m) }\n\n until clauses_to_delete.size == 0\n clauses_to_delete.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /\\[{{(\\S+)}}/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_delete.include?($1)\n content = content.gsub( get_it_all, \"\" )\n clauses_to_delete.delete( mixin ) unless content[pattern]\n end\n end\n\n until clauses_to_mixin.size == 0\n clauses_to_mixin.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /(\\[{{\\S+}})/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_mixin.include?($1)\n content = content.gsub( get_it_all, sub_clause )\n clauses_to_mixin.delete( mixin ) unless content[pattern]\n end\n end\n\n return [content, mixins]\n end\n\n def normal_mixins( mixins, content )\n mixins.each do | mixin, replacer |\n unless mixin =~ /level-\\d/ or mixin =~ /no-reset/ or mixin =~ /no-indent/\n replacer = replacer.to_s\n safe_words = [ \"title\", \"author\", \"date\" ]\n pattern = /({{#{mixin}}})/\n if content =~ pattern\n content = content.gsub( $1, replacer )\n mixins.delete( mixin ) unless safe_words.any?{ |s| s.casecmp(mixin) == 0 }\n end\n end\n end\n return [content, mixins]\n end\n\n clauses_mixed = clauses_mixins( mixins, content )\n mixed = normal_mixins( clauses_mixed[1], clauses_mixed[0] )\n return [ mixed[0], mixed[1] ]\n end",
"def by_type(type)\n processors.values.detect { |v| v.prefix == type&.upcase }\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def glob_for(type)\n Merb.load_paths[type][1]\n end",
"def externals(type)\n @externals ||= []\n\n type = type.to_sym\n parent_externals = if superclass.respond_to?(:externals)\n superclass.externals(type)\n else\n []\n end\n\n my_externals = @externals.select do |external|\n external.type == type\n end\n\n (parent_externals + my_externals).uniq\n end",
"def compute_list(mixins = nil)\n mixins = deep_clone(mixins) if mixins\n @backend_instance.compute_list(mixins) || Occi::Core::Resources.new\n end",
"def load_selectors(value_type)\n selectors.active.where(value_type: value_type).to_a\n end",
"def children_by_type(type)\n children = YARD::Registry.all(type)\n children.select { |child| child.parent == self }\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def [](type)\n (@styles_by_type ||= {})[type.to_sym] ||= []\n end",
"def patterns_for_type(type_)\n @mutex.synchronize do\n typedata_ = @types[type_]\n typedata_ ? typedata_.dup : []\n end\n end",
"def add_mixin(model)\n raise InvalidMixin.new(\"#{model.name} already mixed in to this model\") if mixins.include?(model)\n raise InvalidMixin.new(\"Mixin cannot be a parent\") if ancestors.include?(model)\n \n # for all intents and purposes, by mixing in a model, we are a subtype of that model\n model.add_descendant(self)\n mixins << model\n save\n end",
"def parsers_for type\n raise TypeMissing, \"You need to specify a type\" unless type\n\n parsers = @@parsers.select do |parser,prio|\n parser::TYPES.include?(type) \n end\n\n parsers = parsers.sort_by do |parser,prio|\n prio\n end\n\n parsers.to_h.keys\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def get_by_type(type, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/type/#{type}\")\n end",
"def class_for(type)\n klass = type.to_s.classify.constantize rescue nil\n return klass if self.subclasses.include? klass\n end",
"def requested_models(requested_model)\n case requested_model\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n base_model = $1.classify.constantize\n scopes = $2.split(',')\n models = base_model\n\n scopes.each do |scope|\n models = models.send(scope.strip)\n end\n\n models.all\n\n when String #is name\n requested_model.singularize.constantize.all\n else\n requested_model.all\n end\nend",
"def lookup_methods(klass, type = nil)\n types = type.nil? ? %i[instance singleton] : type\n types.map do |t|\n [t, method_stats(t == :singleton ? klass.singleton_class : klass)]\n end.to_h\n end",
"def rules_for_type(type)\n FILTER_VALUES.each do |rule|\n return rule if rule[:type] == type\n end\n nil\n end",
"def get_all_inherits(systems,code = @code)\n return [] unless code.is_a?(Array)\n return code.reduce([]) do |ar,sub|\n ar + get_all_inherits(systems,sub)\n end + (code.select { |sub| is_inherit?(sub,systems) }).to_a\n end",
"def mixin_registry\n @mixin_registry ||= Hash.new {|h,k| h[k] = {}}\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def section_types\n type.children.select { |child| child.class == SectionType }\n end",
"def get_services (type = nil, pool = nil)\n\n # NOTE: query_for_services asks for everything, rather than using the\n # more selective resource paths provided by the discovery services.\n # This allows the user to query for all services in a given pool,\n # which is not an available resource path\n\n if !pool.nil? && type.nil?\n service_data = query_for_services()\n result = []\n\n service_data['services'].each do |service|\n if type.nil? || service['type'].eql?(type)\n result << service if pool.nil? || service['pool'].eql?(pool)\n end\n end\n\n return result\n end\n\n service_data = query_for_services(type, pool)\n return service_data[\"services\"]\n end",
"def subclasses\n if block_given?\n ::Class.all do |c|\n yield c if c < self\n end\n else\n enum_for :subclasses\n end\n end",
"def get_by_type( klass )\r\n @types[ klass ] ||= {}\r\n @types[ klass ].keys\r\n end",
"def mixin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = MIXIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 162:9: 'mixin'\n match( \"mixin\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end",
"def list(mixins = nil)\n # TODO: impl filtering with mixins\n network = ::Occi::Core::Resources.new\n backend_network_pool = ::OpenNebula::VirtualNetworkPool.new(@client)\n rc = backend_network_pool.info_all\n check_retval(rc, Backends::Errors::ResourceRetrievalError)\n\n backend_network_pool.each do |backend_network|\n network << parse_backend_obj(backend_network)\n end\n\n network\n end",
"def supertypes\n all_supertype_inheritance.map{|ti|\n ti.supertype\n }\n end",
"def loaded_instances(type)\n @instances[type].keys\n end",
"def types\n @types ||= []\n end",
"def fetch_facebook_friends_or_subscribers_or_subscribedto (type)\n identity = self.identities.find_by_provider_id(ApplicationController.fb_app[:id])\n\t\tif type == \"friends\"\n\t\t\tgraph_url_string = getURL( ApplicationController.fb_app[:graph][:query_root_url] + ApplicationController.fb_app[:graph][:query_friends_suffix], {:access_token =>identity.authentication.token} )\n\t\telsif type == \"subscribers\"\n\t\t\tgraph_url_string = getURL( ApplicationController.fb_app[:graph][:query_root_url] + ApplicationController.fb_app[:graph][:query_subscribers_suffix], {:access_token =>identity.authentication.token} )\n\t\telsif type == \"subscribedto\"\n\t\t\tgraph_url_string = getURL( ApplicationController.fb_app[:graph][:query_root_url] + ApplicationController.fb_app[:graph][:query_subscribedto_suffix], {:access_token =>identity.authentication.token} )\n\t\telse\n\t\t\tgraph_url_string = nil;\n\t\t\talert_log(\"Invalid type: Cannot fetch facebook connections of type: \"+type)\t\t\t\n\t\t\tnot_found\n\t\tend\n\t\treturn fetch_facebook_list_data(graph_url_string)\n\tend",
"def registered_curation_concern_types\n @registered_concerns.map { |cc_type| normalize_concern_name(cc_type) }\n end",
"def update_mixins_in_coll(collection)\n return collection if collection.blank?\n return collection if collection.resources.blank? && collection.links.blank?\n\n model = OcciModel.get(backend_instance)\n collection.resources.to_a.each do |resource|\n next if resource.mixins.blank? && resource.links.blank?\n resource.mixins.to_a.each { |mxn| update_mixin_from_model(mxn, model) }\n\n resource.links.to_a.each do |link|\n next if link.mixins.blank?\n link.mixins.to_a.each { |lnk_mxn| update_mixin_from_model(lnk_mxn, model) }\n end\n end\n\n collection.links.to_a.each do |link|\n next if link.mixins.blank?\n link.mixins.to_a.each { |lnk_mxn| update_mixin_from_model(lnk_mxn, model) }\n end\n\n collection\n end",
"def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end",
"def get_os_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'os_tpl' }.any? }\n end",
"def filters(type)\n case type\n when :before\n namespaces = self.ancestors + [self]\n all_filters = namespaces.map(&:befores).flatten\n when :after\n namespaces = [self] + self.ancestors.reverse\n all_filters = namespaces.map(&:afters).flatten\n else\n raise 'Invalid filter type. Use :before or :after'\n end\n all_filters.select{|f| f[:opts][:all] || self.send(\"#{type}s\").include?(f) }\n end",
"def contexts(type_class)\n contexts = ['system/local'] # Always consider the default context\n catalog_resources = catalog.resources.select { |r| r.is_a?(type_class) }\n catalog_resources.each do |res|\n contexts << res[:context]\n end\n contexts.uniq\n end",
"def class_from_type(type)\n send(\"#{type}_class\") if respond_to?(\"#{type}_class\")\n end",
"def instance_loader(type)\n @autoloaders[type.intern]\n end",
"def update_mixin_from_model(mixin, model)\n return if mixin.blank?\n\n if mixin.kind_of? String\n # it's just an identifier\n model.get_by_id(mixin)\n elsif mixin.kind_of?(::Occi::Core::Mixin)\n # it's already a mix-in\n orig_mixin = model.get_by_id(mixin.type_identifier)\n if orig_mixin\n mixin.location = orig_mixin.location\n mixin.title = orig_mixin.title if mixin.title.blank?\n end\n\n mixin\n else\n # nothing we can do here\n nil\n end\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def path(type)\n registry[type] || []\n end",
"def count_sections(type = nil)\n if type\n sections.all.select { |section| section.type == type }.size\n else\n sections.size\n end\n end",
"def areas(type = nil)\n if type\n if areas = @areas[type]\n areas.values\n else\n []\n end\n else\n @areas.values.map(&:values).flatten\n end\n end",
"def by_type\n return @by_type if @by_type\n\n @by_type = {}\n self.all.each do |set|\n next unless set[:types].count > 0\n\n set[:types].each do |t|\n @by_type[t] ||= []\n @by_type[t] << set\n end\n end\n\n @by_type\n end",
"def mixins=(mixins)\n unless mixins\n raise Occi::Core::Errors::InstanceValidationError,\n 'Missing valid mixins'\n end\n\n @mixins = mixins\n reset_added_attributes!\n remove_undef_attributes\n # TODO: handle sync'ing actions\n\n mixins\n end",
"def glob_for(type) Merb.load_paths[type][1] end",
"def course_types\n @course_types ||= Course.where(department_id: self.department_id)\n .where(course_num: self.course_num)\n .where(term_id: self.search.term_id)\n .select(:type)\n .map(&:type)\n .uniq\n end",
"def category_types\n @category_types.each\n end",
"def list(mixins = nil)\n # TODO: impl filtering with mixins\n storage = ::Occi::Core::Resources.new\n backend_storage_pool = ::OpenNebula::ImagePool.new(@client)\n rc = backend_storage_pool.info_all\n check_retval(rc, Backends::Errors::ResourceRetrievalError)\n\n backend_storage_pool.each do |backend_storage|\n storage << parse_backend_obj(backend_storage)\n end\n\n storage\n end",
"def search_adaptors(type = 'all')\n @adaptors[type] ||= search_adaptor_files(type).collect do |file|\n file['adaptor_class_name'].constantize.new(file)\n end\n end",
"def get_related(type)\n (cyc.with_any_mt{|cyc| cyc.send(\"#{type}\", self.to_sym)}||[]).\n map{|s| wrap_symbol(s) }\n end",
"def matching_types(&matcher)\n yield(self) ? [self] : []\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def get_repositories_by_type(type, opts = {})\n data, _status_code, _headers = get_repositories_by_type_with_http_info(type, opts)\n data\n end",
"def first_class(type, klass)\n (plugins_map(type) || {})[string2class(klass)]\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def get_callbacks(callback_type)\n Array(options[callback_type])\n end",
"def find_command_with_utype (utype)\n array = Array.new()\n @commands.each do |command|\n if (command.utype == utype)\n array.push(command)\n end\n end\n return array\n end",
"def get_class type\n case type\n when Class\n type\n when BaseModel\n type.my_class\n when String, Symbol\n return get_class send(\"#{type}_model\") if [:subject, :object, :join].include?(type.to_sym)\n type.to_s.constantize\n else\n raise \"Can't determine a class from: #{type}\"\n end \n end",
"def fetch_homologues(type=nil) # default: all type of homologues, or else orthologues or paralogues (ortho, para) \n answer = self.homology_members.collect{|hm| hm.homology} \n answer = answer.select{|h| h.description.include?(\"#{type.downcase}\")} unless type.nil? # filter for a particular kind of homology \n return answer.collect{|h| h.homology_members.select{|hm| hm.member_id != self.id and hm.member.genome_db_id != self.genome_db_id }}.flatten.collect{|hm| hm.member } \n end",
"def all(type)\n type ||= ALLOWED_SUBTYPES.first\n unless ALLOWED_SUBTYPES.include?(type)\n raise Errors::BackendForbiddenError, 'Attempting to access forbidden backend subtype'\n end\n BackendProxy.send(\"backend_#{type}_subtypes\")\n end",
"def extensions\n TYPE_EXTS[type] || []\n end",
"def return_trains_by_type(type)\n (@trains_list.map { |a| a if a.type == type }).compact\n end",
"def get_mixin_data_for_org(mixin, org=nil)\n base = @yaml.organizations.first[1]\n get_mixin_data_for_level(base, mixin)\n end",
"def chain *enums\n return enum_for(:chain, *enums) unless block_given?\n [self, *enums].each do |enum|\n enum.each {|*args| yield(*args) }\n end\n nil\n end",
"def for_type( type )\n model_method_list.find_all { |mm| mm.operator_type? type }\n end",
"def get_response_of_type(type)\n type = type.split('_').map(&:capitalize).join\n\n loop do\n response = get_message\n return response if response.class.name.demodulize == type\n end\n end",
"def mechanisms(type)\n out = FFI::MemoryPointer.new :pointer\n result = Gsasl.send(\"gsasl_#{type}_mechlist\", @context, out)\n Gsasl.raise_error!(result)\n data = out.get_pointer(0)\n list = data.read_string.split(/\\s/)\n list\n ensure\n Gsasl.gsasl_free(data)\n end",
"def superclasses(access_type = nil)\n QueryResult.new(\n [\n NodeCache.find_children_of_type(self, \"Base\").select do |base|\n access_type.nil? ? true : base.send(\"#{access_type}?\")\n end\n ].flatten.map {|base| base.cpp_type }\n )\n end",
"def subclasses\n @subclasses ||= []\n end"
] | [
"0.6220817",
"0.6093635",
"0.5246576",
"0.5061629",
"0.50506806",
"0.5022578",
"0.49531978",
"0.49368724",
"0.481214",
"0.47991818",
"0.47848308",
"0.47665864",
"0.47330073",
"0.4672994",
"0.4659485",
"0.4655962",
"0.45904776",
"0.45505047",
"0.45398846",
"0.44896248",
"0.44867823",
"0.4477716",
"0.4464738",
"0.44580093",
"0.44477043",
"0.44333446",
"0.44322824",
"0.44252285",
"0.44232038",
"0.44203895",
"0.4390826",
"0.43149668",
"0.43076026",
"0.42963597",
"0.42878836",
"0.42844722",
"0.4266166",
"0.42544657",
"0.4219625",
"0.41884106",
"0.41674653",
"0.41606423",
"0.41600442",
"0.4148201",
"0.4146357",
"0.41436917",
"0.41325518",
"0.4127174",
"0.4120966",
"0.4113323",
"0.41085708",
"0.4106305",
"0.41060826",
"0.41013974",
"0.41002187",
"0.4091996",
"0.4091863",
"0.40876296",
"0.4087024",
"0.40821543",
"0.4069761",
"0.40644896",
"0.40637338",
"0.40574026",
"0.40566242",
"0.40553302",
"0.4054165",
"0.404431",
"0.40371138",
"0.40242574",
"0.40219852",
"0.40132773",
"0.40116632",
"0.40092847",
"0.40052697",
"0.4002184",
"0.39963537",
"0.39953294",
"0.39894834",
"0.3982901",
"0.3979023",
"0.3978063",
"0.39760402",
"0.397535",
"0.39689538",
"0.39524907",
"0.39471716",
"0.39416224",
"0.39340305",
"0.39310265",
"0.39270666",
"0.39227206",
"0.39167237",
"0.39159912",
"0.3915801",
"0.391474",
"0.39133626",
"0.39103013",
"0.39011922",
"0.38991475"
] | 0.8676375 | 0 |
Retrieves available mixin types. Mixin types are presented in a shortened format (i.e. not as type identifiers). | def get_mixin_types
@mixins.keys.map { |k| k.to_s }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mixins(type = nil)\n if type\n # is type valid?\n raise \"Unknown mixin type! #{type}\" unless @mixins.has_key? type.to_sym\n\n # return mixin of the selected type\n @mixins[type.to_sym]\n else\n # we did not get a type, return all mixins\n mixins = []\n\n # flatten the hash and remove its keys\n get_mixin_types.each do |ltype|\n mixins.concat @mixins[ltype.to_sym]\n end\n\n mixins\n end\n end",
"def get_mixin_type_identifiers\n identifiers = []\n\n get_mixin_types.each do |mixin_type|\n identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type\n end\n\n identifiers\n end",
"def find_mixin(name, type = nil, describe = false)\n\n Occi::Log.debug(\"Looking for mixin #{name} + #{type} + #{describe}\")\n\n # is type valid?\n if type\n raise \"Unknown mixin type! [#{type}]\" unless @mixins.has_key? type.to_sym\n end\n\n # TODO: extend this code to support multiple matches and regex filters\n # should we look for links or descriptions?\n if describe\n # we are looking for descriptions\n if type\n # get the first match from either os_tpls or resource_tpls\n case\n when type == \"os_tpl\"\n get_os_templates.select { |mixin| mixin.term == name }.first\n when type == \"resource_tpl\"\n get_resource_templates.select { |template| template.term == name }.first\n else\n nil\n end\n else\n # try in os_tpls first\n found = get_os_templates.select { |os| os.term == name }.first\n\n # then try in resource_tpls\n found = get_resource_templates.select {\n |template| template.term == name\n }.first unless found\n\n found\n end\n else\n # we are looking for links\n # prefix mixin name with '#' to simplify the search\n name = \"#\" + name\n if type\n # return the first match with the selected type\n @mixins[type.to_sym].select {\n |mixin| mixin.to_s.reverse.start_with? name.reverse\n }.first\n else\n # there is no type preference, return first global match\n @mixins.flatten(2).select {\n |mixin| mixin.to_s.reverse.start_with? name.reverse\n }.first\n end\n end\n end",
"def register_mixin(model_type, mixin)\n possible_models = {\n :devices => 'Optopus::Device',\n :events => 'Optopus::Event',\n :locations => 'Optopus::Location',\n :nodes => 'Optopus::Node',\n :roles => 'Optopus::Role',\n :users => 'Optopus::User',\n :networks => 'Optopus::Network',\n :addresses => 'Optopus::Address',\n }\n model = possible_models[model_type]\n raise \"invalid model type, valid types: #{possible_models.keys.join(', ')}\" if model.nil?\n Optopus::Models.register_mixin(model, mixin)\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def supertypes\n all_supertype_inheritance.map{|ti|\n ti.supertype\n }\n end",
"def registered_types\n end",
"def mixin_registry\n @mixin_registry ||= Hash.new {|h,k| h[k] = {}}\n end",
"def subtypes\n # REVISIT: There's no sorting here. Should there be?\n all_type_inheritance_as_supertype.map{|ti| ti.subtype }\n end",
"def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def get_os_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'os_tpl' }.any? }\n end",
"def mixin(namespace, type)\n Object.const_get \"#{namespace.name}::#{type}\"\n rescue NameError\n namespace.module_eval \"module #{type}; end\"\n namespace.const_get type\n end",
"def subscribed_types\n subscribable_types - unsubscribed_types\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def read_shared_mixins!(mixins_file)\n log_status \" Reading shared mixins from mixins.less\"\n @shared_mixins = get_mixin_names(mixins_file, silent: true)\n NESTED_MIXINS.each do |selector, prefix|\n # we use replace_rules without replacing anything just to use the parsing algorithm\n replace_rules(mixins_file, selector) { |rule|\n @shared_mixins += get_mixin_names(unindent(unwrap_rule_block(rule)), silent: true).map { |name| \"#{prefix}-#{name}\" }\n rule\n }\n end\n @shared_mixins.sort!\n log_file_info \"shared mixins: #{@shared_mixins * ', '}\"\n @shared_mixins\n end",
"def types\n types = ActiveRDF::Query.new(N::SourceClass).distinct(:t).where(self,N::RDF::type,:t).execute\n # Add the \"default\" types if necessary\n self.class.default_types.each do |def_type|\n types << def_type unless(types.include?(def_type))\n end\n \n # Make a property list for the types.\n PropertyList.new(N::RDF::type, types, self, source_exists?)\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end",
"def include_into(*klasses)\n klasses.flatten!\n klasses.each do |klass|\n (@@class_mixins[klass] ||= []) << self\n @@class_mixins[klass].uniq!\n end\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def type_names\n @type_names ||= @types.map { |clazz| clazz.name }\n end",
"def return_sub_types\n main_type = type_status\n if main_type\n return self.beer_subtypes.map{|type| {id: type.id, name: type.name}}\n else\n return types_for_subtype\n end\n end",
"def section_types\n type.children.select { |child| child.class == SectionType }\n end",
"def get_types_string(types_covered)\n types_string = \"\"\n types_covered.uniq.each {|type|\n types_string += \" #{type}\"\n }\n return types_string\n end",
"def types\n @types ||= []\n end",
"def mixin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = MIXIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 162:9: 'mixin'\n match( \"mixin\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end",
"def list(mixins = nil)\n if mixins.blank?\n read_storage_fixtures\n else\n filtered_storages = read_storage_fixtures.to_a.select { |s| (s.mixins & mixins).any? }\n ::Occi::Core::Resources.new filtered_storages\n end\n end",
"def category_types\n @category_types.each\n end",
"def add_mixins(item)\n item.instance_mixins.reverse_each do |i|\n @current_object.create_include(i.path.to_s)\n end\n\n # YARD 0.9.26 makes extends appear in the same order as code\n # (includes are still reversed)\n if Gem::Version.new(YARD::VERSION) >= Gem::Version.new(\"0.9.26\")\n item.class_mixins.each do |e|\n @current_object.create_extend(e.path.to_s)\n end\n else\n item.class_mixins.reverse_each do |e|\n @current_object.create_extend(e.path.to_s)\n end\n end\n\n item.instance_mixins.length + item.class_mixins.length\n end",
"def supported_hook_type_classes\n supported_hook_types.map do |file|\n file.split('-').map(&:capitalize).join\n end\n end",
"def media_types\n return @media_types\n end",
"def types\n self.singleton_class.const_get(:TYPES)\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def mixing_in( mixins, content )\n\n def clauses_mixins( mixins, content )\n clauses_to_delete = []\n clauses_to_mixin = []\n \n mixins.each do | mixin, replacer |\n replacer = replacer.to_s.downcase\n clauses_to_delete << mixin if replacer == \"false\"\n clauses_to_mixin << mixin if replacer == \"true\"\n end\n \n clauses_to_delete.each { |m| mixins.delete(m) }\n clauses_to_mixin.each { |m| mixins.delete(m) }\n\n until clauses_to_delete.size == 0\n clauses_to_delete.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /\\[{{(\\S+)}}/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_delete.include?($1)\n content = content.gsub( get_it_all, \"\" )\n clauses_to_delete.delete( mixin ) unless content[pattern]\n end\n end\n\n until clauses_to_mixin.size == 0\n clauses_to_mixin.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /(\\[{{\\S+}})/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_mixin.include?($1)\n content = content.gsub( get_it_all, sub_clause )\n clauses_to_mixin.delete( mixin ) unless content[pattern]\n end\n end\n\n return [content, mixins]\n end\n\n def normal_mixins( mixins, content )\n mixins.each do | mixin, replacer |\n unless mixin =~ /level-\\d/ or mixin =~ /no-reset/ or mixin =~ /no-indent/\n replacer = replacer.to_s\n safe_words = [ \"title\", \"author\", \"date\" ]\n pattern = /({{#{mixin}}})/\n if content =~ pattern\n content = content.gsub( $1, replacer )\n mixins.delete( mixin ) unless safe_words.any?{ |s| s.casecmp(mixin) == 0 }\n end\n end\n end\n return [content, mixins]\n end\n\n clauses_mixed = clauses_mixins( mixins, content )\n mixed = normal_mixins( clauses_mixed[1], clauses_mixed[0] )\n return [ mixed[0], mixed[1] ]\n end",
"def lookup_mixin(name)\n @mixins.fetch(name.to_s) { |k| @parent ? @parent.lookup_mixin(k) : nil }\n end",
"def musical_score_types\n types = []\n types << 'MS' if %w[c d].include?(record.leader[6])\n return types\n end",
"def mixin(object) \n mixin_name = split(object)\n \"@mixin #{mixin_name} {}\"\n end",
"def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end",
"def types\n configuration[:types]\n end",
"def audio_types\n ldr6 = record.leader[6]\n\n types = []\n\n # Get the 8524* fields\n f8524 = record.fields('852').select{|f| f.indicator1 == '4'}\n\n # RC\n if %w[i j].include?(ldr6) && (bib_format == 'MU') \n @record.fields('007').map{|f| f.value}.each do |f|\n if f[1] == 'd' && f[12] == 'e'\n types << 'RC'\n break\n end\n end\n end\n\n f8524.each do |f|\n if (f['b'].upcase == 'MUSIC') && (f['j'] =~ /\\ACD/i)\n types << 'RC'\n break\n end\n end\n\n # RL\n\n if (bib_format == 'MU') && %w[i j].include?(ldr6) && self['007[1]'].include?('d')\n record.fields('300').each do |f|\n str = f.subfields.collect {|s| s.value}.join(' ')\n if (str =~ /DISC/i) && str =~ /33 1\\/3 RPM/i\n types << 'RL'\n break\n end\n end\n end\n\n\n f8524.each do |f|\n if (f['j'] =~ /\\ALP/i) &&\n ((f['b'].upcase == 'MUSIC') || (f['c'].upcase == 'MUSI'))\n types << 'RL'\n break\n end\n end\n\n # RM\n types << 'RM' if (ldr6 == 'j') && (bib_format == 'MU')\n\n # RS\n types << 'RS' if (ldr6 == 'i') && (bib_format == 'MU')\n\n # RU\n types << 'RU' if %w[i j].include?(ldr6) && (bib_format == 'MU')\n\n types.uniq!\n return types\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def mixed_types\n types = []\n types << 'MV' if (bib_format == 'MX') || (record.leader[8] == 'a')\n types << 'MW' if %w[d f p t].include?(record.leader[6])\n return types\n end",
"def find_by_mixin(mixin)\n raise ArgumentError, 'Mixin is a mandatory argument' unless mixin\n Set.new(entities.select { |elm| elm.mixins.include?(mixin) })\n end",
"def type\n result = [self.ext]\n result += Types.constants.select { |c| Types.const_get(c).include?(self.ext) }.map {|c| c.downcase}\n returning(Querable.new(result)) { |q| q.list = result }\n end",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def default_mixin_lookup\n ModuleLookup.new.add_path(\"toys/standard_mixins\")\n end",
"def extensions\n TYPE_EXTS[type] || []\n end",
"def type\n @types ||= strip(:type)\n end",
"def item_types(refresh: false)\n cname = \"#{name}.item_types\"\n Rails.cache.delete(cname) if refresh\n\n Rails.cache.fetch(cname) do\n list = []\n implementation_classes.each do |imp_class|\n list += imp_class.attribute_names\n .select { |a| Classification::GeneralSelection.use_with_attribute?(a) }\n .map do |a|\n mn = imp_class.model_name.to_s.ns_underscore\n mn = mn.pluralize unless imp_class.respond_to?(:is_activity_log)\n \"#{mn}_#{a}\".to_sym\n end\n end\n\n list\n end\n end",
"def human_types\n types.map { |type| Core::TYPES_DESC[type] }\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def resolve_standard_mixin(name)\n @mixin_lookup.lookup(name)\n end",
"def microform_types\n return [] unless record['008']\n types = ['WM']\n f8_23 = record['008'].value[23]\n return types if %w[BK MU SE MX].include?(bib_format) && %w[a b c].include?(f8_23)\n\n f8_29 = record['008'].value[29]\n return types if %w[MP VM].include?(bib_format) && %w[a b c].include?(f8_29)\n\n return types if record['245'] && (record['245']['h'] =~ /micro/i)\n\n # Nope. Not microform\n return []\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def mixins(*scopes); end",
"def get_types(type)\n result = []\n types = TYPE_CONVERSION_TREE[type]\n if types\n result += types\n types.each do |t|\n result |= get_types(t)\n end\n end\n result\n end",
"def get_all_types\n types = Hash.new()\n @packages.each do |key, value|\n types[key] = value.stringpool_typestrings.values\n end\n\n return types\n end",
"def needed_types\n self.scan unless @needed_types\n @needed_types\n end",
"def update_mixin_from_model(mixin, model)\n return if mixin.blank?\n\n if mixin.kind_of? String\n # it's just an identifier\n model.get_by_id(mixin)\n elsif mixin.kind_of?(::Occi::Core::Mixin)\n # it's already a mix-in\n orig_mixin = model.get_by_id(mixin.type_identifier)\n if orig_mixin\n mixin.location = orig_mixin.location\n mixin.title = orig_mixin.title if mixin.title.blank?\n end\n\n mixin\n else\n # nothing we can do here\n nil\n end\n end",
"def mixin?\n !!@options[:mixin]\n end",
"def supported_hook_type_classes; end",
"def types(types); end",
"def scoped_medium_types\n [primary_media.prepend('primary'), secondary_media.prepend('secondary'), component_media.prepend('component')]\n end",
"def get_classes( obj )\n cls = obj.class\n print cls.to_s\n while cls.superclass != nil\n cls = cls.superclass\n print ' < ' + cls.to_s\n end\nend",
"def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend",
"def flume_plugin_classes\n flume_collect_property( :classes )\n end",
"def object_types\n feature_object_types.collect(&:category).select{|c| c}\n end",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def types\n @callers.keys\n end",
"def get_available_template_types\n\t\tskin = @params['from']\n\t\tskin_dir = File.join(THEMES, skin)\n\t\toptions = []\n\t\tif File.exists? File.join(skin_dir, \"templates\", \"skin.liquid\")\n\t\t\toptions << create_checkbox(\"functions\", \"rooms\", \"Rooms\", \"validate-one-required\")\n\t\tend\n\t\tif File.exists? File.join(skin_dir, \"templates\", \"tickets\")\n\t\t\toptions << create_checkbox(\"functions\", \"events\", \"Events\", \"validate-one-required\")\n\t\tend\n\t\tif File.exists? File.join(skin_dir, \"templates\", \"vouchers\")\n\t\t options << create_checkbox(\"functions\", \"vouchers\", \"Vouchers\", \"validate-one-required\")\n\t\tend\n\t\toptions = options.join(\"<br />\")\n\t\trender :text => options\n\tend",
"def load_shared\n @shared_mixins ||= begin\n log_status ' Reading shared mixins from mixins.less'\n read_mixins read_files('less', ['mixins.less'])['mixins.less'], nested: NESTED_MIXINS\n end\n end",
"def load_types\n ObjectSpace.enum_for(:each_object, class << NotificationSystem::Notification; self; end).to_a - [NotificationSystem::Notification]\n end",
"def mixins_js\n Dir[src_path.join('mixins', '**', '*.js').to_s]\n end",
"def add_mixin(model)\n raise InvalidMixin.new(\"#{model.name} already mixed in to this model\") if mixins.include?(model)\n raise InvalidMixin.new(\"Mixin cannot be a parent\") if ancestors.include?(model)\n \n # for all intents and purposes, by mixing in a model, we are a subtype of that model\n model.add_descendant(self)\n mixins << model\n save\n end",
"def parents_and_mixins\n models = parent.try(:parents_and_mixins) || []\n mixins.each do |mixin_model|\n models |= mixin_model.parents_and_mixins\n end\n models << self\n end",
"def types\n Enumerator.new do |y|\n @types.each do |name, shape_class|\n y.yield(name, shape_class)\n end\n end\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def get_applicable_plugins(type)\n PluginManager.get_plugins_by('items', type)\n end",
"def extract_bands_type\n output_message = extract_raster_info(filepath)\n matches = output_message.scan(/band \\d* .* type=(\\w*)/i)\n raise TiffToSqlConversionError.new(\"Error obtaining band field type: #{output_message}\") if matches.empty?\n\n matches.flatten\n end",
"def extract_bands_type\n output_message = extract_raster_info(filepath)\n matches = output_message.scan(/band \\d* .* type=(\\w*)/i)\n raise TiffToSqlConversionError.new(\"Error obtaining band field type: #{output_message}\") if matches.empty?\n\n matches.flatten\n end",
"def unit_types\n [\"Subject\", \"Fragment\", \"Chapter\", \"Lesson\", \"Lab\"]\n end",
"def available_formats\n formats = self.items.collect {|i| i.item_type }\n return formats.compact\n end",
"def possible_types(type)\n if type.kind.interface?\n schema.possible_types(type)\n elsif type.kind.union?\n type.possible_types\n end\n end",
"def super_mixins\n ancestors.select { |o| o <= Core && o.initialized? }\n end",
"def service_types\n get_info :service_types\n end",
"def extension_prefix\n mixin? ? '@mixin ' : '%'\n end",
"def subclasses; end",
"def subclasses; end",
"def all_subtype\n all_type_inheritance_as_supertype.map(&:subtype)\n end",
"def subclasses\n if block_given?\n ::Class.all do |c|\n yield c if c < self\n end\n else\n enum_for :subclasses\n end\n end",
"def content_types(meta=false)\n content_type_classes(meta).map { |cls| cls.key }\n end",
"def defined_types\n @title = 'Defined Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_defined_type)\n erb(:objects)\nend",
"def get_message_types; end",
"def get_message_types; end",
"def types\n @types ||= Types.new(@client)\n end",
"def booking_cuisine_types_get(opts = {})\n data, _status_code, _headers = booking_cuisine_types_get_with_http_info(opts)\n data\n end"
] | [
"0.71516925",
"0.66711587",
"0.56752825",
"0.5498893",
"0.5451157",
"0.5315886",
"0.5297385",
"0.5184562",
"0.51687837",
"0.5104759",
"0.5085771",
"0.50241375",
"0.49645305",
"0.4962468",
"0.49435604",
"0.49228716",
"0.4891364",
"0.48911783",
"0.4879527",
"0.48722428",
"0.48622376",
"0.48621795",
"0.48597187",
"0.48573408",
"0.4854688",
"0.4842994",
"0.48241988",
"0.47879073",
"0.47738013",
"0.47677168",
"0.47670764",
"0.47638312",
"0.47638088",
"0.47571608",
"0.47555602",
"0.474625",
"0.4744109",
"0.47422636",
"0.47087982",
"0.47043717",
"0.46824554",
"0.46771747",
"0.46734026",
"0.4669013",
"0.46679175",
"0.4667234",
"0.46534643",
"0.46483302",
"0.46376082",
"0.4632589",
"0.46310624",
"0.46281752",
"0.46199045",
"0.46116337",
"0.46032152",
"0.45993984",
"0.45936725",
"0.45847356",
"0.45845267",
"0.45487005",
"0.4547972",
"0.4538621",
"0.45322886",
"0.4530774",
"0.4529488",
"0.4529143",
"0.4527067",
"0.45216382",
"0.45173427",
"0.4510959",
"0.45064792",
"0.448858",
"0.44778213",
"0.4472712",
"0.4456932",
"0.44484693",
"0.4428819",
"0.44285944",
"0.44184583",
"0.4409014",
"0.43933877",
"0.43900824",
"0.43692118",
"0.43692118",
"0.4367637",
"0.43614066",
"0.43610248",
"0.43610054",
"0.43607116",
"0.43528202",
"0.4350796",
"0.4350796",
"0.43480954",
"0.43473244",
"0.43399742",
"0.43356124",
"0.43330544",
"0.43330544",
"0.43307394",
"0.43292457"
] | 0.8134472 | 0 |
Retrieves available mixin type identifiers. | def get_mixin_type_identifiers
identifiers = []
get_mixin_types.each do |mixin_type|
identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type
end
identifiers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mixin_types\n @mixins.keys.map { |k| k.to_s }\n end",
"def get_mixins(type = nil)\n if type\n # is type valid?\n raise \"Unknown mixin type! #{type}\" unless @mixins.has_key? type.to_sym\n\n # return mixin of the selected type\n @mixins[type.to_sym]\n else\n # we did not get a type, return all mixins\n mixins = []\n\n # flatten the hash and remove its keys\n get_mixin_types.each do |ltype|\n mixins.concat @mixins[ltype.to_sym]\n end\n\n mixins\n end\n end",
"def mixin_registry\n @mixin_registry ||= Hash.new {|h,k| h[k] = {}}\n end",
"def registered_types\n end",
"def id_types\n identifiers.map(&:type).uniq\n end",
"def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end",
"def get_trait_names(headers)\n recognized_trait_names = TraitCovariateAssociations.all.collect { |tca| tca.variable.name }\n end",
"def register_mixin(model_type, mixin)\n possible_models = {\n :devices => 'Optopus::Device',\n :events => 'Optopus::Event',\n :locations => 'Optopus::Location',\n :nodes => 'Optopus::Node',\n :roles => 'Optopus::Role',\n :users => 'Optopus::User',\n :networks => 'Optopus::Network',\n :addresses => 'Optopus::Address',\n }\n model = possible_models[model_type]\n raise \"invalid model type, valid types: #{possible_models.keys.join(', ')}\" if model.nil?\n Optopus::Models.register_mixin(model, mixin)\n end",
"def ids\n interfaces_hash.keys\n end",
"def id_mapping_types\n @id_mapping_types ||= extract_classes_with_true(:track_imported_ids, configuration)\n end",
"def subscribed_types\n subscribable_types - unsubscribed_types\n end",
"def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end",
"def find_by_mixin(mixin)\n raise ArgumentError, 'Mixin is a mandatory argument' unless mixin\n Set.new(entities.select { |elm| elm.mixins.include?(mixin) })\n end",
"def find_mixin(name, type = nil, describe = false)\n\n Occi::Log.debug(\"Looking for mixin #{name} + #{type} + #{describe}\")\n\n # is type valid?\n if type\n raise \"Unknown mixin type! [#{type}]\" unless @mixins.has_key? type.to_sym\n end\n\n # TODO: extend this code to support multiple matches and regex filters\n # should we look for links or descriptions?\n if describe\n # we are looking for descriptions\n if type\n # get the first match from either os_tpls or resource_tpls\n case\n when type == \"os_tpl\"\n get_os_templates.select { |mixin| mixin.term == name }.first\n when type == \"resource_tpl\"\n get_resource_templates.select { |template| template.term == name }.first\n else\n nil\n end\n else\n # try in os_tpls first\n found = get_os_templates.select { |os| os.term == name }.first\n\n # then try in resource_tpls\n found = get_resource_templates.select {\n |template| template.term == name\n }.first unless found\n\n found\n end\n else\n # we are looking for links\n # prefix mixin name with '#' to simplify the search\n name = \"#\" + name\n if type\n # return the first match with the selected type\n @mixins[type.to_sym].select {\n |mixin| mixin.to_s.reverse.start_with? name.reverse\n }.first\n else\n # there is no type preference, return first global match\n @mixins.flatten(2).select {\n |mixin| mixin.to_s.reverse.start_with? name.reverse\n }.first\n end\n end\n end",
"def supertypes\n all_supertype_inheritance.map{|ti|\n ti.supertype\n }\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def types\n @callers.keys\n end",
"def type_names\n @type_names ||= @types.map { |clazz| clazz.name }\n end",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def identifiers\n return [] if __getobj__.blank?\n\n __getobj__.identifier if __getobj__.respond_to?(:identifier)\n end",
"def mixin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = MIXIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 162:9: 'mixin'\n match( \"mixin\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end",
"def section_types\n type.children.select { |child| child.class == SectionType }\n end",
"def subtypes\n # REVISIT: There's no sorting here. Should there be?\n all_type_inheritance_as_supertype.map{|ti| ti.subtype }\n end",
"def mixins(*scopes); end",
"def category_types\n @category_types.each\n end",
"def ids\n @@enums_by_id.keys\n end",
"def get_os_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'os_tpl' }.any? }\n end",
"def include_into(*klasses)\n klasses.flatten!\n klasses.each do |klass|\n (@@class_mixins[klass] ||= []) << self\n @@class_mixins[klass].uniq!\n end\n end",
"def types\n @types ||= []\n end",
"def media_types\n return @media_types\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end",
"def lookup_mixin(name)\n @mixins.fetch(name.to_s) { |k| @parent ? @parent.lookup_mixin(k) : nil }\n end",
"def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end",
"def read_shared_mixins!(mixins_file)\n log_status \" Reading shared mixins from mixins.less\"\n @shared_mixins = get_mixin_names(mixins_file, silent: true)\n NESTED_MIXINS.each do |selector, prefix|\n # we use replace_rules without replacing anything just to use the parsing algorithm\n replace_rules(mixins_file, selector) { |rule|\n @shared_mixins += get_mixin_names(unindent(unwrap_rule_block(rule)), silent: true).map { |name| \"#{prefix}-#{name}\" }\n rule\n }\n end\n @shared_mixins.sort!\n log_file_info \"shared mixins: #{@shared_mixins * ', '}\"\n @shared_mixins\n end",
"def types\n self.singleton_class.const_get(:TYPES)\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def type_id\n\t\ttypes_id = [self.type1, self.type2]\n\t\treturn types_id\n\tend",
"def get_link_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Link.kind.type_identifier\n end",
"def return_sub_types\n main_type = type_status\n if main_type\n return self.beer_subtypes.map{|type| {id: type.id, name: type.name}}\n else\n return types_for_subtype\n end\n end",
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_link_type_identifiers\n get_entity_types_related_to Occi::Core::Link.kind.type_identifier\n end",
"def list_ids type\n balise = (type == :qd) ? \"QD\" : \"RD\"\n Snippet::input.scan(/#{balise}\\#([0-9]+)\\:/).to_a.collect do |found|\n found[0]\n end\n end",
"def member_types; MEMBER_TYPES.select { |type| send \"number_of_#{type}?\" }; end",
"def extensions\n TYPE_EXTS[type] || []\n end",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def types\n types = ActiveRDF::Query.new(N::SourceClass).distinct(:t).where(self,N::RDF::type,:t).execute\n # Add the \"default\" types if necessary\n self.class.default_types.each do |def_type|\n types << def_type unless(types.include?(def_type))\n end\n \n # Make a property list for the types.\n PropertyList.new(N::RDF::type, types, self, source_exists?)\n end",
"def super_mixins\n ancestors.select { |o| o <= Core && o.initialized? }\n end",
"def index\n @identifier_types = IdentifierType.all\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def load_types\n ObjectSpace.enum_for(:each_object, class << NotificationSystem::Notification; self; end).to_a - [NotificationSystem::Notification]\n end",
"def mixin(namespace, type)\n Object.const_get \"#{namespace.name}::#{type}\"\n rescue NameError\n namespace.module_eval \"module #{type}; end\"\n namespace.const_get type\n end",
"def asset_type_ids\n assets.scope.uniq.pluck(:asset_type_id)\n end",
"def parents_and_mixins\n models = parent.try(:parents_and_mixins) || []\n mixins.each do |mixin_model|\n models |= mixin_model.parents_and_mixins\n end\n models << self\n end",
"def get_action_type_identifiers\n @model.actions.to_a.collect { |action| action.type_identifier }\n end",
"def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend",
"def mixin(object) \n mixin_name = split(object)\n \"@mixin #{mixin_name} {}\"\n end",
"def resolve_standard_mixin(name)\n @mixin_lookup.lookup(name)\n end",
"def types\n @@types ||= Hash.new\n end",
"def extension_prefix\n mixin? ? '@mixin ' : '%'\n end",
"def supported_hook_type_classes\n supported_hook_types.map do |file|\n file.split('-').map(&:capitalize).join\n end\n end",
"def supported_hook_type_classes; end",
"def get_message_types; end",
"def get_message_types; end",
"def default_mixin_lookup\n ModuleLookup.new.add_path(\"toys/standard_mixins\")\n end",
"def free_type_ids\n @type.var_ids - @ids\n end",
"def loaded_instances(type)\n @instances[type].keys\n end",
"def flume_plugin_classes\n flume_collect_property( :classes )\n end",
"def ingested_ids\n ingested_ids_by_type.flatten\n end",
"def ingested_ids\n ingested_ids_by_type.flatten\n end",
"def count\n defined_types.size\n end",
"def get_line_types\n @lines.line_types\n end",
"def available_includes\n []\n end",
"def unit_idlers\n world.units.active.find_all { |u|\n unit_isidler(u)\n }\n end",
"def types\n @data.keys & TYPES\n end",
"def identifiers(ident, prefix='')\n identify(ident).map{|sym| \"#{prefix}#{sym}\"}\n end",
"def identifiers; end",
"def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end",
"def musical_score_types\n types = []\n types << 'MS' if %w[c d].include?(record.leader[6])\n return types\n end",
"def add_mixins(item)\n item.instance_mixins.reverse_each do |i|\n @current_object.create_include(i.path.to_s)\n end\n\n # YARD 0.9.26 makes extends appear in the same order as code\n # (includes are still reversed)\n if Gem::Version.new(YARD::VERSION) >= Gem::Version.new(\"0.9.26\")\n item.class_mixins.each do |e|\n @current_object.create_extend(e.path.to_s)\n end\n else\n item.class_mixins.reverse_each do |e|\n @current_object.create_extend(e.path.to_s)\n end\n end\n\n item.instance_mixins.length + item.class_mixins.length\n end",
"def collection_protocols\n collection_registrations.map { |reg| reg.protocol }.uniq\n end",
"def setups\n @setups ||= @types.map { |type| Setup.for(type) }\n end",
"def types(types); end",
"def needed_types\n self.scan unless @needed_types\n @needed_types\n end",
"def show\n @h_identifier_types = {}\n IdentifierType.all.map{|it| @h_identifier_types[it.id] = it}\n end",
"def registered_curation_concern_types\n @registered_concerns.map { |cc_type| normalize_concern_name(cc_type) }\n end",
"def available_plugins\n @plugins.keys\n end",
"def property_names\n trait[:PROPERTIES].keys\n end",
"def object_types\n feature_object_types.collect(&:category).select{|c| c}\n end",
"def valid_mixin_parent?(term)\n MIXIN_PARENTS.include? term\n end",
"def gender_types\n @gender_types.each\n end",
"def available_plugins(type: :export)\n type = valid_type(type)\n plugins[type].keys.sort\n end",
"def get_applicable_plugins(type)\n PluginManager.get_plugins_by('items', type)\n end",
"def available_types\n @bridge.available_log_types\n end",
"def get_prefixes\n find_all{|entry| entry.type==Morpheme::PREFIX}\n end",
"def list\n interceptors_mutex do\n @registry.map { |h| h[:klass] }\n end\n end",
"def list_known_classes\n end",
"def list\n @processors.keys\n end",
"def interactable_units\n Units.constants.select do |klass|\n Units.const_get(klass).included_modules.include?(Interactable)\n end\nend"
] | [
"0.80996203",
"0.66814935",
"0.5944612",
"0.5617854",
"0.56126696",
"0.528932",
"0.52736497",
"0.5213063",
"0.5212991",
"0.52109706",
"0.5203591",
"0.5188573",
"0.51802635",
"0.5156073",
"0.5111223",
"0.50855166",
"0.5084374",
"0.505663",
"0.49910834",
"0.49840686",
"0.49743268",
"0.49703592",
"0.49522027",
"0.49375868",
"0.4912616",
"0.4852518",
"0.48453617",
"0.4843041",
"0.48343635",
"0.48302698",
"0.48200727",
"0.48072323",
"0.4800757",
"0.47892925",
"0.47860867",
"0.47794694",
"0.47651976",
"0.4748461",
"0.47341913",
"0.4732892",
"0.47195813",
"0.4711762",
"0.4708091",
"0.47038496",
"0.47029743",
"0.46873087",
"0.46863368",
"0.46853685",
"0.4682828",
"0.46794197",
"0.46561494",
"0.46551895",
"0.46462288",
"0.46301338",
"0.46266395",
"0.46209794",
"0.46192235",
"0.4605049",
"0.46040353",
"0.46022996",
"0.45966676",
"0.45945728",
"0.45765278",
"0.45747226",
"0.45747226",
"0.45719075",
"0.45696026",
"0.45652363",
"0.4557686",
"0.4548647",
"0.4548647",
"0.45461878",
"0.45408878",
"0.454039",
"0.45384836",
"0.45372376",
"0.4527063",
"0.45269915",
"0.45246866",
"0.45208606",
"0.45145282",
"0.45112297",
"0.45107162",
"0.4500087",
"0.44987214",
"0.4497251",
"0.4496678",
"0.44950774",
"0.44859737",
"0.44841743",
"0.44826946",
"0.4478162",
"0.4475999",
"0.44753426",
"0.4469018",
"0.44679123",
"0.4467299",
"0.446557",
"0.4463751",
"0.4458294"
] | 0.7986701 | 1 |
Retrieves available resources represented by resource locations (URIs). If no type identifier is specified, all available resource are listed. Type identifier can be specified in its shortened format (e.g. "compute", "storage", "network"). | def list(resource_type_identifier=nil)
if resource_type_identifier
# convert type to type identifier
resource_type_identifier = @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.first.type_identifier if @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.any?
# check some basic pre-conditions
raise "Endpoint is not connected!" unless @connected
raise "Unkown resource type identifier! [#{resource_type_identifier}]" unless @model.get_by_id resource_type_identifier
# split the type identifier and get the most important part
uri_part = resource_type_identifier.split('#').last
# request uri-list from the server
path = uri_part + '/'
else
path = '/'
end
headers = self.class.headers.clone
headers['Accept'] = 'text/uri-list'
# TODO: remove the gsub OCCI-OS hack
response = self.class.get(
@endpoint + path,
:headers => headers
).body.gsub(/\# uri:\/(compute|storage|network)\/[\n]?/, '').split("\n").compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def get_linked_resources(resource_type, filters = {})\n Util.convert_to_clever_object Clever.request(:get, get_uri(resource_type), filters)[:data]\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"find_resources: descr: '#{resource_descr.inspect}'\"\n if resource_descr.kind_of? Hash\n can_handle = eval(\"OMF::SFA::Model::#{resource_type.classify}\").respond_to? :handle_rest_get_resource\n if can_handle\n cls = eval(\"OMF::SFA::Model::#{resource_type.classify}\")\n resources = cls.handle_rest_get_resource(resource_descr)\n else\n resources = eval(\"OMF::SFA::Model::#{resource_type.classify}\").where(resource_descr)\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n\n # raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil? || resources.empty?\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil?\n\n resources.map do |r|\n begin\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(r)\n r\n rescue InsufficientPrivilegesException\n nil\n end\n end.compact\n end",
"def resources(oneview_type = nil, oneview_name = nil)\n oneview_type = @options[:oneview_type] if oneview_type.nil?\n oneview_name = @options[:oneview_name] if oneview_name.nil?\n raise 'Oneview resource type must be specified.' if oneview_type.nil?\n\n # Determine the endpoint that needs to be called\n endpoint = format('/rest/%s', oneview_type)\n\n # Find the resources\n response = oneview_client.rest_get(endpoint)\n resources = oneview_client.response_handler(response)\n\n return resources if oneview_name.nil?\n\n # Filter the resources by the name if it has been specified\n resources['members'].select { |r| r['name'] == oneview_name }\n end",
"def find_resources(&block)\n found = Varnisher::Urls.new\n\n self.class.resources.each do |resource|\n found += find_resource(resource, &block)\n end\n\n Varnisher.log.debug ''\n Varnisher.log.info \"#{found.length} total resources found.\\n\"\n\n found\n end",
"def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end",
"def run_uri_list(type)\n expansion_list = Array.new\n case type\n when 'CFR'\n predicate = '<http://liicornell.org/liischolar/refCFR>'\n when 'USC'\n predicate = '<http://liicornell.org/liischolar/refUSCode>'\n when 'SCOTUS'\n predicate = '<http://liicornell.org/liischolar/refSCOTUS>'\n end\n # query\n result = @sparql.query(\"SELECT DISTINCT ?o WHERE {?s #{predicate} ?o .}\")\n result.each do |item|\n o = item[:o].to_s\n # cleanup of bad USC URIs from Citationer\n o.gsub!(/_USC_A\\._/, '_USC_')\n\n # get the JSON\n do_item(o, o, type)\n\n #if it's a CFR part or subpart reference, stick it in the list for expansion\n expansion_list.push(o) if type == 'CFR' && o =~ /_(subpart|part)_/\n end\n\n #run actual URI list\n # now run the list of \"expandable\" URIs\n expansion_list.each do |o|\n q = \"SELECT DISTINCT ?s WHERE { ?s <http://liicornell.org/liicfr/belongsToTransitive> <#{o}> . }\"\n result = @cfrsparql.query(q)\n result.each do |item|\n do_item(item[:s].to_s, o, type)\n end\n\n end\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def resources(type, path)\n Resources.new(self, path, type)\n end",
"def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def indexable_resources\n return to_enum(:indexable_resources) { size } unless block_given?\n\n resources.each do |resource|\n yield resource\n\n next unless resource.exists?\n\n resource.items.each do |r|\n yield Purl.new(r.druid)\n end\n end\n end",
"def find_resources options\n\n # return [] unless resource_class.ancestors.include? ActiveRecord::Base\n params[:ids] ||= []\n params[:ids] << params[:id] unless params[:id].nil?\n\n if params[:ids].compact.any?\n policy_scope(resource_class).where(id: params[:ids].compact.split(\",\").flatten)\n else\n # search\n r = _search options\n\n # filter\n r = _filter r, options\n\n # sort\n r = _sort r, options\n\n # paginate\n r = _paginate r\n\n # (params[:format].nil? or params[:format]=='html') ? r.page(params[:page]).per(params[:perpage]) : r\n end\n end",
"def resources\n @resources ||= if options[:resources]\n options[:resources]\n elsif options[:search]\n if options[:search].is_a?(String)\n options[:search] = Rack::Utils.parse_nested_query(options[:search])\n end\n\n model.ransack(options[:search]).result\n else\n model.all\n end\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def type\n Resource::ALL\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n # binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end",
"def resources(*args)\n run_context.resource_collection.find(*args)\n end",
"def describe(resource_type_identifier=nil)\n\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n\n descriptions = []\n\n if resource_type_identifier.nil?\n descriptions << get('/')\n elsif @model.get_by_id resource_type_identifier\n # we got type identifier\n # get all available resources of this type\n locations = list resource_type_identifier\n\n # make the requests\n locations.each do |location|\n descriptions << get(sanitize_resource_link(location))\n end\n elsif resource_type_identifier.start_with?(@endpoint) || resource_type_identifier.start_with?('/')\n # we got resource link\n # make the request\n descriptions << get(sanitize_resource_link(resource_type_identifier))\n else\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\"\n end\n\n descriptions\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def lookup_resource(type, name, run_context)\n begin\n run_context.resource_collection.find(\"#{ type }[#{ name }]\")\n rescue ArgumentError => e\n puts \"You provided invalid arugments to resource_collection.find: #{ e }\"\n rescue RuntimeError => e\n puts \"The resources you searched for were not found: #{ e }\"\n end\n end",
"def all\n describe(resource_uri)\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end",
"def resources\n @resources ||= begin\n resources = request_path.strip.\n split('/').\n compact.\n map(&:strip).\n each_with_index.\n select { |_, index| index % 2 == 1 }.\n map { |a, _| a.to_sym }\n\n *rest, tail = *resources\n if RAILS_METHODS.index(tail)\n rest\n else\n resources\n end\n end\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def scrape_resources(opts = {})\n BBLib::HashStruct.new.tap do |hash|\n resources.each do |resource|\n hash[resource.name] = resource.retrieve(opts)\n end\n end\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end",
"def filter_resources(resources, opts)\n if opts[:type] && opts[:name]\n resources.select { |r| r.type == opts[:type] && r.name == opts[:name] }\n elsif opts[:type]\n resources.select { |r| r.type == opts[:type] }\n elsif opts[:name]\n resources.select { |r| r.name == opts[:name] }\n else\n resources\n end\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def get_info(params)\n debug 'Admin ListResources: Options: ', params.inspect\n category = params[:type]\n descr = params[:description]\n descr, find_with_array_hash = find_doctor(descr)\n\n if category # if applied specific resource type\n debug \"descr = \" + descr.inspect\n resources = @am_manager.find_all_samant_resources(category, descr)\n elsif urns = params[:urns] # if applied for certain urns\n resources = @am_manager.find_all_samant_resources(nil, descr)\n resources.delete_if {|c| !urns.include?(c.to_uri.to_s)}\n end\n resources.delete_if {|c| c.to_uri.to_s.include?\"/leased\"} unless resources.nil?\n unless find_with_array_hash.empty?\n resources.delete_if {|c| !find_with_array_hash.values[0].include? eval(\"c.#{find_with_array_hash.keys[0]}\")} unless resources.nil?\n end\n resources\n end",
"def get_uri(resource_type)\n refresh\n links.find { |link| link[:rel] == resource_type }[:uri]\n end",
"def resources\n @resources ||= []\n end",
"def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end",
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"central find_all_resources: descr: '#{resource_descr.inspect}' resource_type: #{resource_type}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def find_all_resources options\n policy_scope(resource_class)\n end",
"def resources(resource_uri = nil)\n load unless loaded?\n if resource_uri.nil?\n @resources.values\n else\n @resources[resource_uri]\n end\n end",
"def find_resources(ast, options = {})\n options = {:type => :any}.merge!(options)\n return [] unless ast.respond_to?(:xpath)\n scope_type = ''\n scope_type = \"[@value='#{options[:type]}']\" unless options[:type] == :any\n # XXX: include nested resources (provider actions)\n no_actions = \"[command/ident/@value != 'action']\"\n ast.xpath(\"//method_add_block[command/ident#{scope_type}]#{no_actions}\")\n end",
"def get_resources(authorization, \n user_id = nil, \n page = 1, \n per_page = 10)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/resources'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'user_id' => user_id,\n 'page' => page,\n 'per_page' => per_page\n }, array_serialization: Configuration.array_serialization\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetResourcesResponse.from_hash(decoded)\n end",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def show_resources_in_namespace(namespace, *resource_types)\n run \"kubectl get #{resource_types.join(',')} --namespace #{namespace} --output=wide\"\nend",
"def get_resources(opts = {})\n data, _status_code, _headers = get_resources_with_http_info(opts)\n data\n end",
"def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end",
"def get_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.get_resources ...'\n end\n # resource path\n local_var_path = '/v1/resources'\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/links+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 = opts[:return_type] || 'InlineResponse2004' \n\n auth_names = opts[:auth_names] || ['oauth2']\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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcePermissionsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def instances(return_type)\n return nil unless(active_rdf? && is_iri?)\n qry = ActiveRDF::Query.new(URI).distinct.select(:s)\n qry.where(:s, RDF.type, self)\n qry.execute\n end",
"def collect\n resources = []\n\n time = Puppet::Util.thinmark do\n t = @type\n q = @cquery\n\n resources = scope.compiler.resources.find_all do |resource|\n resource.type == t && resource.exported? && (q.nil? || q.call(resource))\n end\n\n found = Puppet::Resource.indirection.\n search(@type, :host => @scope.compiler.node.name, :filter => @equery, :scope => @scope)\n\n found_resources = found.map {|x| x.is_a?(Puppet::Parser::Resource) ? x : x.to_resource(@scope)}\n\n found_resources.each do |item|\n existing = @scope.findresource(item.resource_type, item.title)\n if existing\n unless existing.collector_id == item.collector_id\n raise Puppet::ParseError,\n _(\"A duplicate resource was found while collecting exported resources, with the type and title %{title}\") % { title: item.ref }\n end\n else\n item.exported = false\n @scope.compiler.add_resource(@scope, item)\n resources << item\n end\n end\n end\n\n scope.debug(\"Collected %s %s resource%s in %.2f seconds\" %\n [resources.length, @type, resources.length == 1 ? \"\" : \"s\", time])\n\n resources\n end",
"def generic_resource( unit )\n resources unit, concerns: [:search_suggestion, :uniqueness_validation, :retrieve_resource]\n end",
"def resources\n body && [*body]\n end",
"def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\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<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_auth']\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: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end",
"def [](*args)\n resources[*args]\n end",
"def resources\n @resources.values\n end",
"def list_resources(options)\n #debug \"options = \" + options.inspect\n body, format = parse_body(options)\n params = body[:options]\n #debug \"Body & Format = \", opts.inspect + \", \" + format.inspect\n\n debug 'ListResources: Options: ', params.inspect\n\n only_available = params[:only_available]\n slice_urn = params[:slice_urn]\n\n authorizer = options[:req].session[:authorizer]\n # debug \"!!!authorizer = \" + authorizer.inspect\n\n debug \"!!!USER = \" + authorizer.user.inspect\n debug \"!!!ACCOUNT = \" + authorizer.account.inspect\n # debug \"!!!ACCOUNT_URN = \" + authorizer.account[:urn]\n # debug \"!!!ACCOUNT = \" + authorizer.user.accounts.first.inspect\n\n if slice_urn\n @return_struct[:code][:geni_code] = 4 # Bad Version\n @return_struct[:output] = \"Geni version 3 no longer supports arguement 'geni_slice_urn' for list resources method, please use describe instead.\"\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n else\n resources = @am_manager.find_all_samant_leases(nil, $acceptable_lease_states, authorizer)\n comps = @am_manager.find_all_samant_components_for_account(nil, authorizer)\n # child nodes should not be included in listresources\n comps.delete_if {|c| ((c.nil?)||(c.to_uri.to_s.include?\"/leased\"))}\n if only_available\n debug \"only_available selected\"\n # TODO maybe delete also interfaces and locations as well\n comps.delete_if {|c| (c.kind_of?SAMANT::Uxv) && c.hasResourceStatus && (c.hasResourceStatus.to_uri == SAMANT::BOOKED.to_uri) }\n end\n resources.concat(comps)\n #debug \"the resources: \" + resources.inspect\n # TODO uncomment to obtain rspeck, commented out because it's very time-wasting\n #used_for_side_effect = OMF::SFA::AM::Rest::ResourceHandler.rspecker(resources, :Offering) # -> creates the advertisement rspec file inside /ready4translation (less detailed, sfa enabled)\n start = Time.now\n debug \"START CREATING JSON\"\n res = OMF::SFA::AM::Rest::ResourceHandler.omn_response_json(resources, options) # -> returns the json formatted results (more detailed, omn enriched)\n debug \"END CREATING JSON. total time = \" + (Time.now-start).to_s\n end\n\n @return_struct[:code][:geni_code] = 0\n @return_struct[:value] = res\n @return_struct[:output] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n rescue OMF::SFA::AM::InsufficientPrivilegesException => e\n @return_struct[:code][:geni_code] = 3\n @return_struct[:output] = e.to_s\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def resources(opts={})\n Tripod::ResourceCollection.new(\n self.resource_class._resources_from_sparql(self.as_query(opts)),\n # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph\n :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),\n :criteria => self\n )\n end",
"def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end",
"def list klass, names, options, check_remote = false, &block\n ResourceInfo.list klass, self, names, options, check_remote, &block\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end",
"def get_resources_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DiagnosticsApi.get_resources ...\"\n end\n # resource path\n local_var_path = \"/v2.1\".sub('{format}','json')\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 => 'ResourceInformation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiagnosticsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def resources\n @resources\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def each_resource(url, offset = 0, &block)\n return enum_for(:each_resource, url) unless block_given?\n return unless url\n\n response = params(offset: offset).get(path: url).json\n\n resources = response.fetch(@array_key.to_sym)\n current_count = response.fetch(:offset) + response.fetch(:limit)\n\n resources&.each { |value| yield value } # rubocop:disable Style/ExplicitBlockArgument\n\n if resources.empty?\n reset_params\n return\n end\n\n each_resource(url, current_count, &block)\n end",
"def read(resource_type, id)\n unless RESOURCES.include?(resource_type)\n raise Common::Exceptions::InvalidFieldValue.new('resource_type', resource_type)\n end\n\n perform(:get, \"#{resource_type}/#{id}\", nil)\n end",
"def resources_url options={}\n r=request.path\n options = case params[:action]\n when 'create','update','delete','destroy'; \"\"\n else resource_options(options)\n end\n return \"%s%s\" % [r,options] if r.match \"#{resource.class.to_s.tableize}$\"\n \"%s%s%s\" % [ r.split( resource.class.to_s.tableize)[0],resource.class.to_s.tableize, options]\n rescue Exception => e\n scoop_from_error e\n end",
"def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end",
"def find_resources(ast, type = nil)\n ast.xpath(%Q{//method_add_block[command/ident#{type.nil? ? '' : \"[@value='#{type}']\"}]})\n end",
"def find_resources(ast, type = nil)\n ast.xpath(%Q{//method_add_block[command/ident#{type.nil? ? '' : \"[@value='#{type}']\"}]})\n end",
"def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend",
"def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend",
"def list(type, parameters)\n @type = type # Keep this around to structure the output\n @response = self.request(Net::HTTP::Get.new(\n \"/#{type}.#{Format}?#{parameters}\"\n ))\n self.to_s\n end",
"def resources\n @resources ||= @internal_struct[:resources] || {}\n end",
"def query_resources\n powershell_exec(\"get-dscresource\").result\n end",
"def resource_list\n self.resources\n end",
"def find_associated_resources(resource_descr, resource_type, target_type, authorizer)\n debug \"find_associated_resources: descr: '#{resource_descr.inspect}'\"\n source_resource = nil\n target_resources = nil\n if resource_descr.kind_of? OMF::SFA::Model::Resource\n source_resource = resource_descr\n elsif resource_descr.kind_of? Hash\n model = eval(\"OMF::SFA::Model::#{resource_type.camelize}\")\n if resource_descr[:or]\n source_resource = nil\n resource_descr[:or].keys.each do |key|\n if source_resource.nil?\n source_resource = model.where({key => resource_descr[:or][key]})\n else\n source_resource = source_resource.or({key => resource_descr[:or][key]})\n end\n end\n else\n source_resource = model.where(resource_descr)\n end\n source_resource = source_resource.first\n if source_resource.kind_of? OMF::SFA::Model::Account and target_type.to_s.pluralize == 'leases'\n target_resources = []\n source_resource.resources.each { |res|\n if res.resource_type == 'lease'\n target_resources << res\n end\n }\n elsif !source_resource.nil? and source_resource.class.method_defined?(target_type)\n target_resources = source_resource.send(target_type)\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Invalid URL.\"\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n unless source_resource\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\"\n end\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(source_resource)\n return source_resource, target_resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resource_scope\n resource_class.all\n end",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def fetch(resource_type,identifier,params={})\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n hydrate(resource_type, http_get(path,params))\n end",
"def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end",
"def discovery_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DiscoveryApi.discovery_resources ...'\n end\n # resource path\n local_var_path = '/'\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(['text/plain; charset=utf-8'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiscoveryApi#discovery_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fetch_urls(name, format, size='raw')\n [self::CONTENT_TYPES[format.to_sym], retrieve_image(name, format, size, :url)]\n end"
] | [
"0.6890208",
"0.6706383",
"0.66487217",
"0.6572492",
"0.6482573",
"0.6240925",
"0.62383497",
"0.61966914",
"0.6074262",
"0.60742515",
"0.60742307",
"0.60664564",
"0.60151577",
"0.5987299",
"0.597916",
"0.5952805",
"0.59348273",
"0.5921658",
"0.59107345",
"0.5903388",
"0.5903388",
"0.5894873",
"0.5848218",
"0.58080894",
"0.5777742",
"0.57754374",
"0.5765461",
"0.575951",
"0.574153",
"0.5739989",
"0.57399684",
"0.5726018",
"0.57259816",
"0.56976235",
"0.56965184",
"0.5693872",
"0.5693494",
"0.5691619",
"0.5672405",
"0.5670349",
"0.5653305",
"0.56394047",
"0.5622793",
"0.56221396",
"0.5608197",
"0.5594278",
"0.559382",
"0.5588145",
"0.55865395",
"0.5568038",
"0.5526395",
"0.5507729",
"0.5503006",
"0.54854506",
"0.547916",
"0.54581124",
"0.5454764",
"0.54514366",
"0.54468274",
"0.54467916",
"0.5427996",
"0.5423025",
"0.54228234",
"0.54074764",
"0.5399646",
"0.5397817",
"0.5382235",
"0.53803515",
"0.53756064",
"0.53727615",
"0.5370045",
"0.5353776",
"0.53307796",
"0.532832",
"0.5319198",
"0.53166103",
"0.5315558",
"0.53061795",
"0.5299161",
"0.5287907",
"0.52822065",
"0.52822065",
"0.52679914",
"0.5235073",
"0.5233139",
"0.52213496",
"0.5207921",
"0.52023506",
"0.5198478",
"0.5196351",
"0.51922286",
"0.5179108",
"0.5179108",
"0.5179108",
"0.5171143",
"0.5168117",
"0.51507294",
"0.51494604",
"0.5146106",
"0.51415926"
] | 0.6691865 | 2 |
Retrieves descriptions for available resources specified by a type identifier or resource location. If no type identifier or location is specified, all available resources in all available resource types will be described. | def describe(resource_type_identifier=nil)
# convert type to type identifier
resource_type_identifier = @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.first.type_identifier if @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.any?
# check some basic pre-conditions
raise "Endpoint is not connected!" unless @connected
descriptions = []
if resource_type_identifier.nil?
descriptions << get('/')
elsif @model.get_by_id resource_type_identifier
# we got type identifier
# get all available resources of this type
locations = list resource_type_identifier
# make the requests
locations.each do |location|
descriptions << get(sanitize_resource_link(location))
end
elsif resource_type_identifier.start_with?(@endpoint) || resource_type_identifier.start_with?('/')
# we got resource link
# make the request
descriptions << get(sanitize_resource_link(resource_type_identifier))
else
raise "Unkown resource type identifier! [#{resource_type_identifier}]"
end
descriptions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"find_resources: descr: '#{resource_descr.inspect}'\"\n if resource_descr.kind_of? Hash\n can_handle = eval(\"OMF::SFA::Model::#{resource_type.classify}\").respond_to? :handle_rest_get_resource\n if can_handle\n cls = eval(\"OMF::SFA::Model::#{resource_type.classify}\")\n resources = cls.handle_rest_get_resource(resource_descr)\n else\n resources = eval(\"OMF::SFA::Model::#{resource_type.classify}\").where(resource_descr)\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n\n # raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil? || resources.empty?\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil?\n\n resources.map do |r|\n begin\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(r)\n r\n rescue InsufficientPrivilegesException\n nil\n end\n end.compact\n end",
"def get_info(params)\n debug 'Admin ListResources: Options: ', params.inspect\n category = params[:type]\n descr = params[:description]\n descr, find_with_array_hash = find_doctor(descr)\n\n if category # if applied specific resource type\n debug \"descr = \" + descr.inspect\n resources = @am_manager.find_all_samant_resources(category, descr)\n elsif urns = params[:urns] # if applied for certain urns\n resources = @am_manager.find_all_samant_resources(nil, descr)\n resources.delete_if {|c| !urns.include?(c.to_uri.to_s)}\n end\n resources.delete_if {|c| c.to_uri.to_s.include?\"/leased\"} unless resources.nil?\n unless find_with_array_hash.empty?\n resources.delete_if {|c| !find_with_array_hash.values[0].include? eval(\"c.#{find_with_array_hash.keys[0]}\")} unless resources.nil?\n end\n resources\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def descriptive_resources\n find_related_frbr_objects( :is_described_by, :which_resources?) \n end",
"def descriptive_resources\n find_related_frbr_objects( :is_described_by, :which_resources?) \n end",
"def all\n describe(resource_uri)\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def list(resource_type_identifier=nil)\n if resource_type_identifier\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\" unless @model.get_by_id resource_type_identifier\n\n # split the type identifier and get the most important part\n uri_part = resource_type_identifier.split('#').last\n\n # request uri-list from the server\n path = uri_part + '/'\n else\n path = '/'\n end\n\n headers = self.class.headers.clone\n headers['Accept'] = 'text/uri-list'\n\n # TODO: remove the gsub OCCI-OS hack\n response = self.class.get(\n @endpoint + path,\n :headers => headers\n ).body.gsub(/\\# uri:\\/(compute|storage|network)\\/[\\n]?/, '').split(\"\\n\").compact\n end",
"def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"def lookup_resource(type, name, run_context)\n begin\n run_context.resource_collection.find(\"#{ type }[#{ name }]\")\n rescue ArgumentError => e\n puts \"You provided invalid arugments to resource_collection.find: #{ e }\"\n rescue RuntimeError => e\n puts \"The resources you searched for were not found: #{ e }\"\n end\n end",
"def find_associated_resources(resource_descr, resource_type, target_type, authorizer)\n debug \"find_associated_resources: descr: '#{resource_descr.inspect}'\"\n source_resource = nil\n target_resources = nil\n if resource_descr.kind_of? OMF::SFA::Model::Resource\n source_resource = resource_descr\n elsif resource_descr.kind_of? Hash\n model = eval(\"OMF::SFA::Model::#{resource_type.camelize}\")\n if resource_descr[:or]\n source_resource = nil\n resource_descr[:or].keys.each do |key|\n if source_resource.nil?\n source_resource = model.where({key => resource_descr[:or][key]})\n else\n source_resource = source_resource.or({key => resource_descr[:or][key]})\n end\n end\n else\n source_resource = model.where(resource_descr)\n end\n source_resource = source_resource.first\n if source_resource.kind_of? OMF::SFA::Model::Account and target_type.to_s.pluralize == 'leases'\n target_resources = []\n source_resource.resources.each { |res|\n if res.resource_type == 'lease'\n target_resources << res\n end\n }\n elsif !source_resource.nil? and source_resource.class.method_defined?(target_type)\n target_resources = source_resource.send(target_type)\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Invalid URL.\"\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n unless source_resource\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\"\n end\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(source_resource)\n return source_resource, target_resources\n end",
"def list_location_descriptions # :nologin:\n query = create_query(:LocationDescription, :all, :by => :name)\n show_selected_location_descriptions(query)\n end",
"def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end",
"def describe(resource_type_identifier=nil)\n raise Occi::Api::Client::Errors::NotImplementedError, \"#{__method__} is just a stub!\"\n end",
"def query_resources\n powershell_exec(\"get-dscresource\").result\n end",
"def discovery_resources(opts = {})\n discovery_resources_with_http_info(opts)\n nil\n end",
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"central find_all_resources: descr: '#{resource_descr.inspect}' resource_type: #{resource_type}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def get_resource_descriptions(resource)\n available_versions.map do |version|\n get_resource_description(resource, version)\n end.compact\n end",
"def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def get_resource_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def get_resources_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DiagnosticsApi.get_resources ...\"\n end\n # resource path\n local_var_path = \"/v2.1\".sub('{format}','json')\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 => 'ResourceInformation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiagnosticsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end",
"def resource_description(options = {}, &block) #:doc:\n return unless Apipie.active_dsl?\n raise ArgumentError, \"Block expected\" unless block_given?\n\n dsl_data = ResourceDescriptionDsl.eval_dsl(self, &block)\n versions = dsl_data[:api_versions]\n @apipie_resource_descriptions = versions.map do |version|\n Apipie.define_resource_description(self, version, dsl_data)\n end\n Apipie.set_controller_versions(self, versions)\n end",
"def resources(*args)\n run_context.resource_collection.find(*args)\n end",
"def resources(type, path)\n Resources.new(self, path, type)\n end",
"def get_linked_resources(resource_type, filters = {})\n Util.convert_to_clever_object Clever.request(:get, get_uri(resource_type), filters)[:data]\n end",
"def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n # binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end",
"def find_resource(resource_descr, resource_type, authorizer)\n debug \"find_resource: descr: '#{resource_descr.inspect}'\"\n if resource_descr.kind_of? OMF::SFA::Model::Resource\n resource = resource_descr\n elsif resource_descr.kind_of? Hash\n scape_first = false\n model = eval(\"OMF::SFA::Model::#{resource_type.camelize}\")\n if resource_descr[:or]\n resource = nil\n resource_descr[:or].keys.each do |key|\n if resource.nil?\n resource = model.where({key => resource_descr[:or][key]})\n else\n resource = resource.or({key => resource_descr[:or][key]})\n end\n end\n elsif resource_descr[:id]\n resource = model[resource_descr[:id]]\n scape_first = true\n else\n resource = model.where(resource_descr)\n end\n resource = resource.first unless scape_first\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n unless resource\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\"\n end\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(resource)\n resource\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def resource_info(partner_type, resource_type)\n wait_until_bus_section_load\n result = {}\n if partner_type == 'Itemized'\n ['Desktop', 'Server', 'Test1', 'Test2'].each do |type|\n ['used', 'total', 'subpartner'].each do |u_t_s|\n locator = \"#{[\"resource\", \"#{resource_type}\", \"#{u_t_s}\", \"#{type}\"].join('_')}\"\n elements = all(:id, locator)\n result[\"#{[\"#{resource_type}\", \"#{type.downcase}\", \"#{u_t_s}\"].join('_')}\"] = elements.first.text if !elements.empty? && elements.first.visible?\n end\n end\n end\n ['used', 'available'].each do |u_or_a|\n result[\"#{resource_type}_#{u_or_a}\"] = find(:id, \"resource_summary_#{resource_type}_#{u_or_a}\").text\n end\n elements = all(:id, \"resource_#{resource_type}_subpartner_all\")\n result[\"#{resource_type}_all_subpartner\"] = elements.first.text unless elements.empty?\n result\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\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<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_auth']\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: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def discovery_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DiscoveryApi.discovery_resources ...'\n end\n # resource path\n local_var_path = '/'\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(['text/plain; charset=utf-8'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiscoveryApi#discovery_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_resources options\n\n # return [] unless resource_class.ancestors.include? ActiveRecord::Base\n params[:ids] ||= []\n params[:ids] << params[:id] unless params[:id].nil?\n\n if params[:ids].compact.any?\n policy_scope(resource_class).where(id: params[:ids].compact.split(\",\").flatten)\n else\n # search\n r = _search options\n\n # filter\n r = _filter r, options\n\n # sort\n r = _sort r, options\n\n # paginate\n r = _paginate r\n\n # (params[:format].nil? or params[:format]=='html') ? r.page(params[:page]).per(params[:perpage]) : r\n end\n end",
"def describe_locations(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLocations'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :namespace\n\t\t\targs[:query]['Namespace'] = optional[:namespace]\n\t\tend\n\t\tif optional.key? :namespace_uid\n\t\t\targs[:query]['NamespaceUid'] = optional[:namespace_uid]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def indexable_resources\n return to_enum(:indexable_resources) { size } unless block_given?\n\n resources.each do |resource|\n yield resource\n\n next unless resource.exists?\n\n resource.items.each do |r|\n yield Purl.new(r.druid)\n end\n end\n end",
"def fetch(resource_type,identifier,params={})\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n hydrate(resource_type, http_get(path,params))\n end",
"def show_resources_in_namespace(namespace, *resource_types)\n run \"kubectl get #{resource_types.join(',')} --namespace #{namespace} --output=wide\"\nend",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end",
"def to_resource_declaration(type)\n if type.respond_to?(:type_name) && type.respond_to?(:title)\n title = type.title\n type_name = type.type_name\n elsif type_result = /(\\w+)\\['?(\\w+)'?\\]/.match(type.to_s)\n # not all types have a type_name and title so we\n # output to a string and parse the results\n title = type_result[2]\n type_name = type_result[1]\n else\n return type\n end\n res = scope.catalog.resource(type_name, title)\n return res.to_ral if res\n # don't return anything or returns nil if item is not in the catalog\n end",
"def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend",
"def generic_resource( unit )\n resources unit, concerns: [:search_suggestion, :uniqueness_validation, :retrieve_resource]\n end",
"def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end",
"def find_resources(ast, options = {})\n options = {:type => :any}.merge!(options)\n return [] unless ast.respond_to?(:xpath)\n scope_type = ''\n scope_type = \"[@value='#{options[:type]}']\" unless options[:type] == :any\n # XXX: include nested resources (provider actions)\n no_actions = \"[command/ident/@value != 'action']\"\n ast.xpath(\"//method_add_block[command/ident#{scope_type}]#{no_actions}\")\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def read(resource_type, id)\n unless RESOURCES.include?(resource_type)\n raise Common::Exceptions::InvalidFieldValue.new('resource_type', resource_type)\n end\n\n perform(:get, \"#{resource_type}/#{id}\", nil)\n end",
"def resources\n @resources ||= if options[:resources]\n options[:resources]\n elsif options[:search]\n if options[:search].is_a?(String)\n options[:search] = Rack::Utils.parse_nested_query(options[:search])\n end\n\n model.ransack(options[:search]).result\n else\n model.all\n end\n end",
"def filter_resources(resources, opts)\n if opts[:type] && opts[:name]\n resources.select { |r| r.type == opts[:type] && r.name == opts[:name] }\n elsif opts[:type]\n resources.select { |r| r.type == opts[:type] }\n elsif opts[:name]\n resources.select { |r| r.name == opts[:name] }\n else\n resources\n end\n end",
"def find_resources(ast, type = nil)\n ast.xpath(%Q{//method_add_block[command/ident#{type.nil? ? '' : \"[@value='#{type}']\"}]})\n end",
"def find_resources(ast, type = nil)\n ast.xpath(%Q{//method_add_block[command/ident#{type.nil? ? '' : \"[@value='#{type}']\"}]})\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def get_architect_dependencytracking_consumingresources_with_http_info(id, object_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_consumingresources ...\"\n end\n \n \n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling ArchitectApi.get_architect_dependencytracking_consumingresources\" if id.nil?\n \n \n \n \n \n \n # verify the required parameter 'object_type' is set\n fail ArgumentError, \"Missing the required parameter 'object_type' when calling ArchitectApi.get_architect_dependencytracking_consumingresources\" if object_type.nil?\n \n # verify enum value\n unless ['ACDLANGUAGE', 'ACDSKILL', 'ACDWRAPUPCODE', 'BRIDGEACTION', 'COMPOSERSCRIPT', 'CONTACTLIST', 'DATAACTION', 'EMAILROUTE', 'GROUP', 'INBOUNDCALLFLOW', 'INBOUNDEMAILFLOW', 'INBOUNDSHORTMESSAGEFLOW', 'INQUEUECALLFLOW', 'IVRCONFIGURATION', 'LANGUAGE', 'LEXBOT', 'LEXBOTALIAS', 'OUTBOUNDCALLFLOW', 'QUEUE', 'RESPONSE', 'SCHEDULE', 'SCHEDULEGROUP', 'SECUREACTION', 'SECURECALLFLOW', 'SURVEYINVITEFLOW', 'SYSTEMPROMPT', 'USER', 'USERPROMPT', 'VOICEXML', 'WORKFLOW'].include?(object_type)\n fail ArgumentError, \"invalid value for 'object_type', must be one of ACDLANGUAGE, ACDSKILL, ACDWRAPUPCODE, BRIDGEACTION, COMPOSERSCRIPT, CONTACTLIST, DATAACTION, EMAILROUTE, GROUP, INBOUNDCALLFLOW, INBOUNDEMAILFLOW, INBOUNDSHORTMESSAGEFLOW, INQUEUECALLFLOW, IVRCONFIGURATION, LANGUAGE, LEXBOT, LEXBOTALIAS, OUTBOUNDCALLFLOW, QUEUE, RESPONSE, SCHEDULE, SCHEDULEGROUP, SECUREACTION, SECURECALLFLOW, SURVEYINVITEFLOW, SYSTEMPROMPT, USER, USERPROMPT, VOICEXML, WORKFLOW\"\n end\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/consumingresources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'objectType'] = object_type\n query_params[:'resourceType'] = @api_client.build_collection_param(opts[:'resource_type'], :multi) if opts[:'resource_type']\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 \n auth_names = ['PureCloud Auth']\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 => 'ConsumingResourcesEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_consumingresources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def lookup(type_name, resource_name)\n self.class.catalog_lookup(resource.catalog, type_name, resource_name)\n end",
"def find_all_available_components(component_descr = {}, component_type, valid_from, valid_until, authorizer)\n debug \"find_all_available_components: descr: '#{component_descr.inspect}', from: '#{valid_from}', until: '#{valid_until}'\"\n component_descr[:account_id] = _get_nil_account.id\n components = find_all_resources(component_descr, component_type, authorizer)\n\n components = components.select do |res|\n @scheduler.component_available?(res, valid_from, valid_until)\n end\n\n raise UnavailableResourceException if components.empty?\n components\n end",
"def collect\n resources = []\n\n time = Puppet::Util.thinmark do\n t = @type\n q = @cquery\n\n resources = scope.compiler.resources.find_all do |resource|\n resource.type == t && resource.exported? && (q.nil? || q.call(resource))\n end\n\n found = Puppet::Resource.indirection.\n search(@type, :host => @scope.compiler.node.name, :filter => @equery, :scope => @scope)\n\n found_resources = found.map {|x| x.is_a?(Puppet::Parser::Resource) ? x : x.to_resource(@scope)}\n\n found_resources.each do |item|\n existing = @scope.findresource(item.resource_type, item.title)\n if existing\n unless existing.collector_id == item.collector_id\n raise Puppet::ParseError,\n _(\"A duplicate resource was found while collecting exported resources, with the type and title %{title}\") % { title: item.ref }\n end\n else\n item.exported = false\n @scope.compiler.add_resource(@scope, item)\n resources << item\n end\n end\n end\n\n scope.debug(\"Collected %s %s resource%s in %.2f seconds\" %\n [resources.length, @type, resources.length == 1 ? \"\" : \"s\", time])\n\n resources\n end",
"def resources\n @resources\n end",
"def describe_resource(base_path, options = {}, &block)\n abstract_describe(base_path, { single_resource: true }.merge(options), &block)\n end",
"def resources(oneview_type = nil, oneview_name = nil)\n oneview_type = @options[:oneview_type] if oneview_type.nil?\n oneview_name = @options[:oneview_name] if oneview_name.nil?\n raise 'Oneview resource type must be specified.' if oneview_type.nil?\n\n # Determine the endpoint that needs to be called\n endpoint = format('/rest/%s', oneview_type)\n\n # Find the resources\n response = oneview_client.rest_get(endpoint)\n resources = oneview_client.response_handler(response)\n\n return resources if oneview_name.nil?\n\n # Filter the resources by the name if it has been specified\n resources['members'].select { |r| r['name'] == oneview_name }\n end",
"def resources(resources_hash)\n commodities(resources_hash['Commodities'])\n agents(resources_hash['Agents'])\n end",
"def get_architect_dependencytracking_consumedresources_with_http_info(id, version, object_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_consumedresources ...\"\n end\n \n \n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling ArchitectApi.get_architect_dependencytracking_consumedresources\" if id.nil?\n \n \n \n \n \n \n # verify the required parameter 'version' is set\n fail ArgumentError, \"Missing the required parameter 'version' when calling ArchitectApi.get_architect_dependencytracking_consumedresources\" if version.nil?\n \n \n \n \n \n \n # verify the required parameter 'object_type' is set\n fail ArgumentError, \"Missing the required parameter 'object_type' when calling ArchitectApi.get_architect_dependencytracking_consumedresources\" if object_type.nil?\n \n # verify enum value\n unless ['ACDLANGUAGE', 'ACDSKILL', 'ACDWRAPUPCODE', 'BRIDGEACTION', 'COMPOSERSCRIPT', 'CONTACTLIST', 'DATAACTION', 'EMAILROUTE', 'GROUP', 'INBOUNDCALLFLOW', 'INBOUNDEMAILFLOW', 'INBOUNDSHORTMESSAGEFLOW', 'INQUEUECALLFLOW', 'IVRCONFIGURATION', 'LANGUAGE', 'LEXBOT', 'LEXBOTALIAS', 'OUTBOUNDCALLFLOW', 'QUEUE', 'RESPONSE', 'SCHEDULE', 'SCHEDULEGROUP', 'SECUREACTION', 'SECURECALLFLOW', 'SURVEYINVITEFLOW', 'SYSTEMPROMPT', 'USER', 'USERPROMPT', 'VOICEXML', 'WORKFLOW'].include?(object_type)\n fail ArgumentError, \"invalid value for 'object_type', must be one of ACDLANGUAGE, ACDSKILL, ACDWRAPUPCODE, BRIDGEACTION, COMPOSERSCRIPT, CONTACTLIST, DATAACTION, EMAILROUTE, GROUP, INBOUNDCALLFLOW, INBOUNDEMAILFLOW, INBOUNDSHORTMESSAGEFLOW, INQUEUECALLFLOW, IVRCONFIGURATION, LANGUAGE, LEXBOT, LEXBOTALIAS, OUTBOUNDCALLFLOW, QUEUE, RESPONSE, SCHEDULE, SCHEDULEGROUP, SECUREACTION, SECURECALLFLOW, SURVEYINVITEFLOW, SYSTEMPROMPT, USER, USERPROMPT, VOICEXML, WORKFLOW\"\n end\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/consumedresources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'version'] = version\n query_params[:'objectType'] = object_type\n query_params[:'resourceType'] = @api_client.build_collection_param(opts[:'resource_type'], :multi) if opts[:'resource_type']\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 \n auth_names = ['PureCloud Auth']\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 => 'ConsumedResourcesEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_consumedresources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def resource type, labels = {}\n Resource.new.tap do |r|\n r.type = type\n r.labels = labels\n end\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def get_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.get_resources ...'\n end\n # resource path\n local_var_path = '/v1/resources'\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/links+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 = opts[:return_type] || 'InlineResponse2004' \n\n auth_names = opts[:auth_names] || ['oauth2']\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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcePermissionsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def resources\n @resources ||= @internal_struct[:resources] || {}\n end",
"def get_architect_dependencytracking_consumedresources_with_http_info(id, version, object_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_consumedresources ...\"\n end\n \n \n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling ArchitectApi.get_architect_dependencytracking_consumedresources\" if id.nil?\n \n \n \n \n \n \n # verify the required parameter 'version' is set\n fail ArgumentError, \"Missing the required parameter 'version' when calling ArchitectApi.get_architect_dependencytracking_consumedresources\" if version.nil?\n \n \n \n \n \n \n # verify the required parameter 'object_type' is set\n fail ArgumentError, \"Missing the required parameter 'object_type' when calling ArchitectApi.get_architect_dependencytracking_consumedresources\" if object_type.nil?\n \n # verify enum value\n unless ['ACDLANGUAGE', 'ACDSKILL', 'ACDWRAPUPCODE', 'BOTFLOW', 'BRIDGEACTION', 'COMMONMODULEFLOW', 'COMPOSERSCRIPT', 'CONTACTLIST', 'DATAACTION', 'DATATABLE', 'DIALOGENGINEBOT', 'DIALOGENGINEBOTVERSION', 'DIALOGFLOWAGENT', 'EMAILROUTE', 'EMERGENCYGROUP', 'FLOWACTION', 'FLOWDATATYPE', 'FLOWOUTCOME', 'GROUP', 'INBOUNDCALLFLOW', 'INBOUNDCHATFLOW', 'INBOUNDEMAILFLOW', 'INBOUNDSHORTMESSAGEFLOW', 'INQUEUECALLFLOW', 'IVRCONFIGURATION', 'LANGUAGE', 'LEXBOT', 'LEXBOTALIAS', 'NLUDOMAIN', 'OUTBOUNDCALLFLOW', 'QUEUE', 'RECORDINGPOLICY', 'RESPONSE', 'SCHEDULE', 'SCHEDULEGROUP', 'SECUREACTION', 'SECURECALLFLOW', 'SURVEYINVITEFLOW', 'SYSTEMPROMPT', 'TTSENGINE', 'TTSVOICE', 'USER', 'USERPROMPT', 'WIDGET', 'WORKFLOW'].include?(object_type)\n fail ArgumentError, \"invalid value for 'object_type', must be one of ACDLANGUAGE, ACDSKILL, ACDWRAPUPCODE, BOTFLOW, BRIDGEACTION, COMMONMODULEFLOW, COMPOSERSCRIPT, CONTACTLIST, DATAACTION, DATATABLE, DIALOGENGINEBOT, DIALOGENGINEBOTVERSION, DIALOGFLOWAGENT, EMAILROUTE, EMERGENCYGROUP, FLOWACTION, FLOWDATATYPE, FLOWOUTCOME, GROUP, INBOUNDCALLFLOW, INBOUNDCHATFLOW, INBOUNDEMAILFLOW, INBOUNDSHORTMESSAGEFLOW, INQUEUECALLFLOW, IVRCONFIGURATION, LANGUAGE, LEXBOT, LEXBOTALIAS, NLUDOMAIN, OUTBOUNDCALLFLOW, QUEUE, RECORDINGPOLICY, RESPONSE, SCHEDULE, SCHEDULEGROUP, SECUREACTION, SECURECALLFLOW, SURVEYINVITEFLOW, SYSTEMPROMPT, TTSENGINE, TTSVOICE, USER, USERPROMPT, WIDGET, WORKFLOW\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/consumedresources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'version'] = version\n query_params[:'objectType'] = object_type\n query_params[:'resourceType'] = @api_client.build_collection_param(opts[:'resource_type'], :multi) if opts[:'resource_type']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 \n auth_names = ['PureCloud OAuth']\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 => 'ConsumedResourcesEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_consumedresources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def desc\n @desc ||= \"Get #{this_resource.downcase} by ID\"\n end",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def get_resources(opts = {})\n data, _status_code, _headers = get_resources_with_http_info(opts)\n data\n end",
"def find_description(id)\n if self.class.name == 'NameController'\n find_or_goto_index(NameDescription, id)\n else\n find_or_goto_index(LocationDescription, id)\n end\n end",
"def resources\n body && [*body]\n end",
"def show\n status_not_acceptable && return unless accept_header?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n resource = get_patient(params.permit(:id)[:id])\n when 'observation'\n resource = get_laboratory(params.permit(:id)[:id])\n when 'questionnaireresponse'\n resource = get_assessment(params.permit(:id)[:id])\n else\n status_bad_request && return\n end\n\n status_forbidden && return if resource.nil?\n\n status_ok(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def find_resource(type, name)\n begin\n return resource_collection.lookup(\"#{type}[#{name}]\")\n rescue Chef::Exceptions::ResourceNotFound; end\n\n resource_collection.all_resources.find do |resource|\n resource_name(resource) == type && (name === resource.identity || name === resource.name)\n end\n end",
"def type_description\n type = LocationType.find_by_code(self.location_type_code)\n if (type)\n type.description\n else\n nil\n end\n end",
"def get_architect_dependencytracking_consumingresources_with_http_info(id, object_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_consumingresources ...\"\n end\n \n \n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling ArchitectApi.get_architect_dependencytracking_consumingresources\" if id.nil?\n \n \n \n \n \n \n # verify the required parameter 'object_type' is set\n fail ArgumentError, \"Missing the required parameter 'object_type' when calling ArchitectApi.get_architect_dependencytracking_consumingresources\" if object_type.nil?\n \n # verify enum value\n unless ['ACDLANGUAGE', 'ACDSKILL', 'ACDWRAPUPCODE', 'BOTFLOW', 'BRIDGEACTION', 'COMMONMODULEFLOW', 'COMPOSERSCRIPT', 'CONTACTLIST', 'DATAACTION', 'DATATABLE', 'DIALOGENGINEBOT', 'DIALOGENGINEBOTVERSION', 'DIALOGFLOWAGENT', 'EMAILROUTE', 'EMERGENCYGROUP', 'FLOWACTION', 'FLOWDATATYPE', 'FLOWOUTCOME', 'GROUP', 'INBOUNDCALLFLOW', 'INBOUNDCHATFLOW', 'INBOUNDEMAILFLOW', 'INBOUNDSHORTMESSAGEFLOW', 'INQUEUECALLFLOW', 'IVRCONFIGURATION', 'LANGUAGE', 'LEXBOT', 'LEXBOTALIAS', 'NLUDOMAIN', 'OUTBOUNDCALLFLOW', 'QUEUE', 'RECORDINGPOLICY', 'RESPONSE', 'SCHEDULE', 'SCHEDULEGROUP', 'SECUREACTION', 'SECURECALLFLOW', 'SURVEYINVITEFLOW', 'SYSTEMPROMPT', 'TTSENGINE', 'TTSVOICE', 'USER', 'USERPROMPT', 'WIDGET', 'WORKFLOW'].include?(object_type)\n fail ArgumentError, \"invalid value for 'object_type', must be one of ACDLANGUAGE, ACDSKILL, ACDWRAPUPCODE, BOTFLOW, BRIDGEACTION, COMMONMODULEFLOW, COMPOSERSCRIPT, CONTACTLIST, DATAACTION, DATATABLE, DIALOGENGINEBOT, DIALOGENGINEBOTVERSION, DIALOGFLOWAGENT, EMAILROUTE, EMERGENCYGROUP, FLOWACTION, FLOWDATATYPE, FLOWOUTCOME, GROUP, INBOUNDCALLFLOW, INBOUNDCHATFLOW, INBOUNDEMAILFLOW, INBOUNDSHORTMESSAGEFLOW, INQUEUECALLFLOW, IVRCONFIGURATION, LANGUAGE, LEXBOT, LEXBOTALIAS, NLUDOMAIN, OUTBOUNDCALLFLOW, QUEUE, RECORDINGPOLICY, RESPONSE, SCHEDULE, SCHEDULEGROUP, SECUREACTION, SECURECALLFLOW, SURVEYINVITEFLOW, SYSTEMPROMPT, TTSENGINE, TTSVOICE, USER, USERPROMPT, WIDGET, WORKFLOW\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'flow_filter'] && !['checkedIn', 'published'].include?(opts[:'flow_filter'])\n fail ArgumentError, 'invalid value for \"flow_filter\", must be one of checkedIn, published'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/consumingresources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'objectType'] = object_type\n query_params[:'resourceType'] = @api_client.build_collection_param(opts[:'resource_type'], :multi) if opts[:'resource_type']\n query_params[:'version'] = opts[:'version'] if opts[:'version']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'flowFilter'] = opts[:'flow_filter'] if opts[:'flow_filter']\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 \n auth_names = ['PureCloud OAuth']\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 => 'ConsumingResourcesEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_consumingresources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def type\n Resource::ALL\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def test_description\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal('Show all sample resources',\n schema.resource('resource').link('list').description)\n end",
"def find_associated_resources(resource_descr, resource_type, target_type,authorizer)\n debug \"central find_associated_resources: descr: '#{resource_descr.inspect}' resource_type: #{resource_type}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end",
"def provide_navigation_to_all_long_descriptions\n # Interface method\n end",
"def scrape_resources(opts = {})\n BBLib::HashStruct.new.tap do |hash|\n resources.each do |resource|\n hash[resource.name] = resource.retrieve(opts)\n end\n end\n end",
"def find_resource(type, name, created_at: nil, run_context: self.run_context, &resource_attrs_block)\n find_resource!(type, name, run_context: run_context)\n rescue Chef::Exceptions::ResourceNotFound\n if resource_attrs_block\n declare_resource(type, name, created_at: created_at, run_context: run_context, &resource_attrs_block)\n end # returns nil otherwise\n end",
"def index\n @document_types = DocumentType.all\n @document_types = @document_types.where(description: params[:description]) if params[:description]\n end",
"def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def resources\n @resources.values\n end"
] | [
"0.6783209",
"0.65141547",
"0.6345092",
"0.6174524",
"0.6174524",
"0.5971894",
"0.5926456",
"0.5900285",
"0.5882157",
"0.5881542",
"0.58698535",
"0.58470976",
"0.58366823",
"0.58180326",
"0.58154243",
"0.57796943",
"0.5745785",
"0.56759906",
"0.56659013",
"0.56436163",
"0.5596774",
"0.5523486",
"0.5501482",
"0.5490288",
"0.5490288",
"0.5487337",
"0.54793036",
"0.5474519",
"0.54552436",
"0.5448465",
"0.54395276",
"0.5421333",
"0.54161483",
"0.5378065",
"0.5376201",
"0.53674597",
"0.5353888",
"0.5347601",
"0.5347165",
"0.5342588",
"0.5324336",
"0.5318442",
"0.5313708",
"0.52979946",
"0.52948713",
"0.5294866",
"0.5268618",
"0.5252272",
"0.525057",
"0.52489287",
"0.52397335",
"0.52223",
"0.5220515",
"0.5216756",
"0.5216265",
"0.521116",
"0.52101207",
"0.52017444",
"0.5184129",
"0.5166512",
"0.5166512",
"0.51635784",
"0.5157079",
"0.5156079",
"0.5154582",
"0.514811",
"0.5142437",
"0.5138261",
"0.5137759",
"0.5120387",
"0.5115492",
"0.5108678",
"0.51035076",
"0.50974923",
"0.5075599",
"0.5072374",
"0.506468",
"0.506426",
"0.50605506",
"0.50441265",
"0.5031319",
"0.5017171",
"0.50079894",
"0.5002879",
"0.49940026",
"0.49914193",
"0.49798876",
"0.49771228",
"0.49757785",
"0.49720263",
"0.49685857",
"0.49562752",
"0.49523932",
"0.4944355",
"0.494254",
"0.49392524",
"0.49274132",
"0.4926938",
"0.49180248",
"0.49080473"
] | 0.74328613 | 0 |
Creates a new resource on the server. Resource must be provided as an instance of Occi::Core::Entity, e.g. instantiated using the get_resource method. | def create(entity)
# check some basic pre-conditions
raise "Endpoint is not connected!" unless @connected
raise "#{entity} not an entity" unless entity.kind_of? Occi::Core::Entity
# is this entity valid?
entity.model = @model
entity.check
Occi::Log.debug "Entity kind: #{entity.kind}"
kind = entity.kind
raise "No kind found for #{entity}" unless kind
# get location for this kind of entity
Occi::Log.debug "Kind location: #{entity.kind.location}"
location = kind.location
collection = Occi::Collection.new
# is this entity a Resource or a Link?
Occi::Log.debug "Entity class: #{entity.class.name}"
collection.resources << entity if entity.kind_of? Occi::Core::Resource
collection.links << entity if entity.kind_of? Occi::Core::Link
# make the request
post location, collection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_resource(_params)\n resource_class.new(resource_params)\n end",
"def create_resource\n class_name.new(get_secure_params).tap do |model|\n model.save\n set_resource_ivar model\n end\n end",
"def create(resource, options = {}, format = nil)\n base_create(resource, options, format)\n end",
"def create(resource)\n resource.client = self\n resource.create\n end",
"def create_resource object\n object.save\n end",
"def create\n @resource = Resource.new(params[:resource])\n \n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_resource(object)\n object.save\n end",
"def create\n resource = model_class.new(permitted_resource_params)\n ensure_current_store(resource)\n\n if resource.save\n render_serialized_payload(201) { serialize_resource(resource) }\n else\n render_error_payload(resource.errors)\n end\n end",
"def create_resource(new_resource, attributes)\n new_resource.attributes = attributes\n new_resource.save\n new_resource\n end",
"def create(repository, resource)\n raise NotImplementedError\n end",
"def new_resource(*args)\n Freemle::Client::Resource.new(*args)\n end",
"def create(resource, format=@default_format)\n options = { resource: resource.class, format: format }\n reply = post resource_url(options), resource, fhir_headers(options)\n if [200,201].include? reply.code\n type = reply.response[:headers][:content_type]\n if !type.nil?\n if type.include?('xml') && !reply.body.empty?\n reply.resource = resource.class.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n reply.resource = resource.class.from_fhir_json(reply.body)\n else\n reply.resource = resource # just send back the submitted resource\n end\n else\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n reply.resource = resource # just send back the submitted resource\n end\n reply.resource_class = resource.class\n reply\n end",
"def create\n add_breadcrumb I18n.t('integral.navigation.create')\n @resource = resource_klass.new(resource_params)\n\n yield if block_given?\n\n if @resource.save\n respond_successfully(notification_message('creation_success'), edit_backend_resource_url(@resource))\n else\n respond_failure(notification_message('creation_failure'), :new)\n end\n end",
"def create(*args)\n raise NotImplementedError, 'Implement a method to create the resource.'\n end",
"def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end",
"def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Resource.new(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_remote_resource(attributes_hash)\n path = \"/#{resource_name}/\"\n UserEngage.client.post(path, attributes_hash)\n end",
"def create\n add_breadcrumb I18n.t('integral.navigation.create'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new(resource_params)\n\n yield if block_given?\n\n if @resource.save\n respond_successfully(notification_message('creation_success'), send(\"edit_backend_#{controller_name.singularize}_path\", @resource.id))\n else\n respond_failure(notification_message('creation_failure'), :new)\n end\n end",
"def create_resource(resource_descr, type_to_create, authorizer)\n raise InsufficientPrivilegesException unless authorizer.can_create_resource?(resource_descr, type_to_create)\n\n if resource_descr[:account_id].nil?\n resource = eval(\"OMF::SFA::Model::#{type_to_create.classify}\").create(resource_descr)\n resource = manage_resource(resource)\n else\n resource = @scheduler.create_child_resource(resource_descr, type_to_create, nil)\n end\n\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' cannot be created\" unless resource\n resource\n end",
"def create\n self.resource = resource_class.new(params_for_create.to_hash.merge({created_by: current_user}))\n\n respond_to do |format|\n if resource.save\n format.html { redirect_to resource, notice: \"#{resource_class_name} was successfully created.\" }\n format.json { render :show, status: :created, location: resource }\n else\n format.html { render :new }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @entity = resource_class.new\n end",
"def create(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def create\n created_resource = create_resource(new_resource, resource_params)\n if created_resource.errors.blank?\n render json: serialize(created_resource),\n status: :created\n else\n render json: serialize_invalid_attributes(created_resource.errors),\n status: :unprocessable_entity\n end\n end",
"def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n flash[:success] = 'Resource was successfully created.'\n format.html { redirect_to admin_resource_path(@resource.id) }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n flash[:notice] = 'Resource was successfully created.'\n format.html { redirect_to(@resource) }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n @resource = Entity.new(params[:entity])\n @resource.save!\n render :response => :POST\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def create(resource_name)\n if ! advance? then return self end\n @@logger.debug \"Launching resource: #{resource_name}.\"\n resource = @resourcer.get resource_name\n deps = @resourcer.get_dep(resource_name)\n deps.each {|ref| create(ref)}\n created = @mutator.create(resource_name, resource)\n created.harp_script = @harp_script\n result = {:create => resource_name}\n args = {:action => :create}\n if created.output? (args)\n result[:output] = created.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n created.save\n return self\n end",
"def new\n @resource = Resource.new\n end",
"def create(data)\n @create_resource_mixin.create(data)\n end",
"def create\n model = model_class.new\n action = action_class.new(model, current_user)\n\n respond_with(action.create(resource_attributes))\n end",
"def create\n validate_save_and_respond(change_set_class.new(resource_class.new), :new)\n end",
"def create\n @resource = Resource.new(params[:resource])\n\n if @resource.save\n flash[:notice] = 'Resource was successfully created.'\n redirect_to @resource\n else\n render :action => \"new\"\n end\n end",
"def create(attributes = {})\n resource = new(attributes)\n resource.__send__(:_create)\n resource\n end",
"def base_create(resource, options, format = nil, additional_header = {})\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers = {content_type: \"#{format}\"}\n headers[:prefer] = @return_preference if @use_return_preference\n headers.merge!(additional_header)\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format || @default_format\n reply = post resource_url(options), resource, fhir_headers(headers)\n if [200, 201].include? reply.code\n type = reply.response[:headers].detect{|x, _y| x.downcase=='content-type'}.try(:last)\n if !type.nil?\n reply.resource = if type.include?('xml') && !reply.body.empty?\n klass = self.versioned_resource_class(:Xml)\n klass.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n klass = self.versioned_resource_class(:Json)\n klass.from_json(reply.body)\n else\n resource # just send back the submitted resource\n end\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n else\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n resource.id = FHIR::ResourceAddress.pull_out_id(resource.class.name.demodulize, reply.self_link)\n reply.resource = resource # just send back the submitted resource\n end\n set_client_on_resource(reply.resource)\n reply.resource_class = resource.class\n reply\n end",
"def create_resource(resource, opts = {})\n data, _status_code, _headers = create_resource_with_http_info(resource, opts)\n data\n end",
"def create(\n resource,\n deadline: nil\n )\n req = V1::ResourceCreateRequest.new()\n\n req.resource = Plumbing::convert_resource_to_plumbing(resource)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"Resources.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = ResourceCreateResponse.new()\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource)\n resp\n end",
"def create\n @resource = Resource.new(resource_params)\n\n handle_extra_data\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to edit_project_path(@resource.project), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end",
"def create(attributes = {})\n build(attributes).tap { |resource| resource.save }\n end",
"def create\n authorize! :create, resource\n current_model_service.create resource, params\n yield if block_given? # after_create\n respond_with resource, location: helpers.show_path(resource)\n end",
"def create\n Neo4j::Transaction.run do\n @q_resource = QResource.new(params[:q_resource])\n @q_resource.save!\n respond_to do |format|\n if @q_resource.save\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully created.' }\n format.json { render :json => @q_resource, :status => :created, :location => @q_resource }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def build_resource\n self.resource = resource_class.new(resource_params)\n end",
"def create\n self.resource = new_resource\n\n respond_to do |format|\n if resource.save\n flash[:notice] = \"#{resource_name.humanize} was successfully created.\"\n format.html { redirect_to resource_url }\n format.xml do\n header_attrs = {:location => resource_url}\n header_attrs.merge!(:key => resource.key) if resource.respond_to?(:key)\n head :created, header_attrs\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => resource.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def new_resource\n controller_class.new(new_resource_params)\n end",
"def create\n if @current_user\n @resource = Resource.create(resource_params)\n render json: @resource, status: 200\n else\n render json: {}, status: 401\n end \n end",
"def create_resource(type, file, resource_name=nil, comment=nil)\n if type != 'table' and !file.instance_of? File\n file = File.open(file)\n end\n begin\n resource_name = resource_name || File.basename(file)\n res = ODPS.conn.post do |req|\n req.url \"projects/#{ODPS.current_project}/resources\"\n req.headers['x-odps-resource-type'] = type\n req.headers['x-odps-resource-name'] = resource_name\n req.headers['x-odps-comment'] = comment if comment\n req.headers['Content-Type'] = 'text/plain'\n if type == 'table'\n req.headers['x-odps-copy-table-source'] = file\n else\n req.body = file.read\n end\n end\n rescue Exception, e\n AliODPS::LOGGER.error \"Open file error!#{$!}@#{$@}\"\n ensure\n file.close unless type == 'table'\n end\n\n resource = Resource.new\n if res.status == 201\n resource.comment = comment\n resource.file_source = res['Location']\n resource.name = resource_name\n end\n resource\n end",
"def create_resource(authorization, \n create_resource_body = nil)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/resources/new'\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.post _query_url, headers: _headers, parameters: create_resource_body.to_json\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 422\n raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return CreateResourceResponse.from_hash(decoded)\n end",
"def new(options = {}, &block)\n respond_with(build_resource, options, &block)\n end",
"def create\n @resource = current_user.resources.build(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n instance_variable_set(resource, @model.new(resource_params))\n\n yield if block_given?\n\n respond_to do |format|\n if instance_variable_get(resource).save\n format.html { redirect_to action: :index, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: resource_location }\n after_create\n else\n format.html { render :new }\n format.json do\n render json: instance_variable_get(resource).errors.as_json(full_messages: true),\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n existing_resource = Resource.find_by_url(params[:resource][:url])\n if existing_resource\n flash[:notice] = \"That resource has already been added, but please give it a review!\"\n redirect_to resource_path(existing_resource) and return\n end\n @resource = Resource.new(params[:resource])\n @resource.contributor = current_user\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to(@resource, :notice => 'Resource was successfully created.') }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @asset = Resource.new(resource_params)\n \n if @asset.save\n redirect_to admin_resource_path(@asset), notice: 'Resource was successfully created.'\n else\n render action: 'new'\n end\n end",
"def create_created\n controller.create_created(resource: resource)\n end",
"def create\n event = Connection::Events::Create.from_jsonapi(params, self)\n result = event.handle\n render_resource_created_event result[:validation], result[:result]\n end",
"def create(context)\n context.request.body.rewind # in case someone already read it\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n begin\n instance_variable_set(:\"@#{resource_name}\", resource_name.classify.constantize.new(permitted_params))\n\n if instance_variable_get(:\"@#{resource_name}\").save\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end",
"def create\n @resource = current_admin.resources.new(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resource = Resource.new(params[:resource])\n @resource.campaign_id = session[:campaign_id]\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, :notice => 'Resource was successfully created.' }\n format.json { render :json => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(params={})\n raise '`create` method is not supported for this resource.'\n end",
"def create(params={})\n raise '`create` method is not supported for this resource.'\n end",
"def create(params={})\n raise '`create` method is not supported for this resource.'\n end",
"def create(params={})\n raise '`create` method is not supported for this resource.'\n end",
"def create\n @resource = Resource.new(resource_params)\n @resource.active = true\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @resource = Resource.new(resource_params)\n @myWorld = World.where(:title => @user[:email])\n worldID = @myWorld[0].id\n @resource.user_id = @user.id\n @resource.date_published = Date.today\n respond_to do |format|\n if @resource.save\n invoke(\"Resource created: \" + @resource.title, @user[:email], \"admin\", worldID.to_s)\n # puts(\"Resource created: \" + @resource.title, @user[:email], \"admin\", worldID)\n format.html { redirect_to :root, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n debug \"Call: create on cs_resource '#{@resource[:name]}'\"\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive_class => @resource[:primitive_class],\n :provided_by => @resource[:provided_by],\n :primitive_type => @resource[:primitive_type],\n :complex_type => @resource[:complex_type],\n }\n @property_hash[:parameters] = @resource[:parameters] if @resource[:parameters]\n @property_hash[:operations] = @resource[:operations] if @resource[:operations]\n @property_hash[:metadata] = @resource[:metadata] if @resource[:metadata]\n @property_hash[:ms_metadata] = @resource[:ms_metadata] if @resource[:ms_metadata]\n @property_hash[:cib] = @resource[:cib] if @resource[:cib]\n end",
"def create\n @resource = Resource.new(params[:resource])\n if current_user\n @resource.resourceable_type = current_user.class.name\n @resource.resourceable_id = current_user.id\n else\n @resource.resourceable_type = current_instructor.class.name\n @resource.resourceable_id = current_instructor.id\n end\n \n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n first: @resource[:first],\n second: @resource[:second],\n kind: @resource[:kind],\n symmetrical: @resource[:symmetrical],\n new: true\n }\n end",
"def create(body: nil)\n perform(:post, @resource_type.to_s, body)\n end",
"def create_resource id, url, hash\n # TODO\n page = resource_page id\n if is_url? url\n create_new_archive page, url, hash\n end\n content = 'TODO'\n write! page, content\n end",
"def create(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n location = client.post(path, headers: headers, body: body).headers['Location']\n Resource.new(name: name, resource_type: type, comment: options['comment'], location: location)\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n clone_max: @resource[:clone_max],\n clone_node_max: @resource[:clone_node_max],\n notify_clones: @resource[:notify_clones],\n globally_unique: @resource[:globally_unique],\n ordered: @resource[:ordered],\n interleave: @resource[:interleave],\n cib: @resource[:cib],\n existing_resource: :false\n }\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create_resource(resource_descr, type_to_create, authorizer)\n debug \"central create_resource: resource '#{resource_descr.inspect}' type: '#{resource_type}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def create\n @resource = Resource.new(params[:resource])\n respond_to do |format|\n if @resource.save\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n get_resource_types\n format.html { render action: :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_resource = Api::V1::Resource.new(api_v1_resource_params)\n\n respond_to do |format|\n if @api_v1_resource.save\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_resource }\n else\n format.html { render :new }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def construct_new_resource(response)\n data = JSON.parse(response.body, symbolize_names: true)\n new(data)\n end",
"def create\n @temp_resource = TempResource.new(temp_resource_params)\n\n respond_to do |format|\n if @temp_resource.save\n format.html { redirect_to @temp_resource, notice: 'Temp resource was successfully created.' }\n format.json { render :show, status: :created, location: @temp_resource }\n else\n format.html { render :new }\n format.json { render json: @temp_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cloud_resource = CloudResource.new(cloud_resource_params)\n\n respond_to do |format|\n if @cloud_resource.save\n format.html { redirect_to @cloud_resource, notice: 'Cloud resource was successfully created.' }\n format.json { render :show, status: :created, location: @cloud_resource }\n else\n format.html { render :new }\n format.json { render json: @cloud_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end",
"def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n\n # New resource creation method, pass through the model\n begin\n model_obj = eval(\"OMF::SFA::Model::#{type_to_create}\")\n if model_obj.respond_to?(:handle_rest_resource_creation)\n resource = model_obj.handle_rest_resource_creation(resource_descr, authorizer, get_scheduler)\n return resource\n end\n rescue => ex\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Problem to create the resource. Reason: #{ex.reason}\"\n end\n\n debug \"Resource '#{type_to_create}' doesn't have the handle_rest_resource_creation method, proceeding with the default creation proccess...\"\n\n authorizer.can_create_resource?(resource_descr, type_to_create)\n resource = nil\n if resource_descr.kind_of? Array\n descr = []\n resource_descr.each do |res|\n res_descr = {}\n res_descr.merge!({uuid: res[:uuid]}) if res.has_key?(:uuid)\n res_descr.merge!({name: res[:name]}) if res.has_key?(:name)\n descr << res_descr unless eval(\"OMF::SFA::Model::#{type_to_create}\").first(res_descr)\n end\n raise OMF::SFA::AM::Rest::BadRequestException.new \"No resources described in description #{resource_descr} is valid. Maybe all the resources alreadt=y exist.\" if descr.empty?\n elsif resource_descr.kind_of? Hash\n descr = {}\n descr.merge!({uuid: resource_descr[:uuid]}) if resource_descr.has_key?(:uuid)\n descr.merge!({name: resource_descr[:name]}) if resource_descr.has_key?(:name)\n descr.merge!({urn: resource_descr[:urn]}) if resource_descr.has_key?(:urn)\n\n if descr.empty?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is '#{resource_descr}'.\"\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource with descr '#{descr} already exists'.\" if eval(\"OMF::SFA::Model::#{type_to_create}\").first(descr)\n end\n end\n\n if resource_descr.kind_of? Array\n resource = []\n resource_descr.each do |res_desc|\n resource << eval(\"OMF::SFA::Model::#{type_to_create}\").create(res_desc)\n manage_resource(resource.last) if resource.last.account.nil?\n if type_to_create == 'Account'\n @liaison.create_account(resource.last)\n end\n end\n elsif resource_descr.kind_of? Hash\n begin\n resource = eval(\"OMF::SFA::Model::#{type_to_create}\").create(resource_descr)\n rescue => ex\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is invalid: #{ex.to_s}\"\n end\n manage_resource(resource) if resource.class.can_be_managed?\n if type_to_create == 'Account'\n @liaison.create_account(resource)\n end\n end\n resource\n end",
"def create(type, opts = nil)\n proxy_info = OmfRc::ResourceFactory.proxy_list[type]\n if proxy_info && proxy_info.create_by && !proxy_info.create_by.include?(self.type.to_sym)\n raise StandardError, \"Resource #{type} is not designed to be created by #{self.type}\"\n end\n\n before_create(type, opts) if respond_to? :before_create\n new_resource = OmfRc::ResourceFactory.new(type.to_sym, opts, @comm)\n after_create(new_resource) if respond_to? :after_create\n children << new_resource\n new_resource\n end",
"def create_resource_with_http_info(resource, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.create_resource ...'\n end\n # verify the required parameter 'resource' is set\n if @api_client.config.client_side_validation && resource.nil?\n fail ArgumentError, \"Missing the required parameter 'resource' when calling ResourcesApi.create_resource\"\n end\n # resource path\n local_var_path = '/resource_set'\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(resource) \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse200' \n\n # auth_names\n auth_names = opts[:auth_names] || ['token_auth']\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#create_resource\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @admin_resource = AdminResource.new(admin_resource_params)\n\n respond_to do |format|\n if @admin_resource.save\n format.html { redirect_to @admin_resource, notice: 'Admin resource was successfully created.' }\n format.json { render :show, status: :created, location: @admin_resource }\n else\n format.html { render :new }\n format.json { render json: @admin_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(options = {}, &block)\n object = get_resource_ivar || create_resource\n\n options[:location] = collection_path if object.errors.empty?\n\n respond_with_dual(object, options, &block)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def create(resource_uri = nil)\n create_rdf resource_uri\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end"
] | [
"0.762519",
"0.755148",
"0.7535406",
"0.74369746",
"0.74257165",
"0.7417434",
"0.7379857",
"0.73388016",
"0.7309319",
"0.72849506",
"0.72480965",
"0.72105575",
"0.7192749",
"0.717456",
"0.7119396",
"0.7067439",
"0.70616174",
"0.70416933",
"0.701883",
"0.70005614",
"0.6995206",
"0.6994802",
"0.69915694",
"0.69584125",
"0.69470537",
"0.69453645",
"0.6902645",
"0.6899394",
"0.6886935",
"0.6878001",
"0.68524164",
"0.6836837",
"0.68102324",
"0.6799933",
"0.67778814",
"0.67771655",
"0.6776651",
"0.6750896",
"0.6710435",
"0.67044955",
"0.6648334",
"0.6632796",
"0.66275984",
"0.6602448",
"0.65913516",
"0.6587814",
"0.6576243",
"0.6575843",
"0.6568927",
"0.65681756",
"0.6557884",
"0.6556869",
"0.65520364",
"0.6543502",
"0.6539602",
"0.6528853",
"0.64820725",
"0.64787656",
"0.6470057",
"0.6470057",
"0.6470057",
"0.6470057",
"0.6456764",
"0.6446114",
"0.64391714",
"0.6419481",
"0.64010024",
"0.6400735",
"0.6393472",
"0.6388765",
"0.6373765",
"0.63706464",
"0.63489926",
"0.63489926",
"0.63489926",
"0.63489926",
"0.6336103",
"0.632111",
"0.63151073",
"0.63108754",
"0.6309727",
"0.62882024",
"0.62837225",
"0.6280608",
"0.62772256",
"0.6276837",
"0.6272785",
"0.6266811",
"0.62658983",
"0.6249292",
"0.6249292",
"0.6233531",
"0.6231383",
"0.6231383",
"0.6231383",
"0.6231383",
"0.6231383",
"0.6231383",
"0.6231383",
"0.6231383",
"0.6231383"
] | 0.0 | -1 |
Deploys a compute resource based on an OVF/OVA descriptor available on a local file system. | def deploy(location)
media_types = self.class.head(@endpoint).headers['accept'].to_s
raise "File #{location} does not exist" unless File.exist? location
file = File.read(location)
if location.include? '.ovf'
if media_types.include? 'application/ovf'
headers = self.class.headers.clone
headers['Content-Type'] = 'application/ovf'
self.class.post(@endpoint + '/compute/',
:body => file,
:headers => headers)
end
elsif location.include? '.ova'
if media_types.include? ' application/ova '
headers = self.class.headers.clone
headers['Content-Type'] = 'application/ova'
self.class.post(@endpoint + '/compute/',
:body => file,
:headers => headers)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend",
"def deploy_ovf\n vm_name = resource[:name]\n ovf_url = resource[:ovf_url]\n dc = vim.serviceInstance.find_datacenter(resource[:datacenter])\n datastore = dc.find_datastore(resource[:datastore])\n cluster = dc.find_compute_resource(resource[:cluster])\n if resource[:ovf_property_map] && !resource[:ovf_property_map].empty?\n ovf_property_map = resource[:ovf_property_map]\n else\n ovf_property_map = {}\n end\n Puppet.debug(\"ovf_property_map: %s\" % ovf_property_map)\n raise(\"Could not find datacenter, datastore, or cluster\") unless dc && datastore && cluster\n\n Puppet.debug(\"Deploying vm %s, to datacenter: %s and cluster: %s and datastore: %s\" % [vm_name.to_s, dc.name, cluster.name, datastore.name])\n\n # Use root vm folder for deployment if no folder passed in as input\n root_vm_folder = dc.vmFolder\n vm_folder = root_vm_folder\n if resource[:vm_folder_path]\n vm_folder = root_vm_folder.traverse(resource[:vm_folder_path], VIM::Folder)\n raise(\"Could not find VM folder: %s\" % resource[:vm_folder_path])\n end\n Puppet.debug(\"Using vm folder: %s\" % vm_folder.name)\n\n # Find host associated with the target datastore for this VM\n host = host_from_datastore(datastore, cluster)\n Puppet.debug(\"Deploying vm: %s to host: %s\" % [vm_name.to_s, host.name.to_s])\n vm = nil\n begin\n vm = vim.serviceContent.ovfManager.deployOVF(\n uri: ovf_url,\n vmName: vm_name,\n vmFolder: vm_folder,\n host: host,\n resourcePool: cluster.resourcePool,\n datastore: datastore,\n networkMappings: network_mappings(ovf_url, cluster),\n propertyMappings: ovf_property_map)\n rescue RbVmomi::Fault => fault\n Puppet.debug(\"Failure during OVF deployment for vm: %s with error %s: %s\" % [vm_name.to_s, $!.to_s, $!.class])\n raise\n end\n\n if resource[:memory_mb] || resource[:num_cpus]\n vm_memory_cpu_scsi_for_svm(vm, resource[:memory_mb], resource[:num_cpus]) if vm\n Puppet.warn(\"Could not configure CPU and memory for VM: %s because virtual machine creation failed.\" % vm_name) unless vm\n end\n\n # We only reconfigure the the guestid in nvdimm case. In other scenarios we should just use the existing guestid\n # which is set in the OVF. \n if resource[:guest_type] && resource[:guestid] && resource[:enable_nvdimm]\n vm_guest_os(vm, resource[:guest_type], resource[:guestid])\n end\n\n if resource[:version]\n vm_version_upgrade(vm, resource[:version])\n end\n\n power_state = resource[:power_state].to_sym\n end",
"def action_create\n\n install_prerequisites\n\n node.set['pedant'][new_resource.variant]['etc_dir'] = new_resource.config_dir\n\n directory new_resource.config_dir do\n owner new_resource.user\n group new_resource.group\n mode \"0755\"\n recursive true\n end\n\n source_dir = \"#{new_resource.checkout_dir}/#{new_resource.variant}\"\n\n git new_resource.variant do\n destination source_dir\n repository \"git@github.com:opscode/#{new_resource.variant}.git\"\n revision new_resource.revision\n user new_resource.git_user\n end\n\n node.set['pedant'][new_resource.variant]['dir'] = \"/srv/#{new_resource.variant}\"\n\n link node['pedant'][new_resource.variant]['dir'] do\n to source_dir\n end\n\n template \"#{new_resource.config_dir}/pedant_config.rb\" do\n source new_resource.config_template\n owner new_resource.user\n group new_resource.group\n mode \"0644\"\n variables(new_resource.variables)\n end\n\n execute \"bundle install\" do\n cwd node['pedant'][new_resource.variant]['dir']\n # user \"opscode\"\n end\n\nend",
"def install_custom!\n remote_file local_path do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n dpkg_package local_path\n end",
"def create\n deploy\n end",
"def deploy(id, host, remote_dfile, not_used)\n local_dfile = get_local_deployment_file(remote_dfile)\n\n if !local_dfile || File.zero?(local_dfile)\n send_message(ACTION[:deploy],RESULT[:failure],id,\n \"Can not open deployment file #{local_dfile}\")\n return\n end\n \n local_action(\"#{@actions_path}/deploy #{host} #{local_dfile}\",id,:deploy)\n end",
"def create\n if @resource[:grow_fs] == :true\n fstabentry\n growfs\n mountfs\n else\n createfs()\n fstabentry\n mountfs\n end\n end",
"def action_deploy\n notifying_block do\n directory new_resource.path do\n owner new_resource.owner\n group new_resource.group\n mode '755'\n end\n end\n end",
"def deploy\n @operation = \"Deploy\"\n build_env = project[:build_env] || \"\"\n\n prepare_local_dir do\n run_cmd \"cap -q deploy #{build_env}\"\n run_cmd \"cap -q deploy:migrate #{build_env}\"\n run_cmd \"cap -q deploy:cleanup #{build_env}\"\n end\n end",
"def create\n name = @resource[:name]\n client = Savon.client(wsdl: @resource[:connection]['url'] + WSDL_PATH)\n\n environment = @resource[:environment]\n custom_props = @resource[:properties]\n dynamic_props = @resource[:dynamic_properties]\n\n raise Puppet::Error, \"Target name, folder, owner and type must not be empty!\" if empty_str?(name) or empty_str?(@resource[:folder]) or empty_str?(@resource[:owner]) or empty_str?(@resource[:type])\n\n self.info(\"Importing deployment target..\")\n \n doc = REXML::Document.new '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n root = doc.add_element 'Sync', { \"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\" }\n entity = root.add_element \"Entity\", { \"mainType\" => \"DeploymentTarget\", \"customType\" => @resource[:type] }\n \n prop_hash = { \"system_name\" => name, \"system_owner.system_name\" => @resource[:owner], \"system_folder.system_name\" => @resource[:folder], \"system_deployment_agent_name\" => @resource[:agent],\n \"system_description\" => \"created via Automic Puppet resource type\", \"system_is_active\" => \"true\" }\n\n prop_hash.keys.each do |prk|\n prop_ele = entity.add_element \"Property\", { \"name\" => prk }\n if prk == 'system_name'\n prop_ele.add_attribute \"isIdentity\", \"true\"\n end\n value_ele = prop_ele.add_element \"Value\"\n value_ele.add_text prop_hash[prk]\n end\n\n if not custom_props.nil? and not custom_props.empty?\n # add custom properties\n custom_props.keys.each do |prk|\n prop_ele = entity.add_element \"Property\", { \"name\" => prk }\n value_ele = prop_ele.add_element \"Value\"\n value_ele.add_text custom_props[prk]\n end\n end\n \n message = { \"username\" => @resource[:connection]['username'], \"password\" => @resource[:connection]['password'], \"mainType\" => \"DeploymentTarget\", \"failOnError\" => true, \"fomat\" => \"XML\", \"data\" => doc.to_s }\n \n response = client.call(:import, message: message)\n\n # check error and status\n status = response.body[:import_response][:import_result][:status].to_i \n token = response.body[:import_response][:import_result][:token]\n\n self.debug(\"Got token: #{token}\")\n \n # wait for target id return in status\n while status == 0\n sleep 1\n response = client.call(:get_status, message: { \"token\" => token } )\n status = response.body[:get_status_response][:get_status_result][:status].to_i \n end\n\n if status < 0\n self.info(\"Unsuccessfully create or update deployment target\")\n error = response.body[:get_status_response][:get_status_result][:error] \n if not error.nil? and not error.empty?\n self.info(\"Error detail: \" + error.to_s)\n end\n return status\n end\n\n self.info(\"Deployment target import successfully\")\n \n # add environment\n if not environment.nil? and not environment.empty?\n begin\n env_id = get_environment_id(client, environment)\n if (env_id > 0)\n add_environment_relation(client, env_id, name)\n end\n rescue Exception => e\n self.info(\"Error occurred while updating environment for deployment target\") \n self.debug(e.message)\n self.debug(e.backtrace.inspect)\n end\n end \n\n # update dynamic properties\n if not dynamic_props.nil? and not dynamic_props.empty?\n begin\n update_dynamic_properties(client, status, dynamic_props)\n rescue Exception => e\n self.info(\"Error occurred while updating dynamic properties for deployment target\") \n self.debug(e.message)\n self.debug(e.backtrace.inspect)\n end\n end\n\n return status\n end",
"def add_post_deploy_resources\n if new_resource.precompile_assets\n app_local = app\n username = user_username\n ruby_block 'precompile assests' do\n block do\n require 'bundler'\n bundle_precompile_command = \"sudo su - #{username} -c 'cd #{app_local.release_path} \"\\\n \"&& source ./.env && #{app_local.bundle_binary} exec rake #{new_resource.precompile_command}'\"\n\n Bundler.clean_system(bundle_precompile_command)\n raise('Bundle pre-compile failed') unless $CHILD_STATUS.exitstatus.zero?\n end\n action :nothing\n subscribes :run, \"deploy_revision[#{new_resource.name}]\", :immediate\n end\n end\n\n super\n end",
"def deploy_remote_sdfile(application_package, sd_filename, params={})\n remotehost = hostlist.first\n proxy = @vespa.nodeproxies[remotehost]\n content = proxy.readfile(sd_filename)\n local_sdfilename = selfdir+File.basename(sd_filename)\n File.open(local_sdfilename, \"w\") do |file|\n file.write(content)\n end\n deploy(application_package, local_sdfilename, params)\n FileUtils.rm_rf(local_sdfilename)\n end",
"def install_apply\n namespace nsprefix do\n desc 'Apply a terraform plan that will provision your resources; ' \\\n 'specify optional CSV targets'\n task :apply, [:target] => [\n :\"#{nsprefix}:init\",\n :\"#{nsprefix}:write_tf_vars\",\n :\"#{nsprefix}:plan\"\n ] do |t, args|\n @before_proc.call(t.name, @tf_dir) unless @before_proc.nil?\n cmd_arr = %w[terraform apply]\n cmd_arr << '-auto-approve' if tf_version >= Gem::Version.new('0.10.0')\n cmd_arr << \"-var-file #{var_file_path}\"\n cmd = cmd_with_targets(\n cmd_arr,\n args[:target],\n args.extras\n )\n terraform_runner(cmd)\n\n update_consul_stack_env_vars unless @consul_env_vars_prefix.nil?\n @after_proc.call(t.name, @tf_dir) unless @after_proc.nil?\n end\n end\n end",
"def create_resource(env)\n env[:ui].info(\"Creating machine\")\n\n config = env[:machine].provider_config\n vra = env[:vra]\n\n EntitledItemsCollection.fetch(env[:vra])\n .find_by_id(config.catalog_item_id)\n .request(cpus: config.cpus,\n memory: config.memory,\n requested_for: config.requested_for,\n subtenant_id: config.subtenant_id,\n lease_days: config.lease_days) { |req|\n config.extra_entries.types.each do |type|\n config.extra_entries.of_type(type).each do |k,v|\n req.set_parameter(k, type, v)\n end\n end\n }\n .join\n .machine\n end",
"def remote_file_resource\n Chef::Log.info \"Remote file: #{file_location}\"\n Chef::Log.info \"Local file: #{new_resource.name}\"\n @remote_file_resource ||= remote_file new_resource.name do\n source file_location\n checksum new_resource.checksum if !new_resource.checksum.nil?\n owner new_resource.owner\n group new_resource.group\n backup false\n action :nothing\n end\nend",
"def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end",
"def deploy(id, host, remote_dfile, not_used)\n\n local_dfile = get_local_deployment_file(remote_dfile)\n\n if !local_dfile || File.zero?(local_dfile)\n send_message(ACTION[:deploy],RESULT[:failure],id,\n \"Can not open deployment file #{local_dfile}\")\n return\n end\n\n tmp = File.new(local_dfile)\n domain = tmp.read\n tmp.close()\n\n images_path = File.dirname remote_dfile\n cmd = \"mkdir -p #{images_path} && cat > #{remote_dfile} && \" \\\n \"#{LIBVIRT[:create]} #{remote_dfile}\"\n\n deploy_exe = SSHCommand.run(\"'#{cmd}'\", host, log_method(id), domain)\n\n if deploy_exe.code != 0\n send_message(ACTION[:deploy],RESULT[:failure],id)\n elsif deploy_exe.stdout.match(/^Domain (.*) created from .*$/)\n send_message(ACTION[:deploy],RESULT[:success],id,$1)\n else\n send_message(ACTION[:deploy],RESULT[:failure],id,\n \"Domain id not found in #{LIBVIRT[:create]} output.\")\n end\n end",
"def deploy(id, host, remote_dfile, not_used)\n error = \"Action not implemented by driver #{self.class}\"\n send_message(ACTION[:deploy],RESULT[:failure],id,error)\n end",
"def perform\n validate_system_config\n\n deployment_name = \"#{system_config.system_name}-core\"\n\n manifest = base_manifest(\n deployment_name,\n bosh_config.target_uuid,\n system_config.bosh_provider,\n system_config.system_name,\n system_config.release_name,\n system_config.release_version,\n system_config.stemcell_name,\n system_config.stemcell_version,\n cloud_properties_for_server_flavor(system_config.core_server_flavor),\n system_config.core_ip,\n system_config.root_dns,\n system_config.admin_emails,\n system_config.common_password,\n system_config.common_persistent_disk,\n system_config.security_group\n )\n\n dea_config.build_into_manifest(manifest)\n system_config.services.each do |service_config|\n service_config.build_into_manifest(manifest)\n end\n\n chdir system_config.system_dir do\n mkdir_p(\"deployments\")\n File.open(\"deployments/#{system_config.system_name}-core.yml\", \"w\") do |file|\n file << manifest.to_yaml\n end\n end\n end",
"def create\n tmp = Puppet::FileSystem::Uniquefile.new('quobyte_volume_config')\n tmp.write(resource[:content])\n tmp.flush()\n\n qmgmt(['volume', 'config', 'import', [resource[:name]], tmp.path])\n end",
"def post_provision_configure\n add_stack_to_resource\n link_orchestration_template\n assign_vms_owner\n apply_provisioning_tags\n end",
"def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end",
"def deploy(open_vz_data, container)\n OpenNebula.log_debug(\"Deploying vm #{open_vz_data.vmid} using ctid:#{container.ctid}\")\n\n # create symlink to enable ovz to find image\n template_name = container.ctid\n template_cache = create_template template_name, open_vz_data.disk\n\n # options to be passed to vzctl create\n options = process_options open_vz_data.raw, {:ostemplate => template_name}\n\n # create and run container\n container.create( options )\n container.start\n\n # set up networking\n apply_network_settings container, open_vz_data.networking\n\n # and contextualise it\n contextualise container, open_vz_data.context_disk, open_vz_data.context\n \n container.ctid\n rescue RuntimeError => e\n raise OpenVzDriverError, \"Container #{container.ctid} can't be deployed. Details: #{e.message}\"\n ensure\n # cleanup template cache - we don't need it anymore\n File.delete template_cache if template_cache and File.exists? template_cache\n end",
"def create_deployment_file(host, provision_id, provision_name)\n ssh_key = try_read_file(host['connection']['public_key'])\n config = Base64.strict_encode64(host['configuration'].to_yaml)\n\n Nokogiri::XML::Builder.new do |xml|\n xml.HOST do\n xml.NAME \"provision-#{SecureRandom.hex(24)}\"\n xml.TEMPLATE do\n xml.IM_MAD host['im_mad']\n xml.VM_MAD host['vm_mad']\n xml.PM_MAD host['provision']['driver']\n xml.PROVISION do\n host['provision'].each do |key, value|\n if key != 'driver'\n xml.send(key.upcase, value)\n end\n end\n xml.send('PROVISION_ID', provision_id)\n xml.send('NAME', provision_name)\n end\n if host['configuration']\n xml.PROVISION_CONFIGURATION_BASE64 config\n end\n xml.PROVISION_CONFIGURATION_STATUS 'pending'\n if host['connection']\n xml.PROVISION_CONNECTION do\n host['connection'].each do |key, value|\n xml.send(key.upcase, value)\n end\n end\n end\n if host['connection']\n xml.CONTEXT do\n if host['connection']['public_key']\n xml.SSH_PUBLIC_KEY ssh_key\n end\n end\n end\n end\n end\n end.doc.root\n end",
"def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend",
"def deploy\n cmd = \"deploy #{@resource[:source]} --name=#{@resource[:name]}#{runtime_name_param_with_space_or_empty_string}\"\n if @resource[:runasdomain]\n cmd = append_groups_to_cmd(cmd, @resource[:servergroups])\n end\n cmd = \"#{cmd} --force\" if force_deploy?\n display_lines 100\n bring_up 'Deployment', cmd\n @resource[:name]\n end",
"def deploy_generated(applicationbuffer, sdfile=nil, params={}, hostsbuffer=nil, deploymentbuffer=nil, validation_overridesbuffer=nil)\n @vespa.deploy_generated(applicationbuffer, sdfile, params, hostsbuffer, deploymentbuffer, validation_overridesbuffer)\n end",
"def create_service_files(current_resource, new_resource)\n service_name = get_service_name(new_resource)\n\n template_variables = ({\n \"dashboard_name\" => get_dashboard_name(new_resource),\n \"dashboard_path\" => new_resource.path,\n \"dashboard_port\" => new_resource.port,\n \"service_name\" => service_name,\n \"ruby_version\" => node[\"dashing\"][\"ruby_version\"]\n })\n\n # If the resource's service_type is changing, then delete the old script.\n if get_service_script_name(current_resource) != nil\n file get_service_script_name(current_resource) do\n action :delete\n only_if {current_resource.service_type != new_resource.service_type}\n end\n end\n\n # Create the new startup script.\n case new_resource.service_type\n when \"upstart\"\n template \"/etc/init/#{service_name}.conf\" do\n cookbook \"dashing\"\n source \"upstart-dashboard.conf.erb\"\n mode 0644\n owner \"root\"\n group \"root\"\n variables template_variables\n notifies :enable, \"service[#{service_name}]\"\n notifies :restart, \"service[#{service_name}]\"\n end\n when \"init.d\"\n template \"/etc/init.d/#{service_name}\" do\n cookbook \"dashing\"\n source node['dashing']['init_source']\n mode 0755\n owner \"root\"\n group \"root\"\n variables template_variables\n notifies :enable, \"service[#{service_name}]\"\n notifies :restart, \"service[#{service_name}]\"\n end\n else\n raise \"dashing: Unknown service_type '#{rnew_resource.service_type}'\"\n end\nend",
"def download_distribution(src, dst)\n remote_file = Chef::Resource::RemoteFile.new(\n dst,\n run_context\n )\n remote_file.owner('root')\n remote_file.group('root')\n remote_file.source(src)\n remote_file.mode('0644')\n remote_file.backup(false)\n\n remote_file.run_action(:create)\n\n Chef::Log.debug(\"remote_file.source: #{remote_file.source}\")\n Chef::Log.debug(\"remote_file.path: #{remote_file.path}\")\n Chef::Log.debug(\"remote_file.atomic_update : #{remote_file.atomic_update}\")\n Chef::Log.debug(\"remote_file.checksum : #{remote_file.checksum}\")\n\n # Returning downloaded file checksum\n md5sum(dst)\n end",
"def gen_pv\n pv_name = \"pv-#{gen_uuid}\"\n file = \"#{$templates_path}/#{pv_name}.yaml\"\n File.open(file, 'w') do |f|\n f.puts <<-PV\nkind: PersistentVolume\napiVersion: v1\nmetadata:\n name: #{pv_name}\nspec:\n capacity:\n storage: 1Gi\n accessModes:\n - ReadWriteOnce\n nfs:\n path: \"/\"\n server: \"10.1.1.1\"\n persistentVolumeReclaimPolicy: \"Retain\"\nPV\n end\n\n `oc create -f #{file}`\nend",
"def fetch_and_deploy_from local_filename\n if local_filename.end_with?('.tsv')\n logger.info \"Deploying contents of config file: #{local_filename}\"\n process_config_file local_filename\n\n elsif local_filename.end_with?('.gz')\n Chef::Log.info \"Deploying R package: #{local_filename}\"\n execute \"install custom R package #{local_filename}\" do\n command \"R CMD INSTALL #{local_filename}\"\n end\n\n elsif local_filename.end_with?('.deb')\n Chef::Log.info \"Deploying Debian package: #{local_filename}\"\n package_base = Regexp.new(\".*/([^/]+)_([^_/]+)\\.deb$\").match(local_filename)[1]\n dpkg_package \"#{package_base}\" do\n action :install\n source local_filename\n end\n end\n end",
"def post_compute(request)\n # --- Create the new Instance ---\n vm = VirtualMachineOCCI.new(\n VirtualMachine.build_xml,\n @client,\n request.body.read,\n @config[:instance_types],\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = vm.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = vm.allocate(template)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n vm.info\n return to_occi_xml(vm, :code=>201)\n end",
"def upload_image(extract_path, packaged_files)\n image_service = Fog::Image.new({\n :provider => 'OpenStack',\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n })\n\n aki = \"#{extract_path}/#{packaged_files.find{|x| x =~ /vmlinuz$/}}\"\n ami = \"#{extract_path}/#{packaged_files.find{|x| x =~ /\\.img$/}}\"\n ari = \"#{extract_path}/#{packaged_files.find{|x| x =~ /initrd$/}}\"\n\n @log.info 'Uploding AKI ...'\n aki = image_service.images.create :name => \"#{File.basename(aki, '-vmlinuz')}-aki\",\n :size => File.size(aki),\n :disk_format => 'aki',\n :container_format => 'aki',\n :location => aki\n @log.info 'Uploading ARI ...'\n ari = image_service.images.create :name => \"#{File.basename(ari, '-initrd')}-ari\",\n :size => File.size(ari),\n :disk_format => 'ari',\n :container_format => 'ari',\n :location => ari\n @log.info 'Uploading AMI ...'\n image_service.images.create :name => \"#{File.basename(ari, '-initrd')}\",\n :size => File.size(ami),\n :disk_format => 'ami',\n :container_format => 'ami',\n :location => ami,\n :properties => {\n 'kernel_id' => aki.id,\n 'ramdisk_id' => ari.id\n }\n end",
"def put_compute(request, params)\n # --- Get the VM ---\n vm = VirtualMachineOCCI.new(\n VirtualMachine.build_xml(params[:id]),\n @client)\n\n rc = vm.info\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n result, code = vm.update_from_xml(request.body)\n\n if OpenNebula.is_error?(result)\n return result, code\n else\n vm.info\n return to_occi_xml(vm, :code=>code)\n end\n end",
"def deploy_app(app, deploy_params = {})\n deploy_generated(app.services_xml, app.sd_files,\n deploy_params.merge(app.deploy_params), app.hosts_xml, nil, app.validation_overrides_xml)\n end",
"def deploy(id, host, xml_text, lcm_state, deploy_id)\n # Restore if we need to\n if lcm_state != \"BOOT\" && lcm_state != \"BOOT_FAILURE\"\n restore(deploy_id)\n return deploy_id\n end\n\n # Otherwise deploy the VM\n\n begin\n ec2_info = get_deployment_info(host, xml_text)\n rescue Exception => e\n raise e\n end\n\n load_default_template_values\n\n if !ec2_value(ec2_info, 'AMI')\n raise \"Cannot find AMI in deployment file\"\n end\n\n opts = generate_options(:run, ec2_info, {\n :min_count => 1,\n :max_count => 1})\n\n # The OpenNebula context will be only included if not USERDATA\n # is provided by the user\n if !ec2_value(ec2_info, 'USERDATA')\n xml = OpenNebula::XMLElement.new\n xml.initialize_xml(xml_text, @provision_type == :host ? 'HOST' : 'VM')\n\n if xml.has_elements?('TEMPLATE/CONTEXT')\n # if requested, we generated cloud-init compatible data\n if ec2_value(ec2_info, 'CLOUD_INIT') =~ /^(yes|true)$/i\n context_str = generate_cc(xml, 'TEMPLATE/CONTEXT')\n else\n # Since there is only 1 level ',' will not be added\n context_str = xml.template_like_str('TEMPLATE/CONTEXT')\n\n if xml['TEMPLATE/CONTEXT/TOKEN'] == 'YES'\n # TODO use OneGate library\n token_str = generate_onegate_token(xml)\n if token_str\n context_str << \"\\nONEGATE_TOKEN=\\\"#{token_str}\\\"\"\n end\n end\n end\n\n userdata_key = EC2[:run][:args][\"USERDATA\"][:opt]\n opts[userdata_key] = Base64.encode64(context_str)\n end\n end\n\n instances = @ec2.create_instances(opts)\n instance = instances.first\n\n start_time = Time.now\n\n while Time.now - start_time < @state_change_timeout\n begin\n break if instance.exists?\n rescue => e\n OpenNebula::log_error(\"RESCUE: #{e.inspect}\")\n end\n\n sleep 2\n end\n\n tags = generate_options(:tags, ec2_info)[:tags] || {}\n\n tag_array = []\n tags.each{ |key,value|\n tag_array << {\n :key => key,\n :value => value\n }\n }\n\n instance.create_tags(:tags => tag_array) if tag_array.length > 0\n\n elastic_ip = ec2_value(ec2_info, 'ELASTICIP')\n\n wait_state('running', instance.id)\n\n if elastic_ip\n\n if elastic_ip.match(Resolv::IPv4::Regex)\n address_key = :public_ip\n else\n address_key = :allocation_id\n end\n\n address = {\n :instance_id => instance.id,\n address_key => elastic_ip\n }\n\n @ec2.client.associate_address(address)\n end\n\n if @provision_type == :host\n instance.create_tags(tags: [{\n key: 'Name',\n value: host['//HOST/TEMPLATE/PROVISION/HOSTNAME']\n },{\n key: 'ONE_HOST_ID',\n value: 'TODO'\n }])\n else\n instance.create_tags(tags: [{\n key: 'ONE_ID',\n value: id\n }])\n end\n\n puts(instance.id)\n end",
"def deploy(id, host, xml_text, lcm_state, deploy_id)\n if %w[BOOT BOOT_FAILURE].include? lcm_state\n one_info = get_deployment_info(host, xml_text)\n\n # load_default_template_values\n\n tid = one_value(one_info, 'TEMPLATE_ID')\n\n if tid.nil? || tid == ''\n STDERR.puts('Cannot find TEMPLATE_ID in deployment file')\n exit(-1)\n end\n\n extra_template = \"REMOTE_OPENNEBULA = YES\\n\"\\\n \"REMOTE_OPENNEBULA_VM_ID = #{id}\\n\"\n\n # The OpenNebula context will be included\n xml = OpenNebula::XMLElement.new\n xml.initialize_xml(xml_text, 'VM')\n\n if xml.has_elements?('TEMPLATE/CONTEXT')\n # Since there is only 1 level ',' will not be added\n context_str = xml.template_like_str('TEMPLATE/CONTEXT')\n\n if xml['TEMPLATE/CONTEXT/TOKEN'] == 'YES'\n # TODO: use OneGate library. See ec2_driver.rb\n token_str = generate_onegate_token(xml)\n if token_str\n context_str << \"\\nONEGATE_TOKEN=\\\"#{token_str}\\\"\"\n end\n end\n\n extra_template << context_str\n end\n\n t = OpenNebula::Template.new_with_id(tid, @client)\n rc = t.instantiate(REMOTE_NAME_PREFIX+id, true, extra_template,\n false)\n\n if OpenNebula.is_error?(rc)\n STDERR.puts(rc.to_str)\n exit(-1)\n end\n\n deploy_id = \"#{DEPLOY_ID_PREFIX}#{rc}\"\n vm = get_remote_vm(deploy_id)\n\n if !context_str.nil?\n new_context_update = 'CONTEXT = [' << context_str << ']'\n new_context_update = new_context_update.gsub(\"\\n\", \",\\n\")\n rc = vm.updateconf(new_context_update)\n end\n\n if OpenNebula.is_error?(rc)\n STDERR.puts(rc.to_str)\n exit(-1)\n end\n\n vm.release\n\n rc = vm.update(\"REMOTE_OPENNEBULA_DEPLOY_ID = \\\"#{deploy_id}\\\"\",\n true)\n\n if OpenNebula.is_error?(rc)\n STDERR.puts('Error adding REMOTE_OPENNEBULA_DEPLOY_ID ' \\\n \"attribute to VM #{rc}: #{rc.to_str}\")\n end\n\n puts(deploy_id)\n else\n restore(deploy_id)\n deploy_id\n end\n end",
"def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path)) if (options[:mkdirs] == true)\n create_remote_file(host, file_path, file_content)\n\n#\n# NOTE: we need these chown/chmod calls because the acceptance framework connects to the nodes as \"root\", but\n# puppet 'master' runs as user 'puppet'. Therefore, in order for puppet master to be able to read any files\n# that we've created, we have to carefully set their permissions\n#\n\n chown(host, options[:owner], options[:group], file_path)\n chmod(host, options[:mode], file_path)\n\nend",
"def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path)) if (options[:mkdirs] == true)\n create_remote_file(host, file_path, file_content)\n\n#\n# NOTE: we need these chown/chmod calls because the acceptance framework connects to the nodes as \"root\", but\n# puppet 'master' runs as user 'puppet'. Therefore, in order for puppet master to be able to read any files\n# that we've created, we have to carefully set their permissions\n#\n\n chown(host, options[:owner], options[:group], file_path)\n chmod(host, options[:mode], file_path)\n\nend",
"def create_resource(kind, data, body, pr)\n\n if body.size > 0\n result = parse_json(body,kind)\n data = result if !OpenNebula.is_error?(result)\n end\n\n resource = case kind\n when \"vdc\" then\n vdc_data = Hash.new\n data.each{|key,value|\n vdc_data[key.downcase.to_sym]=value if key!=\"pool\"\n }\n\n mandatory_params = [:vdcadminname, :vdcadminpass,\n :zoneid, :name, :hosts]\n\n mandatory_params.each { |param|\n if !vdc_data[param]\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"Mandatory attribute '#{param}' is missing.\").to_json]\n end\n }\n\n # Check if the referenced zone exists\n zone=OZones::Zones.get(vdc_data[:zoneid])\n if !zone\n error = OZones::Error.new(\"Error: Zone \" +\n \"#{vdc_data[:zoneid]} not found, cannot create Vdc.\")\n return [404, error.to_json]\n end\n\n if (!defined? vdc_data[:force] or\n (defined? vdc_data[:force] and vdc_data[:force]!=\"yes\")) and\n !host_uniqueness?(zone, vdc_data[:hosts])\n return [403, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"One or several hosts belong to a different VDC \"+\n \"and no force option was provided.\").to_json]\n end\n\n vdcadminname = vdc_data[:vdcadminname]\n vdcadminpass = vdc_data[:vdcadminpass]\n vdc_data.delete(:zoneid)\n vdc_data.delete(:vdcadminpass)\n vdc_data.delete(:force)\n\n begin\n vdc = OZones::Vdc.create(vdc_data)\n rescue Exception => e\n msg = e.message\n msg[\"accessible in OZones::Vdc\"] = \"supported.\"\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}.\" +\n \" #{msg}\").to_json]\n end\n\n zone.vdcs << vdc\n zone.save\n\n if zone.saved? and vdc.saved?\n vdcadminpass = Digest::SHA1.hexdigest(vdcadminpass)\n rc = @ocaInt.create_vdc_in_zone(zone,\n vdc,\n vdcadminname,\n vdcadminpass)\n if OpenNebula.is_error?(rc)\n vdc.destroy\n return [400, OZones::Error.new(\n \"Error: Couldn't create #{kind}. Reason: \" +\n rc.message).to_json]\n else\n vdc.acls = rc[0]\n vdc.group_id = rc[1]\n vdc.save\n\n pr.update # Rewrite proxy conf file\n return [200, vdc.to_json]\n end\n else\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}.\" +\n \" Maybe duplicated name?\").to_json]\n end\n\n when \"zone\" then\n zone_data=Hash.new\n data.each{|key,value|\n zone_data[key.downcase.to_sym]=value if key!=\"pool\"\n }\n\n mandatory_params = [:onename, :onepass, :endpoint, :name]\n\n mandatory_params.each { |param|\n if !zone_data[param]\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"Mandatory attribute '#{param}' is missing.\").to_json]\n end\n }\n\n # Digest and check credentials\n zone_data[:onepass] =\n Digest::SHA1.hexdigest(zone_data[:onepass])\n\n rc = @ocaInt.check_oneadmin(zone_data[:onename],\n zone_data[:onepass],\n zone_data[:endpoint])\n\n if OpenNebula.is_error?(rc)\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. Reason: \"+\n rc.message).to_json]\n end\n\n # Create the zone\n zone = OZones::Zones.create(zone_data)\n rc = zone.save\n\n if rc\n pr.update # Rewrite proxy conf file\n return [200, zone.to_json]\n else\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind.upcase}.\" +\n \" Maybe duplicated name?\").to_json]\n end\n else\n error = OZones::Error.new(\n \"Error: #{kind.upcase} resource not supported\")\n return [404, error.to_json]\n end\n end",
"def deploy(&block)\n in_directory do\n self.setup!\n self.push_with_retry!\n block.call(self, platform_api, output) if block_given?\n end\n ensure\n self.teardown!\n end",
"def test_creating_file\n prov = mkprovider\n prov.clear\n\n prov.default_target = :basic\n\n resource = mkresource \"yay\", :target => :basic, :one => \"a\", :two => \"c\"\n\n assert_equal(:present, resource.should(:ensure))\n\n apply(resource)\n\n assert_nothing_raised do\n resource.flush\n end\n\n assert_equal(\"yay a c\\n\", prov.target_object(:basic).read,\n \"Did not create file\")\n\n # Make a change\n resource.provider.one = \"b\"\n\n # Flush it\n assert_nothing_raised do\n resource.flush\n end\n\n # And make sure our resource doesn't appear twice in the file.\n assert_equal(\"yay b c\\n\", prov.target_object(:basic).read, \"Wrote record to file twice\")\n end",
"def action_create\n if @current_resource.exist? && !access_controls.requires_changes?\n Chef::Log.debug \"#{r.path} already exists - nothing to do\"\n\n elsif @current_resource.exist? && access_controls.requires_changes?\n converge_by(access_controls.describe_changes) do\n access_controls.set_all\n end\n r.updated_by_last_action(true)\n\n else\n converge_by \"Download #{r.path}\" do\n backup unless ::File.symlink?(r.path)\n do_download\n end\n do_acl_changes\n load_resource_attributes_from_file(r)\n r.updated_by_last_action(true)\n load_new_resource_state\n r.exist = true\n end\n end",
"def extend_image_with_file(base_image, new_image, file_path, file_contents)\n container_id = run_stdin [], base_image, file_contents, \"/bin/sh\", \"-c\", \"cat > #{file_path}; cat #{file_path}\"\n wait container_id\n commit container_id, new_image, \"Added #{file_path}\"\n end",
"def install_fpc(source, file, build_dir, prefix, installer)\n remote_file \"#{Chef::Config[:file_cache_path]}/#{file}\" do\n source source + file\n mode '0644'\n action :create_if_missing\n not_if \"test -e #{prefix}/bin/fpc\"\n end\n\n bash \"extract-#{build_dir}\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n\n code <<-EOH\n set -e\n tar -xf #{file}\n EOH\n not_if \"test -e #{prefix}/bin/fpc\"\n end\n\n cookbook_file \"#{Chef::Config[:file_cache_path]}/#{build_dir}/#{installer}\" do\n user 'root'\n group 'root'\n mode '0755'\n not_if \"test -e #{prefix}/bin/fpc\"\n end\n\n bash \"install-#{build_dir}\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n\n code <<-EOH\n set -e\n tar -xf #{file}\n cd #{build_dir}\n ./#{installer} #{prefix}\n EOH\n not_if \"test -e #{prefix}/bin/fpc\"\n end\nend",
"def create_vm\n if new_resource.clone\n clone_vm\n else\n data = {\n vmid: vmid,\n bootdisk: 'virtio0',\n cores: INSTANCE_SIZE[new_resource.size]['cpu'],\n memory: INSTANCE_SIZE[new_resource.size]['memory'],\n ide2: \"#{new_resource.cdrom},media=cdrom\",\n numa: (new_resource.numa ? 1 : 0),\n ostype: get_type(new_resource.ostype),\n sockets: 1,\n virtio0: \"#{new_resource.storage}:/vm-#{vmid}-disk-1.qcow2,size=#{new_resource.disk}\"\n }.merge(new_resource.net)\n data.merge(hugepages: new_resource.hugepages) if new_resource.hugepages\n api.post(\"/nodes/#{new_resource.host}/qemu\", data)\n end\nend",
"def create\n all = list_all_files_in_dir(@resource[:target])\n to_keep = select_all_matching(all, @resource[:whitelist])\n to_purge = get_files_to_purge(all, to_keep)\n purge_files(to_purge)\n end",
"def secondary_storage\n unless ::File.exist?(new_resource.nfs_path)\n shell_out!(\"mkdir -p #{new_resource.nfs_path}\")\n shell_out!(\"chown -R root:root #{new_resource.nfs_path}\")\n end\n end",
"def app_file\n @app_file ||= Chef::Resource::RemoteFile.new(\n ::File.join(deploy_dir, app_name), run_context\n )\n @app_file.mode('0755')\n @app_file.source(asset_url.to_s)\n @app_file\n end",
"def generate_deployment_file(provision)\n @hosts = provision.info_objects('hosts')\n end",
"def upload_and_run(local_path, remote_path)\n upload local_path, remote_path\n run \"chmod a+x #{remote_path}\"\n sudo remote_path\n sudo \"rm #{remote_path}\"\nend",
"def deploy(data, replace=false, force=false)\n err = runWithData(\"kubectl create -f -\", data)\n if err\n if existsErr?(err) && replace\n return replace(data, force)\n end\n return \"could not create object: #{err}\"\n end\n return false\nend",
"def create_manifest_file(manifest)\n target_node_name = ENV['TARGET_HOST']\n manifest_file = Tempfile.new(['manifest_', '.pp'])\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n command = \"bundle exec bolt file upload #{manifest_file.path} /tmp/#{File.basename(manifest_file)} --nodes #{target_node_name} --inventoryfile inventory.yaml\"\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n raise error_message unless status.to_i.zero?\n\n manifest_file_location = \"/tmp/#{File.basename(manifest_file)}\"\n end\n manifest_file_location\n end",
"def manifest_file_create_command(id, manifest_src)\n disk.file_create_command(manifest_filename(id), manifest_src)\n end",
"def sync_file_resource(resource, version)\n fetch_resource(resource, version) do |download_file|\n # move downloaded file to its place in data dir\n # ex: data/tenant1/automatortype/chef-solo/roles/cluster.json/1/cluster.json\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n log.debug \"storing fetched file #{download_file} into data dir: #{data_file}\"\n # set file permissions if specified\n if @resourcespec.resource_permissions.key?(resource) && !@resourcespec.resource_permissions[resource].nil?\n log.debug \"setting file permissions #{@resourcespec.resource_permissions[resource]}\"\n octal_mode = @resourcespec.resource_permissions[resource].to_i(8)\n FileUtils.chmod octal_mode, download_file\n end\n FileUtils.mkdir_p(File.dirname(data_file))\n FileUtils.mv(download_file, data_file)\n end\n end",
"def update\n context.execute :rm, '-rf', \"#{deploy_path}/local_file/*\"\n context.upload! fetch(:repo_url), \"#{deploy_path}/local_file/#{fetch(:repo_url)}\"\n end",
"def xmlinstall\n\n\t\tif !File.exists?(resource[:xml_file])\n\t\t\tdebug \"Creating the XML file: %s \" % resource[:xml_file]\n\n\t\t\tcase resource[:virt_type]\n\t\t\t\twhen :openvz then\n\t\t\t\t\tdebug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\ttmplcache = resource[:tmpl_cache]\n\t\t\t\t\txargs = \"-c openvz:///system define --file \"\n\t\t\t\t\tif !tmplcache.nil?\n\t\t\t\t\t\trequire \"erb\"\n\t\t\t\t\t\txmlovz = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/ovz_xml.erb\")\n\t\t\t\t\t\txmlovz.puts = xmlwrite.result\n\t\t\t\t\t\txmlovz.close\n\t\t\t\t\telse\n\t\t\t\t\t\tfail(\"OpenVZ Error: No template cache define!\")\n\t\t\t\t\tend\n\t\t\t\telse debug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\txargs = \"-c qemu:///session define --file \"\n\t\t\t\t\trequire \"erb\"\n\t\t\t\t\txmlqemu = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/qemu_xml.erb\")\n\t\t\t\t\txmlqemu.puts = xmlwrite.result\n\t\t\t\t\txmlqemu.close\n\t\t\t\tend\n\t\n\t\t\tdebug \"Creating the domain: %s \" % [resource[:name]]\n\t\t\tvirsh xargs + resource[:xml_file]\n\t\telse\n\t\t\tfail(\"Error: XML already exists on disk \" + resource[:xml_file] + \".\" )\t\n\t\tend\n\tend",
"def create\n file = Tempfile.new(\"oneimage-#{resource[:name]}\")\n File.chmod(0644, file.path)\n\n template = ERB.new <<-EOF\nNAME = \"<%= resource[:name] %>\"\n<% if resource[:description] %>DESCRIPTION = \"<%= resource[:description] %>\"<% end%>\n<% if resource[:type] %>TYPE = <%= resource[:type].upcase %><% end%>\n<% if resource[:persistent] %>PERSISTENT = <%= resource[:persistent] %><% end%>\n<% if resource[:dev_prefix] %>DEV_PREFIX = \"<%= resource[:dev_prefix] %>\"<% end%>\n<% if resource[:driver] %>DRIVER = \"<%= resource[:driver] %>\"<% end %>\n<% if resource[:path] %>PATH = <%= resource[:path] %><% end%>\n<% if resource[:source] %>SOURCE = <%= resource[:source] %><% end%>\n<% if resource[:fstype] %>FSTYPE = <%= resource[:fstype] %><% end%>\n<% if resource[:size] %>SIZE = <%= resource[:size] %><% end%>\nEOF\n\n tempfile = template.result(binding)\n self.debug \"Creating image using tempfile: #{tempfile}\"\n file.write(tempfile)\n file.close\n output = \"oneimage create -d #{resource[:datastore]} #{file.path} \", self.class.login\n `#{output}`\n end",
"def action_install\n remote_file.run_action(:create)\n package.run_action(:install)\n new_resource.installed = true\n end",
"def deploy\n update_repositories\n sync_service_environment_files\n # deploy_services\n response\n end",
"def actions_to_deploy_on(node, service, use_why_run: true)\n package_dir = \"#{@repository_path}/dist/#{@local_env ? 'local' : 'prod'}/#{service}\"\n # Generate the nodes attributes file\n unless @cmd_runner.dry_run\n FileUtils.mkdir_p \"#{package_dir}/nodes\"\n File.write(\"#{package_dir}/nodes/#{node}.json\", (known_nodes.include?(node) ? metadata_for(node) : {}).merge(@nodes_handler.metadata_of(node)).to_json)\n end\n client_options = [\n '--local-mode',\n '--chef-license', 'accept',\n '--json-attributes', \"nodes/#{node}.json\"\n ]\n client_options << '--why-run' if use_why_run\n if @nodes_handler.get_use_local_chef_of(node)\n # Just run the chef-client directly from the packaged repository\n [{ bash: \"cd #{package_dir} && #{@cmd_runner.root? ? '' : 'sudo '}SSL_CERT_DIR=/etc/ssl/certs /opt/chef-workstation/bin/chef-client #{client_options.join(' ')}\" }]\n else\n # Upload the package and run it from the node\n package_name = File.basename(package_dir)\n chef_versions_file = \"#{@repository_path}/chef_versions.yml\"\n raise \"Missing file #{chef_versions_file} specifying the Chef Infra Client version to be deployed\" unless File.exist?(chef_versions_file)\n\n required_chef_client_version = YAML.load_file(chef_versions_file)['client']\n sudo = (@actions_executor.connector(:ssh).ssh_user == 'root' ? '' : \"#{@nodes_handler.sudo_on(node)} \")\n [\n {\n # Install dependencies\n remote_bash: [\n 'set -e',\n 'set -o pipefail',\n \"if [ -n \\\"$(command -v apt)\\\" ]; then #{sudo}apt update && #{sudo}apt install -y curl build-essential ; else #{sudo}yum groupinstall 'Development Tools' && #{sudo}yum install -y curl ; fi\",\n 'mkdir -p ./hpc_deploy',\n 'rm -rf ./hpc_deploy/tmp',\n 'mkdir -p ./hpc_deploy/tmp',\n 'curl --location https://omnitruck.chef.io/install.sh --output ./hpc_deploy/install.sh',\n 'chmod a+x ./hpc_deploy/install.sh',\n \"#{sudo}TMPDIR=./hpc_deploy/tmp ./hpc_deploy/install.sh -d /opt/artefacts -v #{required_chef_client_version} -s once\"\n ]\n },\n {\n scp: { package_dir => './hpc_deploy' },\n remote_bash: [\n 'set -e',\n \"cd ./hpc_deploy/#{package_name}\",\n \"#{sudo}SSL_CERT_DIR=/etc/ssl/certs /opt/chef/bin/chef-client #{client_options.join(' ')}\",\n 'cd ..'\n ] + (log_debug? ? [] : [\"#{sudo}rm -rf ./hpc_deploy/#{package_name}\"])\n }\n ]\n end\n end",
"def apply_resource(kuberesource)\n resource = kuberesource.document\n name = resource[\"metadata\"][\"name\"]\n responses = []\n not_found = false\n begin\n response = get(resource)\n rescue RestClient::NotFound => e\n not_found = true\n end\n\n if not_found\n begin\n response = post(resource)\n puts \"Created resource #{response[:resource]}\"\n responses << response\n rescue RestClient::NotFound => e\n pp e\n pp JSON.parse(e.response.body)\n puts \"404 when applying resources might mean one of the following:\"\n puts \"\\t * You're trying to apply a non-namespaced manifest.\"\n puts \"\\t Confirm if your manifests metadata should contain a namespace field or not\"\n rescue RestClient::UnprocessableEntity => e\n pp e\n pp JSON.parse(e.response.body)\n end\n else\n puts \"Updating resource #{response[:resource]}\"\n\n # Get the current full resource from apiserver\n current_resource = response[:body]\n\n update_resource = kuberesource.merge_for_put(current_resource)\n\n begin\n responses << put(update_resource)\n rescue RestClient::BadRequest => e\n handle_bad_request(client, e, body, ns_prefix, resource_name)\n raise e\n rescue RestClient::Exception => e\n puts \"Error updating resource: #{e} #{e.class}\"\n pp JSON.parse(e.response)\n end\n \n return responses\n end\n end",
"def provision\n FileUtils.rm_f('.env')\n FileUtils.ln_s(\"#{compose_dir}/#{Ros.env}.env\", '.env')\n # return unless gem_version_check\n # TODO: make build its own rake task and method\n if options.build\n services.each_pair do |name, config|\n next if config&.enabled.eql? false\n compose(\"build #{name}\")\n end\n return\n end\n if options.initialize\n compose(\"up wait\")\n services.each do |name, config|\n next if config&.enabled.eql? false\n prefix = config.ros ? 'app:' : ''\n compose(\"run --rm #{name} rails #{prefix}ros:db:reset:seed\")\n end\n end\n compose_options = options.daemon ? '-d' : ''\n compose(\"up #{compose_options}\")\n if options.initialize\n %x(cat ros/services/iam/tmp/#{Settings.platform.environment.partition_name}/postman/222_222_222-Admin_2.json)\n end\n end",
"def create\n raise ArgumentError, 'Symlink target undefined' unless to\n might_update_resource do\n provider.create\n end\n end",
"def create\n\t\tregion = resource[:availability_zone].to_s.gsub(/.$/,'') \n\t\tcompute = Fog::Compute.new(:provider => 'aws', :region => \"#{region}\")\n\t\tprint \"ebsvol[aws]->create: Region is #{region}\\n\" if $debug\n\t\tprint \"ebsvol[aws]->create: Availability_zone is #{resource[:availability_zone]}\\n\" if $debug\n\t\t# create the requested volume\n\t\tresponse = compute.create_volume(resource[:availability_zone],resource[:size],resource[:snapshot])\t\n\t\tif (response.status == 200)\n\t\t\tvolumeid = response.body['volumeId']\n\t\t\tprint \"ebsvol[aws]->create: I created volume #{volumeid}.\\n\" if $debug\n\t\t\t# now tag the volume with volumename so we can identify it by name\n\t\t\t# and not the volumeid\n\t\t\tresponse = compute.create_tags(volumeid,{ :Name => resource[:volume_name] })\n\t\t\tif (response.status == 200)\n\t\t\t\tprint \"ebsvol[aws]->create: I tagged #{volumeid} with Name = #{resource[:volume_name]}\\n\" if $debug\n\t\t\tend\n\t\t\t# Check if I need to attach it to an ec2 instance.\n\t\t\tattachto = resource[:attached_to].to_s\n\t\t\tprint \"attachto is #{attachto}\\n\" if $debug\n\t\t\tif ( attachto != '' )\n\t\t\t\tif ( attachto == 'me')\n\t\t\t\t\tinstance = instanceinfo(compute,myname(compute))\n\t\t\t\telse\n\t\t\t\t\tinstance = instanceinfo(compute,attachto)\n\t\t\t\tend\n\t\t\t\tif ( resource[:device] != nil )\n\t\t\t\t\t# try to attach the volume to requested instance\n\t\t\t\t\tprint \"attach the volume\\n\" if $debug\n\t\t\t\t\tvolume = volinfo(compute,resource[:volume_name])\n\t\t\t\t\tattachvol(compute,volume,instance,resource[:device])\n\t\t\t\telse\n\t\t\t\t\traise \"ebsvol[aws]->create: Sorry, I can't attach a volume with out a device to attach to!\"\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\traise \"ebsvol[aws]->create: I couldn't create the ebs volume, sorry!\"\n\t\tend\n\tend",
"def test_retrievethenmkexe\n exe = tempfile\n oexe = tempfile\n sh = %x{which sh}\n File.open(exe, \"w\") { |f| f.puts \"#!#{sh}\\necho yup\" }\n\n file = Puppet::Type.type(:file).new(\n :path => oexe,\n :source => exe,\n :mode => 0755\n )\n\n exec = Puppet::Type.type(:exec).new(\n :command => oexe,\n :require => Puppet::Resource.new(:file, oexe)\n )\n\n comp = mk_catalog(\"Testing\", file, exec)\n\n assert_events([:file_created, :executed_command], comp)\n end",
"def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end",
"def slave_exe_resource\n return @slave_exe_resource if @slave_exe_resource\n slave_exe = ::File.join(new_resource.remote_fs, \"#{new_resource.service_name}.exe\")\n @slave_exe_resource = Chef::Resource::RemoteFile.new(slave_exe, run_context)\n @slave_exe_resource.source(new_resource.winsw_url)\n @slave_exe_resource.checksum(new_resource.winsw_checksum)\n @slave_exe_resource.backup(false)\n @slave_exe_resource\n end",
"def create\n @sys_image = resource_new(params[:sys_image]) \n @sys_image.user_id = current_user.id\n\t@sys_image.sys_image_id = nil\n @sys_image.baseline = 0\n if (params[:sys_image_id].to_i != -1)\n @sys_image.baseline = 1\n @sys_image.sys_image_id = params[:sys_image_id]\n end\n uploaded_io = params[:file]\n #path = get_sysimage_by_user(current_user.username, params[:sys_image][:name]); \n #File.open(path, 'w') do |file|\n #file.write(uploaded_io.read)\n #end\n _size = File.size(uploaded_io)\n if _size > 0\n @sys_image.size = _size\n if @sys_image.save\n write_resource(@sys_image, uploaded_io.read, \"ndz\")\n OMF::Workspace.create_sysimage(@sys_image, get_path(@sys_image, \"ndz\")) \n flash[\"success\"] = t(\"amazing.sys_image.created\")\n redirect_to(@sys_image) \n else\n render :action => \"new\" \n end\n end\n end",
"def deploy\n Kb8Run.update_context(@kb8context)\n @deploy_units.each do | deploy_unit |\n deploy_unit.deploy\n end\n end",
"def upload_locally_staged_rpms_to(hosts, rpm_staging_dir)\n rpms = Dir['*.rpm'] + Dir[File.join('rpms','*.rpm')]\n rpms.each do |f|\n scp_to(hosts,f,rpm_staging_dir)\n end\nend",
"def unix_create_remote_endpoint\n head = __method__\n set_status(\"Create\")\n log \"#{head}: Creating #{endpoint.at_type} #{remote_user}@#{remote_host}. Should already exist!\"\n uadmin_unix_ssh(\"sudo adduser #{remote_user} --quiet --disabled-password || exit 0\")\n uadmin_unix_ssh(\"sudo -u #{remote_user} mkdir -p ~#{remote_user}/.ssh\")\n uadmin_unix_ssh(\"sudo -u #{remote_user} chmod 777 ~#{remote_user}/.ssh\")\n file = pub_cert(ssh_cert)\n deploy_cert_path = deploy_cert\n begin\n uadmin_unix_scp(file.path, \"~#{remote_user}/.ssh/endpoint-#{name}.pub\")\n uadmin_unix_ssh(\"cat ~#{remote_user}/.ssh/endpoint-#{name}.pub | sudo -u #{remote_user} tee -a ~#{remote_user}/.ssh/authorized_keys\")\n rescue Exception => boom4\n log \"#{head}: error creating ~#{remote_user}/.ssh/endpoint-#{name}.pub on #{remote_host} - #{boom4} - trying to ignore\"\n end\n file.unlink\n uadmin_unix_ssh(\"sudo chown #{remote_user}:#{remote_user} ~#{remote_user} ~#{remote_user}/.ssh ~#{remote_user}/.ssh/*\")\n uadmin_unix_ssh(\"sudo -u #{remote_user} chmod 700 -f ~#{remote_user}/.ssh ~#{remote_user}/.ssh/*.pem\")\n\n unix_scp(deploy_cert_path, \"~/.ssh/endpoint-#{name}-deploy.pem\")\n unix_ssh(\"chmod 700 ~/.ssh/endpoint-#{name}-deploy.pem\")\n unix_ssh(\"mkdir -p ~/bin\")\n file = Tempfile.new(\"gitssh\")\n file.write(\"exec /usr/bin/ssh -o StrictHostKeyChecking=no -i ~/.ssh/endpoint-#{name}-deploy.pem $@\\n\")\n file.close\n unix_scp(file.path, \"~/bin/endpoint-#{name}-git\")\n unix_ssh(\"chmod +x ~/bin/endpoint-#{name}-git\")\n unix_ssh(\"ls -la\")\n unix_ssh(\"gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3\")\n unix_ssh(\"test -e .rvm || \\\\curl -L https://get.rvm.io | bash -s stable --autolibs=read-fail\")\n unix_ssh(\"test -e .rvm && bash --login -c \\\"rvm install #{ruby_version}\\\"\")\n log \"#{head}: Remote #{endpoint.at_type} #{remote_user}@#{remote_host} exists.\"\n set_status(\"Success:Create\")\n rescue Exception => boom\n log \"#{head}: error creating ~#{remote_user}@#{remote_host} on remote server - #{boom}\"\n set_status(\"Error:Create\")\n end",
"def add_on_demand_resources(native_target, app_spec)\n dependent_targets = target.dependent_targets_for_app_spec(app_spec)\n parent_odr_group = native_target.project.group_for_spec(app_spec.name)\n\n # Add ODRs of the app spec dependencies first.\n dependent_targets.each do |pod_target|\n file_accessors = pod_target.file_accessors.select do |fa|\n fa.spec.library_specification? ||\n fa.spec.test_specification? && pod_target.test_app_hosts_by_spec[fa.spec]&.first == app_spec\n end\n target_odr_group_name = \"#{pod_target.label}-OnDemandResources\"\n UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,\n native_target, file_accessors,\n parent_odr_group, target_odr_group_name)\n end\n\n # Now add the ODRs of our own app spec declaration.\n file_accessor = target.file_accessors.find { |fa| fa.spec == app_spec }\n target_odr_group_name = \"#{target.subspec_label(app_spec)}-OnDemandResources\"\n UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,\n native_target, file_accessor,\n parent_odr_group, target_odr_group_name)\n end",
"def cloud( name )\n require \"capistrano/fastfood/clouds/#{name}\"\n end",
"def release\n context.execute :tar, '-xvzf', \"#{deploy_path}/local_file/#{fetch(:repo_url)}\"\n context.execute :rsync, \"-a\", \"--exclude=#{fetch(:repo_url)}\", \"#{deploy_path}/local_file/*\", release_path\n end",
"def insert\n Chef::Log.warn('Using DEPRECATED (as of Docker 0.10.0) insert command in docker_image. Please update your workflow and cookbook.')\n docker_cmd!(\"insert #{new_resource.image_name} #{new_resource.source} #{new_resource.destination}\")\nend",
"def create\n begin\n # Set the partition (/dev/sdb1), device (/dev/sdb) and alignment (optimal,minimal,none etc.) variables\n partition= resource[:name]\n device=partition[0,(partition.length-1)]\n alignment= resource[:alignment]\n\n # Now we can create the partition\n partitions = parted('-a', resource[:alignment],'--script',device,'mklabel',resource[:part_label],'mkpart', resource[:part_type],resource[:fs_type],resource[:p_begin],resource[:p_end])\n rescue Puppet::ExecutionFailure => e\n false\n end\n end",
"def mk_file_resource(path)\n # Force deletion, so directories actually get deleted.\n Puppet::Type.type(:file).new :path => path, :ensure => :absent, :force => true, :before => self[:before]\n end",
"def deploy!\n write_previous_revision\n update_repository\n write_revision\n end",
"def compute\n @path = \"/services/Cloud\"\n @compute ||= Nephophobia::Resource::Compute.new self\n end",
"def populate_chef_secure_path\n chef_secure_path.run_action(:create)\n\n unless new_resource.encrypted_data_bag_secret.nil?\n r = Chef::Resource::File.new(::File.join(new_resource.chef_secure_path, 'encrypted_data_bag_secret'), run_context)\n r.content(new_resource.encrypted_data_bag_secret)\n r.sensitive(true)\n r.run_action(:create)\n end\n\n unless chef_client_valid(chef_server_url, new_resource.service_name, client_key_file)\n r = Chef::Resource::File.new(client_key_file, run_context)\n r.sensitive(true)\n r.run_action(:delete)\n end\n\n unless ::File.exists?(client_key_file) or new_resource.validation_key.nil?\n r = Chef::Resource::File.new(::File.join(new_resource.chef_secure_path, 'validation.pem'), run_context)\n r.content(new_resource.validation_key)\n r.sensitive(true)\n r.run_action(:create)\n end\n\n unless new_resource.data_bags.empty?\n write_data_bags(new_resource.data_bags(new_resource.chef_secure_path, 'data_bags'))\n end\n end",
"def perform\n @provider = Provider.find_or_create_by(name: 'Atlantic.net')\n update_compute_batch\n end",
"def generate\n #debug 'generate'\n\n #return nil\n path = self[:path]\n if path == nil\n path = self[:name]\n end\n existing_file_res = catalog.resource(:file, path)\n if !existing_file_res\n #_ensure = self[:ensure] == :present ? :file : :absent\n _ensure = self[:ensure]\n filetype = Puppet::Type.type(:file)\n fileparams = {:name => path, \n :ensure => _ensure,\n :backup => false,\n :checksum => :none\n }\n if self[:mode]\n fileparams[:mode] = self[:mode]\n end\n if self[:owner]\n fileparams[:owner] = self[:owner]\n end\n if self[:group]\n fileparams[:group] = self[:group]\n end\n file_res = filetype.new(fileparams)\n #debug \"resource file does not exist yet -> generate it with #{_ensure.to_s}\"\n #debug 'generated: ' + file_res.inspect\n result = [file_res]\n else\n #debug 'resource file already exists'\n result = nil\n end\n result\n end",
"def action_create\n job_name = \"#{@new_resource.job_name}\"\n remote_host = \"#{@new_resource.remote_host}\"\n job_config = \"#{node[:jenkins][:server][:home]}/#{@new_resource.job_name}-config.xml\"\n \n run_commands = Array.new\n to_store_scripts = Array.new\n \n @new_resource.commands.each do |command|\n if (command[:type] == 'script')\n\t to_store_scripts << \"#{command[:content]}\"\n\t command[:fullPath] = \"#{node[:jenkins][:node][:home]}/jenkins-scripts/#{command[:content]}\"\n\telse\n\t command[:fullPath] = \"#{command[:content]}\"\n\tend\n \n if (command[:type] == 'script' && command[:action] == 'run') || command[:type] == 'command'\n run_commands << command\n end\n end\n\n template job_config do\n source \"#{new_resource.config_template}\"\n variables :job_name => job_name, :remote_host => remote_host, :commands => run_commands\n\towner node[:jenkins][:server][:user]\n group node[:jenkins][:server][:group]\n end\n \n \n # Create sh files and upload them to remote host\n to_store_scripts.each do |script|\n \n # create scripts on jenkins server\n cookbook_file \"#{node[:jenkins][:server][:home]}/jenkins-scripts/#{script}\" do\n source \"#{script}\"\n owner node[:jenkins][:server][:user]\n group node[:jenkins][:server][:group]\n action :create\n\t mode \"0755\"\n end\n \n #upload scripts to host only if host is reachable\n\tbash \"upload script #{script} on server #{remote_host}\" do\n user node[:jenkins][:server][:user]\n cwd \"#{node[:jenkins][:server][:home]}/jenkins-scripts/\"\n\t code <<-EOH\nscp #{script} #{node[:jenkins][:node][:user]}@#{remote_host}:#{node[:jenkins][:node][:home]}/jenkins-scripts\nssh #{node[:jenkins][:node][:user]}@#{remote_host} chmod 755 #{node[:jenkins][:node][:home]}/jenkins-scripts/*\nEOH\n only_if \"ping -q -c1 #{remote_host}\"\n end\n end\n\n jenkins_job \"#{@new_resource.job_name}\" do\n action :update\n config job_config\n end \n \n file job_config do\n action :delete\n\tbackup false\n end\r\nend",
"def create_and_upload_env_iso(vm_id, settings)\n Dir.mktmpdir do |tmp|\n # Generate ISO and get its path\n iso_path = generate_env_iso(tmp, settings)\n cloud_error('Error while creating iso...') if iso_path.nil?\n image_name = \"iso-image-#{vm_id}\"\n # Upload the ISO ang get the iso_uuid\n iso_uuid = @image_manager.create_image(image_name, 'ISO_IMAGE',\n @container_uuid, iso_path)\n iso_uuid\n end\n rescue => e\n raise e\n end",
"def upload\n berks_install if berksfile?\n berks_upload if berksfile?\n knife_upload unless cookbook? || !chef_data?\n end",
"def update!(**args)\n @compute = args[:compute] if args.key?(:compute)\n @os_image = args[:os_image] if args.key?(:os_image)\n end",
"def perform(repo)\n repo.update_catalog_metadata\n repo.add_preservation_and_mets_xml\n repo.delete_clone\n repo.create_iiif_manifest if Settings.bulk_import.create_iiif_manifest\n repo.publish if repo.published\n end",
"def prepare_deploy\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy:setup -S phase=node_prepare HOSTS=#{self.hostname}`\n `cd #{self.project_root} && BUNDLE_GEMFILE=Gemfile bundle exec cap #{self.environment} deploy -S phase=node_prepare HOSTS=#{self.hostname}`\n end",
"def create\n\n # Let's get a few things straight\n @work_dir = \"#{@resource[:cache_dir]}/#{@resource[:extension]}\"\n @php_version_prefix = \"#{@resource[:phpenv_root]}/versions/#{@resource[:php_version]}\"\n @resource[:compiled_name] ||= \"#{@resource[:extension]}.so\"\n\n # Update the repository\n fetch @resource[:version], @resource[:extension]\n\n # Prepare for building\n prep_build @resource[:version]\n\n # PHPize, build & install\n phpize\n configure\n make\n install\n end",
"def allocate(session, template)\n write_task('rvpe.image.allocate', session) do\n image_def = ResourceFile::Parser.load_yaml(template)\n t = Transfer.find_by_name(image_def[ResourceFile::Image::TRANSFER])[0]\n # check fields\n err_msg_suffix = ' in Image file.'\n # check name\n _name = image_def[ResourceFile::Image::NAME]\n unless _name\n t.cleanup\n raise 'Specify ' + ResourceFile::Image::NAME + err_msg_suffix\n end\n unless Image.find_by_name(_name, session, -2).empty?\n t.cleanup\n raise \"Image[#{_name}] already exists. Use another name.\"\n end\n # check type\n _type = image_def[ResourceFile::Image::TYPE]\n _type = 'OS' unless _type\n # check attributes\n if image_def[ResourceFile::Image::PUBLIC] &&\n image_def[ResourceFile::Image::PERSISTENT]\n t.cleanup\n raise \"An image can't be public and persistent at the same time.\"\n end\n _public = image_def[ResourceFile::Image::PUBLIC]\n if _public\n _public = 'YES' # yaml automatically converted 'YES' to true\n else\n _public = 'NO'\n end\n _persistent = image_def[ResourceFile::Image::PERSISTENT]\n if _persistent\n _persistent = 'YES' # yaml automatically converted 'YES' to true\n else\n _persistent = 'NO'\n end\n # check bus\n _bus = image_def[ResourceFile::Image::IO_BUS]\n _bus = 'virtio' unless _bus\n case _bus.downcase\n when 'virtio'\n _dev_prefix = 'vd'\n when 'ide'\n _dev_prefix = 'hd'\n else\n _dev_prefix = 'sd'\n end\n # check nic model\n _nic_model = image_def[ResourceFile::Image::NIC_MODEL]\n _nic_model = 'virtio' unless _nic_model\n # check image file\n begin\n image_sanity_check(t.path)\n rescue => e\n t.cleanup\n raise e\n end\n\n one_template = <<EOT\nNAME = \"#{_name}\"\nDESCRIPTION = \"#{image_def[ResourceFile::Image::DESCRIPTION]}\"\nTYPE = \"#{_type}\"\nPUBLIC = \"#{_public}\"\nPERSISTENT = \"#{_persistent}\"\nBUS = \"#{_bus}\"\nDEV_PREFIX = \"#{_dev_prefix}\"\nNIC_MODEL = \"#{_nic_model}\"\nPATH = \"#{image_def[ResourceFile::Image::PATH]}\"\nEOT\n rc = call_one_xmlrpc('one.image.allocate', session, one_template)\n\n if rc[0]\n # move OS image to the image storage directory\n rc2 = call_one_xmlrpc('one.image.info', session, rc[1])\n unless rc2[0]\n t.cleanup\n raise rc2[1]\n end\n doc = REXML::Document.new(rc2[1])\n FileUtils.mv(t.path, doc.get_text('IMAGE/SOURCE').value)\n end\n t.cleanup\n rc\n end\n end",
"def install_custom!\n package package_name do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n end",
"def update_resource(kind, data, body, pr)\n\n if body.size > 0\n result = parse_json(body,kind)\n data = result if !OpenNebula.is_error?(result)\n end\n\n resource = case kind\n when \"vdc\" then\n vdc_data=Hash.new\n vdc_id = nil\n data.each{|key,value|\n vdc_data[key.downcase.to_sym]=value if key!=\"id\"\n vdc_id = value if key==\"id\"\n }\n\n # Check parameters\n if !vdc_data[:hosts] || !vdc_id\n return [400, OZones::Error.new(\n \"Error: Couldn't update resource #{kind}. \" +\n \"Need ID and HOSTS to update.\").to_json]\n end\n\n # Check if the referenced Vdc exists\n vdc=OZones::Vdc.get(vdc_id)\n if !vdc\n error = OZones::Error.new(\"Error: Vdc \" +\n \"#{vdc_id} not found, cannot update Vdc.\")\n return [404, error.to_json]\n end\n\n # Get the zone where the Vdc belongs\n zone=OZones::Zones.get(vdc.zones.id)\n if !zone\n error = OZones::Error.new(\"Error: Zone \" +\n \"#{vdc.zones.id} not found, cannot update Vdc.\")\n return [404, error.to_json]\n end\n \n if (!vdc_data[:force] or vdc_data[:force].upcase!=\"YES\") and\n !host_uniqueness?(zone, vdc_data[:hosts], vdc_id.to_i)\n return [403, OZones::Error.new(\n \"Error: Couldn't update resource #{kind}. \" +\n \"One or several hosts belong to a different VDC \"+\n \"and no force option was provided.\").to_json]\n end\n\n rc = @ocaInt.update_vdc_hosts(zone, vdc, vdc_data[:hosts])\n\n if !OpenNebula.is_error?(rc)\n vdc.hosts = vdc_data[:hosts]\n vdc.get_host_acls!(rc)\n\n vdc.save\n\n if vdc.saved?\n return [200, vdc.to_json]\n else\n return [500, OZones::Error.new(\n \"Error: Couldn't update resource #{kind}.\").to_json]\n end\n\n else\n return [500, OZones::Error.new(\n \"Error: Couldn't update resource #{kind.upcase}.\" +\n \" Failed to update ACLs\").to_json]\n end\n else\n error = OZones::Error.new(\n \"Error: #{kind.upcase} resource update not supported\")\n return [404, error.to_json]\n end\n end",
"def write_build_environments(path)\n r = Chef::Resource::File.new(::File.join(path, \"#{new_resource.chef_environment}.json\"), run_context)\n r.content(Chef::Environment.load(new_resource.chef_environment).to_json)\n r.run_action(:create)\n end",
"def generate_compute(compute_instancetype, compute_imageid)\n compute_instancename = UUIDTools::UUID.random_create\n raw_template = \"\"\n File.open(COMPUTE_TEMPLATE) { |f| raw_template = f.readlines }\n template = ERB.new(raw_template.join(\"\\n\"))\n return [compute_instancename, template.result(binding)]\nend",
"def install_tscm\n case node['platform']\n when 'redhat'\n # Create dir to mount\n directory '/opt/IBM/SCM' do\n recursive true\n action :create\n end\n\n #Create SCM logical volume \n node['tscm']['logvols'].each do |logvol|\n lvm_logical_volume logvol['volname'] do\n group node['tscm']['volumegroup']\n size logvol['size']\n filesystem logvol['fstype']\n mount_point logvol['mountpoint']\n end\n end \n # verifying the tscm installation if already exists\n if ::File.exist?(\"#{node['tscm']['installed_dir']}jacclient\")\n install_status = shell_out(\"#{node['tscm']['installed_dir']}jacclient status\").stdout.chop\n if install_status.include?('The Tivoli Security Compliance Manager client is currently running')\n Chef::Log.error('TSCM client already installed on ' + (node['tscm']['node_name']).to_s + '........Nothing to do')\n end\n else\n Chef::Log.info('Installing TSCM ....')\n\n # creating a temporary directory for installinsg TSCM\n tempfolder = '/opt/IBM/tscm_temp'\n\n directory tempfolder.to_s do\n action :create\n end\n\n # get TSCM media to our temp dir\n media = tempfolder + '/' + node['tscm']['base_package'].to_s\n\n remote_file media.to_s do\n source node['tscm']['url'].to_s\n owner 'root'\n group 'root'\n mode '0755'\n action :create_if_missing\n end\n\n # Unpacking TSCM media\n execute 'unpack-media' do\n command 'cd ' + tempfolder.to_s + ' ; ' + ' tar -xf ' + media.to_s\n action :run\n not_if { ::File.exist?(\"#{media}/#{node['tscm']['base_package']}\") }\n end\n\n # run the installation script\n bash 'install-tscm' do\n code <<-EOH\n cd #{tempfolder}\n chmod 744 install_x64.sh\n ./install_x64.sh\n EOH\n end\n\n # copy the ssh key for TSCM to /opt/IBM/\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n group 'root'\n mode '400'\n action :create_if_missing\n end\n\n # create temp directory to copy the auditing patching file\n directory node['tscm']['patch_dir'].to_s do\n recursive true\n owner 'root'\n group 'root'\n mode '0744'\n action :create\n end\n\n # copy the powershell script to node system\n cookbook_file node['tscm']['copy_script_path'].to_s do\n source 'copy_script.ps1'\n owner 'root'\n group 'root'\n mode '750'\n action :create\n end\n\n # copy the powershell script to TSCM Server\n bash 'copy-powershell-script-to-tscm-server' do\n code <<-EOH\n scp -C -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['copy_script_path']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/c:/users/scm_auto_usr/\n\t EOH\n live_stream true\n action :run\n end\n\n # run the powershell scripts\n execute 'run-powershell-script' do\n command \"ssh -n -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']} powershell -File 'C:/Users/scm_auto_usr/copy_script.ps1'\"\n live_stream true\n action :run\n end\n\n # copy the audit patching file\n execute 'download-audi-patching-file' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/C:/Users/scm_auto_usr/lssec_secfixdb_all.tar.gz /opt/IBM/SCM/client/software/completed/\"\n live_stream true\n action :run\n not_if { ::File.exist?(node['tscm']['audit_file'].to_s) }\n end\n\n client_pref = shell_out(\"grep 'debug=true' #{node['tscm']['client_pref']} \").stdout.chop\n\n if client_pref.include?('debug=true')\n Chef::Log.info('File Up to date..........Nothing to do')\n else\n # update the client.pref file to debug mode\n execute 'update-client.pref' do\n command \"sed -i -e 's/debug=false/debug=true/' #{node['tscm']['client_pref']}\"\n action :run\n end\n\n # restarting TSCM agent service for changes to take effect\n service node['tscm']['service_name'].to_s do\n action :stop\n end\n\n service node['tscm']['service_name'].to_s do\n action :start\n end\n end\n end\n\n # installing on aix\n when 'aix'\n Chef::Log.info('Installing TSCM on AIX platform...........')\n\n if ::File.exist?(\"#{node['tscm']['installed_dir']}jacclient\")\n install_status = shell_out(\"#{node['tscm']['installed_dir']}jacclient status\").stdout.chop\n if install_status.include?('HCVIN0033I The Tivoli Security Compliance Manager client is currently running')\n Chef::Log.error('TSCM client already installed on ' + (node['tscm']['node_name']).to_s + '........Nothing to do')\n end\n else\n Chef::Log.info('TSCM not installed ........Installing TSCM ')\n\n # creating temporary directory for copying tscm binaries\n tempfolder = '/opt/IBM/tscm_software'\n\n directory tempfolder.to_s do\n action :create\n not_if { ::File.exist?(tempfolder.to_s) }\n end\n\n media = tempfolder.to_s + '/' + (node['tscm']['base_package']).to_s\n node.default['tscm']['package_name'] = (node['tscm']['base_package']).to_s.chomp('.tar')\n\n # downloading binaries from the url\n remote_file media.to_s do\n source node['tscm']['url'].to_s\n owner 'root'\n mode '0755'\n action :create_if_missing\n end\n\n # creating prerequisite FS\n # create volume group ibmvg as mandatory requirement\n execute 'create-VG-ibmvg' do\n command 'mkvg -f -y ibmvg hdisk1'\n action :run\n returns [0, 1]\n not_if { shell_out('lsvg | grep ibmvg').stdout.chop != '' }\n end\n\n # required FS\n volumes = [\n { lvname: 'lv_scm', fstype: 'jfs2', vgname: 'ibmvg', size: 500, fsname: '/opt/IBM/SCM' },\n ]\n # Custom FS creation\n volumes.each do |data|\n ibm_tscm_makefs \"creation of #{data[:fsname]} file system\" do\n lvname data[:lvname]\n fsname data[:fsname]\n vgname data[:vgname]\n fstype data[:fstype]\n size data[:size]\n end\n end\n\n # Unpacking TSCM media\n execute 'unpack-media' do\n command 'cd ' + tempfolder.to_s + ' ; ' + ' tar -xf ' + media.to_s\n action :run\n not_if { ::File.exist?(media.to_s + node['tscm']['package_name'].to_s + 'install_aix6.sh') }\n end\n\n # run the installation script\n bash 'install-tscm' do\n code <<-EOH\n cd #{tempfolder}\n chmod +x install_aix6.sh\n ./install_aix6.sh \n EOH\n end\n\n # copy the ssh key for TSCM to /opt/IBM/ directory\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n mode '400'\n action :create_if_missing\n end\n\n # create temp directory to copy the auditing patching file\n directory node['tscm']['patch_dir'].to_s do\n recursive true\n owner 'root'\n mode '0744'\n action :create\n end\n\n # copy the audit patching file\n execute 'download-audi-patching-file' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/C:/PROGRA~1/IBM/SCM/client/software/completed/lssec_secfixdb_all.tar.gz /opt/IBM/SCM/client/software/completed/\"\n action :run\n not_if { ::File.exist?(node['tscm']['audit_file'].to_s) }\n end\n\n # changing log-level to debug mode\n client_pref = shell_out(\"grep 'debug=true' #{node['tscm']['client_pref']} \").stdout.chop\n\n if client_pref.include?('debug=true')\n Chef::Log.info('File Up to date..........Nothing to do')\n else\n # update the client.pref file to debug mode\n execute 'update-client.pref' do\n command \"sed -e 's/debug=false/debug=true/g' #{node['tscm']['client_pref']}\"\n action :run\n end\n\n # restarting TSCM agent service for changes to take effect\n execute 'restart-tscm-service' do\n command '/opt/IBM/SCM/client/jacclient restart'\n action :run\n end\n end\n end\n end\nend",
"def build_vm_image\n options.verbose? ? @@log.level = Logger::DEBUG : @@log.level = Logger::ERROR\n def_constants(guess_os(\"fedora\"))\n\n # Override the machine type to launch if necessary\n $amz_options[:instance_type] = options[:instance_type] if options[:instance_type]\n $amz_options[:block_device_mappings] = {\"/dev/sdb\" => \"ephemeral0\"}\n \n # Establish a new connection\n conn = connect(options.region)\n \n image = nil\n # Create a new builder instance\n if (options.region?nil)\n image = conn.images[AMI[\"us-east-1\"]]\n elsif AMI[options.region].nil?\n puts \"No AMI specified for region:\" + options.region\n exit 1\n else\n image = conn.images[AMI[options.region]]\n end\n\n puts \"Launching AMI: #{image.id} - #{image.name}\"\n instance = launch_instance(image, \"oso-image-builder\", 1, SSH_USER)\n hostname = instance.dns_name\n puts \"Done\"\n puts \"Hostname: #{hostname}\"\n ssh(hostname, 'su - -c \"setenforce 0\"' , 60, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"yum update -y\"' , 300, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"yum install -y appliance-tools qemu-img\"' , 60, false, 1, SSH_USER)\n scp_to(hostname, File.expand_path(\"#{__FILE__ }/../templates/openshift-origin.ks\"), '/home/ec2-user/openshift-origin.ks', 60, 5,SSH_USER)\n scp_to(hostname, File.expand_path(\"#{__FILE__ }/../templates/openshift-origin.vmx\"), '/home/ec2-user/openshift-origin.vmx', 60, 5,SSH_USER)\n scp_to(hostname, File.expand_path(\"#{__FILE__ }/../templates/openshift-origin.vbox\"), '/home/ec2-user/openshift-origin.vbox', 60, 5,SSH_USER) \n ssh(hostname, 'su - -c \"mv -f /home/ec2-user/openshift-origin.ks /mnt/\"' , 60, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"mkdir -p /mnt/tmp/build && mkdir -p /mnt/openshift-origin\"', 60, false, 1,SSH_USER)\n ssh(hostname, 'su - -c \"which VBoxManage 2>&1 > /dev/null || yum install -y http://download.virtualbox.org/virtualbox/4.2.8/VirtualBox-4.2-4.2.8_83876_fedora18-1.x86_64.rpm\"', 60, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"cd /mnt && appliance-creator -d -n openshift-origin -c openshift-origin.ks ' +\n '--format=vmdk --vmem=1024 --checksum --logfile=build.log --tmpdir=/mnt/tmp/build --cache /mnt/tmp/cache/\"', 2400, false, 1, SSH_USER)\n ssh(hostname, 'su - -c \"' + %{\n /bin/cp -f /mnt/openshift-origin.ks /mnt/openshift-origin/ &&\n /bin/mv -f /home/ec2-user/openshift-origin.v* /mnt/openshift-origin/ && \n mkdir -p /root/.VirtualBox/ &&\n /bin/cp -f /mnt/openshift-origin/openshift-origin.vbox /root/.VirtualBox/openshift-origin.vbox &&\n ln -sf /mnt/openshift-origin/openshift-origin-sda.vmdk /root/.VirtualBox/openshift-origin-sda.vmdk &&\n pushd /root/.VirtualBox/ &&\n VBoxManage registervm openshift-origin.vbox &&\n VBoxManage storageattach \\\\\\\"OpenShift Origin\\\\\\\" --storagectl SATA --type hdd --port 0 --medium openshift-origin-sda.vmdk &&\n /bin/cp -f /root/.VirtualBox/openshift-origin.vbox /mnt/openshift-origin/openshift-origin.vbox && \n popd && \n cd /mnt/openshift-origin && tar zcf openshift-origin.tgz * &&\n VBoxManage unregistervm \\\\\\\"OpenShift Origin\\\\\\\"\n } + '\"' , 2400, false, 1, SSH_USER)\n FileUtils.mkdir_p \"vm/\"\n scp_from(hostname, \"/mnt/openshift-origin/openshift-origin.tgz\", \"vm/\", 1200, SSH_USER)\n begin\n terminate_instance(hostname) if options.terminate?\n rescue\n # suppress termination errors - they have been logged already\n end\n end",
"def release_step\n super\n puts @source_git_parent_path\n pem_path = File.expand_path('~/client.pem')\n knife_path = File.expand_path('~/knife.rb')\n\n unless @config.chef_supermarket_username || @config.chef_supermarket_key\n fail CapsuleCD::Error::ReleaseCredentialsMissing, 'cannot deploy cookbook to supermarket, credentials missing'\n end\n\n # knife is really sensitive to folder names. The cookbook name MUST match the folder name otherwise knife throws up\n # when doing a knife cookbook share. So we're going to make a new tmp directory, create a subdirectory with the EXACT\n # cookbook name, and then copy the cookbook contents into it. Yeah yeah, its pretty nasty, but blame Chef.\n metadata_str = CapsuleCD::Chef::ChefHelper.read_repo_metadata(@source_git_local_path)\n chef_metadata = CapsuleCD::Chef::ChefHelper.parse_metadata(metadata_str)\n\n Dir.mktmpdir {|tmp_parent_path|\n # create cookbook folder\n tmp_local_path = File.join(tmp_parent_path, chef_metadata.name)\n FileUtils.mkdir_p(tmp_local_path)\n FileUtils.copy_entry(@source_git_local_path, tmp_local_path)\n\n # write the knife.rb config jfile.\n File.open(knife_path, 'w+') do |file|\n file.write(<<-EOT.gsub(/^\\s+/, '')\n node_name \"#{@config.chef_supermarket_username }\" # Replace with the login name you use to login to the Supermarket.\n client_key \"#{pem_path}\" # Define the path to wherever your client.pem file lives. This is the key you generated when you signed up for a Chef account.\n cookbook_path [ '#{tmp_parent_path}' ] # Directory where the cookbook you're uploading resides.\n EOT\n )\n end\n\n File.open(pem_path, 'w+') do |file|\n file.write(@config.chef_supermarket_key)\n end\n\n command = \"knife cookbook site share #{chef_metadata.name} #{@config.chef_supermarket_type} -c #{knife_path}\"\n Open3.popen3(command) do |_stdin, stdout, stderr, external|\n { stdout: stdout, stderr: stderr }. each do |name, stream_buffer|\n Thread.new do\n until (line = stream_buffer.gets).nil?\n puts \"#{name} -> #{line}\"\n end\n end\n end\n # wait for process\n external.join\n unless external.value.success?\n fail CapsuleCD::Error::ReleasePackageError, 'knife cookbook upload to supermarket failed'\n end\n end\n }\n end",
"def create(resource_name)\n if ! advance? then return self end\n @@logger.debug \"Launching resource: #{resource_name}.\"\n resource = @resourcer.get resource_name\n deps = @resourcer.get_dep(resource_name)\n deps.each {|ref| create(ref)}\n created = @mutator.create(resource_name, resource)\n created.harp_script = @harp_script\n result = {:create => resource_name}\n args = {:action => :create}\n if created.output? (args)\n result[:output] = created.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n created.save\n return self\n end",
"def deploy\n # ensure the resource group is created\n params = @client.model_classes.resource_group.new.tap do |rg|\n rg.location = 'westus'\n end\n @client.resource_groups.create_or_update(@resource_group, params)\n\n # build the deployment from a json file template from parameters\n template = File.read(File.expand_path(File.join(__dir__, '../templates/template.json')))\n deployment = @client.model_classes.deployment.new\n deployment.properties = @client.model_classes.deployment_properties.new\n deployment.properties.template = JSON.parse(template)\n deployment.properties.mode = Azure::Resources::Profiles::Latest::Mgmt::Models::DeploymentMode::Incremental\n\n # build the deployment template parameters from Hash to {key: {value: value}} format\n deploy_params = DEPLOYMENT_PARAMETERS.merge(sshKeyData: @pub_ssh_key)\n deployment.properties.parameters = Hash[*deploy_params.map{ |k, v| [k, {value: v}] }.flatten]\n\n # log the request and response contents of Template Deployment.\n # By default, ARM does not log any content. By logging information about the request or response, you could\n # potentially expose sensitive data that is retrieved through the deployment operations.\n debug_settings = @client.model_classes.debug_setting.new\n debug_settings.detail_level = 'requestContent, responseContent'\n deployment.properties.debug_setting = debug_settings\n\n # put the deployment to the resource group\n @client.deployments.create_or_update(@resource_group, 'azure-sample', deployment)\n\n # See logged information related to the deployment operations\n operation_results = @client.deployment_operations.list(@resource_group, 'azure-sample')\n unless operation_results.nil?\n operation_results.each do |operation_result|\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n puts \"operation_id = #{operation_result.operation_id}\"\n unless operation_result.properties.nil?\n puts \"provisioning_state = #{operation_result.properties.provisioning_state}\"\n puts \"status_code = #{operation_result.properties.status_code}\"\n puts \"status_message = #{operation_result.properties.status_message}\"\n puts \"target_resource = #{operation_result.properties.target_resource.id}\" unless operation_result.properties.target_resource.nil?\n puts \"request = #{operation_result.properties.request.content}\" unless operation_result.properties.request.nil?\n puts \"response = #{operation_result.properties.response.content}\" unless operation_result.properties.response.nil?\n end\n end\n end\n end"
] | [
"0.5762656",
"0.56625205",
"0.5618709",
"0.56102574",
"0.5570687",
"0.55029815",
"0.5497632",
"0.5478713",
"0.54700017",
"0.545718",
"0.5423394",
"0.5391553",
"0.5349144",
"0.5340445",
"0.53124243",
"0.52754676",
"0.5273615",
"0.5273008",
"0.5272535",
"0.5266649",
"0.5237224",
"0.5229902",
"0.5228608",
"0.5211553",
"0.5209598",
"0.52009225",
"0.5169497",
"0.5159218",
"0.5158612",
"0.5150682",
"0.5145757",
"0.5144933",
"0.51422167",
"0.5131077",
"0.512758",
"0.51198936",
"0.5096473",
"0.5088074",
"0.5088074",
"0.5079724",
"0.50746",
"0.5071928",
"0.50714123",
"0.5066298",
"0.5063566",
"0.5056695",
"0.50490516",
"0.50461906",
"0.50315845",
"0.5019889",
"0.5001728",
"0.49950448",
"0.49936104",
"0.4983551",
"0.49828446",
"0.49812648",
"0.49789402",
"0.49741006",
"0.4959304",
"0.49360496",
"0.49266297",
"0.49264687",
"0.49166754",
"0.491101",
"0.4899306",
"0.48854795",
"0.48832723",
"0.48723674",
"0.48641166",
"0.48626778",
"0.48619655",
"0.4859214",
"0.4855615",
"0.48525515",
"0.48427784",
"0.48426664",
"0.4835862",
"0.48330006",
"0.48282376",
"0.4823052",
"0.48124284",
"0.48075953",
"0.4804532",
"0.48037612",
"0.4796955",
"0.47962382",
"0.47862017",
"0.47834125",
"0.47828242",
"0.47824767",
"0.4781748",
"0.47783953",
"0.47772372",
"0.4754632",
"0.4753422",
"0.47504342",
"0.47467223",
"0.4744295",
"0.47409606",
"0.4738443"
] | 0.57692736 | 0 |
Deletes a resource or all resource of a certain resource type from the server. | def delete(resource_type_identifier)
# convert type to type identifier
raise "Endpoint is not connected!" unless @connected
path = path_for_resource_type resource_type_identifier
del path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 remove(resource)\n resource.delete\n end",
"def delete(resource_type,identifier)\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n http_delete(path)\n end",
"def delete_resource(type, name, run_context: self.run_context)\n delete_resource!(type, name, run_context: run_context)\n rescue Chef::Exceptions::ResourceNotFound\n nil\n end",
"def delete_resource_action(type, id = nil, data = nil)\n api_resource(type, id, \"Detaching\") do |resource|\n delete_resource_main_action(type, resource, data)\n end\n end",
"def delete_resource!(type, name, run_context: self.run_context)\n run_context.resource_collection.delete(\"#{type}[#{name}]\").tap do |resource|\n # Purge any pending notifications too. This will not raise an exception\n # if there are no notifications.\n if resource\n run_context.before_notification_collection.delete(resource.declared_key)\n run_context.immediate_notification_collection.delete(resource.declared_key)\n run_context.delayed_notification_collection.delete(resource.declared_key)\n end\n end\n end",
"def delete\n @resource.delete\n end",
"def delete!\n @resource.delete!\n end",
"def destroy\n name, type = resource[:name].split('/')\n case type\n when 'MX'\n @dnsres.each do |res|\n preference = res.preference\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} MX #{preference} #{target}.\n send\")\n end\n when 'SRV'\n @dnsres.each do |res|\n priority = res.priority\n weight = res.weight\n port = res.port\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n rdata = @dnsres.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} #{type} #{rdata}\n send\")\n end\n end",
"def delete(resource)\n finder_or_run(:delete, resource)\n end",
"def delete(resource:)\n orm_object = resource_factory.from_resource(resource: resource)\n orm_object.delete\n resource\n end",
"def destroy\n begin\n if @resource_type.destroy\n respond_to do |format|\n format.html { redirect_to resource_types_url }\n format.json { head :no_content }\n end\n end \n rescue\n respond_to do |format|\n format.html { redirect_to \"index\", notice: \"Resource_type cann't delete.\" }\n end\n end\n end",
"def clear_resource\n if self.delete_resource && (self.delete_resource == '1' || self.delete_resource == true)\n self.resource = nil\n end\n end",
"def resource_delete klass, resource_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tnext unless p.class_exist?(klass.name)\n\t\t\t\t\t\tp.resource_delete klass.name, resource_name\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def delete(resource_type_identifier)\n raise Occi::Api::Client::Errors::NotImplementedError, \"#{__method__} is just a stub!\"\n end",
"def destroy\n RubyLokaliseApi::Generics::DeletedResource.new(\n reinit_endpoint.do_delete.content\n )\n end",
"def destroy_resource(resource)\n resource.destroy\n resource\n end",
"def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end",
"def destroy\n destroy_resource(resource)\n head :no_content\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy_resource(resource_name, resource_id)\n must_support! resource_name.to_s.pluralize\n result = connection.delete(\n api_uri([resource_name.to_s.pluralize, resource_id].join('/'))\n )\n result.status.is_no_content?\n end",
"def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end",
"def delete(resource)\n resource.client = self\n resource.delete\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end",
"def delete(resource, **params)\n\n execute(Net::HTTP::Delete, 'DELETE', resource, **params)\n\n end",
"def delete(resource_id)\n @delete_resource_mixin.delete(resource_id)\n end",
"def delete(resource_type, name, action_handler)\n delete_data(resource_type, name, action_handler)\n end",
"def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy_resource object\n object.destroy\n end",
"def deleteResource(resourceId)\n r = Resource.find_by_id(resourceId)\n if r\n if not r.comments.empty?\n r.comments.each do |comment|\n comment.destroy\n end\n end\n r.destroy\n end\n end",
"def remove_by_type_and_id(type, id)\n delete(resource_path_for_entity_type(type) + \"/#{id}\")\n end",
"def delete_resource(kind, id, pr)\n resource = retrieve_resource(kind, id)\n if OZones.is_error?(resource)\n return [404, resource.to_json]\n end\n\n if kind == \"vdc\"\n rc = @ocaInt.delete_vdc_in_zone(id)\n if OpenNebula.is_error?(rc)\n return [500, OZones::Error.new(\n \"Error: Couldn't delete resources from VDC with id #{id}, \" +\n \"aborting VDC deletion. Reason:\" + rc.message).to_json]\n end\n end\n\n if !resource.destroy\n return [500, OZones::Error.new(\n \"Error: Couldn't delete resource #{kind} with id #{id}\").to_json]\n else\n pr.update # Rewrite proxy conf file\n return [200, OZones.str_to_json(\n \"Resource #{kind} with id #{id} successfully deleted\")]\n end\n end",
"def destroy\n authorize :resquest_type, :destroy?\n @resquest_type.destroy\n respond_to do |format|\n format.html { redirect_to resquest_types_url, notice: 'Resquest type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def logical_delete\n if is_main?\n resource.status = 'DELETED'\n resource.save\n else\n destroy\n end\n end",
"def semantic_destroy(resource)\n resource.destroy\n end",
"def destroy\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.destroy\n flash[:success] = 'Resource was removed'\n format.html { redirect_to admin_resources_path }\n format.json { head :ok }\n else\n flash[:error] = @resource.errors.full_messages.join('')\n format.html { redirect_to admin_resources_path(@resource.id) }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def delete_resource(resource, version)\n log.debug \"deleting resource #{resource} #{version}\"\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n # delete either the file or directory from data dir\n File.delete data_file if File.file? data_file\n FileUtils.rm_rf data_file if File.directory? data_file\n end",
"def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n flash[:notice] = 'Resource was successfully deleted.'\n redirect_to resources_url\n end",
"def delete(resource,identifier)\n raise 'Not Yet Implemented'\n end",
"def delete_data(resource_type, name, action_handler)\n _chef_server = self.chef_server\n Chef::Provisioning.inline_resource(action_handler) do\n if resource_type == :machine\n chef_node name do\n chef_server _chef_server\n action :delete\n end\n else\n chef_data_bag_item name do\n chef_server _chef_server\n data_bag resource_type.to_s\n action :delete\n end\n end\n end\n\n backcompat_type = ChefManagedEntryStore.type_names_for_backcompat[resource_type]\n if backcompat_type && backcompat_type != resource_type\n delete_data(backcompat_type, name, action_handler)\n end\n end",
"def delete(params = {})\n Client.current.delete(resource_url, params)\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete_resource(resource_uri, opts)\n body, format = parse_body(opts)\n resource_type, resource_params = parse_uri(resource_uri, opts)\n authenticator = opts[:req].session[:authorizer]\n release_resource(body, resource_type, authenticator)\n end",
"def destroy_resource_content\n resource_content\n end",
"def destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend",
"def remove_resource(name)\n self.resources.delete(name)\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallresource = Mostsmallresource.find(params[:id])\n @mostsmallresource.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallresources_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if(resource.exist?)\n resource.lock_check if resource.supports_locking?\n resource.delete\n else\n NotFound\n end\n end",
"def delete(resource)\n unless id = @mappings[:id][:get].call(resource)\n raise ArgumentError, \"Attempted to delete a record without an ID\"\n end\n\n raw.delete(id)\n end",
"def destroy_resource(object)\n object.destroy\n end",
"def destroy\n debug \"Call: destroy on cs_resource '#{@resource[:name]}'\"\n pcs 'resource', 'disable', @resource[:name]\n pcs 'resource', 'cleanup', @resource[:name]\n pcs 'resource', 'delete', @resource[:name]\n end",
"def delete(resource)\n proxy(method: :delete, url: url_for(resource))\n end",
"def destroy\n @rtype = Rtype.find(params[:id])\n @rtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(rtypes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end",
"def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def delete(resource)\n orphan_resource(super)\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n resource.destroy\n respond_to do |format|\n format.html { redirect_to self.send(\"#{resource_class_name.pluralize.underscore}_url\"), notice: \"#{resource_class_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = @resource.user\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to polymorphic_path(complex_namespace_helper) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = @resource_finder.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to_resources }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cie_resource.destroy\n respond_to do |format|\n format.html { redirect_to registry_therapy_types_url, notice: 'Tipo de terapia fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def delete(resource_path, headers: {}, prefix: API_PREFIX)\n request(method: :delete, resource_path: resource_path, headers: headers, prefix: prefix)\n end",
"def destroy\n @q_resource = QResource.find(params[:id])\n @q_resource.bfile.remove!\n @q_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to q_resources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n resource.destroy\n respond_with resource\n end",
"def destroy\n resource.destroy\n respond_with resource\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def undestroy\n @resource = resource_proxy(true).find(params[:id])\n set_resource_instance\n\n @resource.deleted_at = nil\n @resource.save\n\n respond_with(@resource, location: { action: :index })\n\n # flash[:notice] = \"#{resource_name} has been undeleted\"\n # redirect_to action: :index\n end",
"def delete_resources\n ResourceEvent.where(resource_status_id: resource_statuses.map(&:id)).delete_all\n ResourceStatus.where(report_id: id).delete_all\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(realty_types_url) }\n format.xml { head :ok }\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 @resource_info = ResourceInfo.find(params[:id])\n @resource_info.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_infos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_resource.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy; delete end",
"def destroy\n @shared_resource.destroy\n respond_to do |format|\n format.html { redirect_to shared_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resources_data = ResourcesData.find(params[:id])\n @resources_data.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_datas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_resource_pool = Fundamental::ResourcePool.find(params[:id])\n @fundamental_resource_pool.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_resource_pools_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to @resource.host, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_type = EntityType.find(params[:id])\n \n respond_to do |format|\n if @entity_type.destroy\n format.html { redirect_to entity_types_url,\n notice: (crud_notice('destroyed', @entity_type) + \"#{undo_link(@entity_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to entity_types_url, alert: \"#{@entity_type.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @online_resource = OnlineResource.find(params[:id])\n @online_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to online_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permission_resource = PermissionResource.find(params[:id])\n @permission_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to permission_resources_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7760187",
"0.74323684",
"0.7356856",
"0.7341942",
"0.7256082",
"0.724888",
"0.72461456",
"0.7186073",
"0.7185984",
"0.71690214",
"0.71549994",
"0.6961346",
"0.6944077",
"0.6941925",
"0.6936339",
"0.6931385",
"0.69293946",
"0.69055855",
"0.6877403",
"0.6840426",
"0.6837754",
"0.6811617",
"0.67650414",
"0.6730693",
"0.6730693",
"0.6730693",
"0.67271215",
"0.6708638",
"0.66964036",
"0.6696153",
"0.66920483",
"0.66920483",
"0.66920483",
"0.66920483",
"0.6685046",
"0.6678061",
"0.6655244",
"0.6644744",
"0.6644305",
"0.6600299",
"0.6589113",
"0.6585118",
"0.65784585",
"0.65673953",
"0.6559825",
"0.65543354",
"0.6542157",
"0.6533115",
"0.6533115",
"0.6517075",
"0.65130776",
"0.64918894",
"0.64891964",
"0.64853853",
"0.64853853",
"0.6440365",
"0.6434957",
"0.6433725",
"0.6431069",
"0.63986003",
"0.6395652",
"0.6393377",
"0.6351232",
"0.6339697",
"0.63282424",
"0.63255835",
"0.63253963",
"0.6312595",
"0.63114053",
"0.63047385",
"0.6301281",
"0.6300815",
"0.62771666",
"0.62744445",
"0.62601656",
"0.62601656",
"0.62579113",
"0.6249236",
"0.62446725",
"0.62286973",
"0.622794",
"0.62265515",
"0.62265515",
"0.62265515",
"0.62265515",
"0.6225223",
"0.6220982",
"0.62201494",
"0.6218468",
"0.6217648",
"0.6209323",
"0.6209323",
"0.6209323",
"0.6209323",
"0.6204613",
"0.6203142",
"0.6187996",
"0.61804014",
"0.61801493",
"0.6172108"
] | 0.73212755 | 4 |
Triggers given action on a specific resource. | def trigger(resource_type_identifier, action)
# TODO: not tested
if @model.kinds.select { |kind| kind.term == resource_type }.any?
type_identifier = @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.first.type_identifier
location = @model.get_by_id(type_identifier).location
resource_type_identifier = @endpoint + location
end
# check some basic pre-conditions
raise "Endpoint is not connected!" unless @connected
raise "Unknown resource identifier! #{resource_type_identifier}" unless resource_type_identifier.start_with? @endpoint
# encapsulate the acion in a collection
collection = Occi::Collection.new
scheme, term = action.split(' #')
collection.actions << Occi::Core::Action.new(scheme + '#', term)
# make the request
path = sanitize_resource_link(resource_type_identifier) + '?action=' + term
post path, collection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_action\n raise \"Action for resource #{self.class} is nil!\" if @action.nil?\n\t\t\tif (self.respond_to? @action)\n\t\t\t\tself.send(@action)\n\t\t\tend\n\t\tend",
"def resource_action(resource)\n resource.action if resource.respond_to?(:action)\n end",
"def trigger(resource_type_identifier, action_instance)\n raise Occi::Api::Client::Errors::NotImplementedError, \"#{__method__} is just a stub!\"\n end",
"def enqueue_action_single_resource(action, type, id)\n raise BadRequestError, \"Must specify an id for changing a #{type} resource\" unless id\n\n physical_switch = resource_search(id, type, collection_class(type))\n\n api_action(type, id) do\n begin\n desc = \"Performing #{action} for #{physical_switch_ident(physical_switch)}\"\n api_log_info(desc)\n task_id = queue_object_action(physical_switch, desc, :method_name => action, :role => :ems_operations)\n action_result(true, desc, :task_id => task_id)\n rescue StandardError => err\n action_result(false, err.to_s)\n end\n end\n end",
"def perform_action\n action_name = params[:action_name].to_sym\n action = resource.member_actions[action_name]\n if action.is_method_action?\n @record.send(action.method_name)\n end\n if action.is_block_action?\n action.block.call(@record)\n end\n return redirect_to([app_kit, @record])\n end",
"def perform_update\n @resource = controller.send(model.name)\n resource.tap do\n trigger_event(:save) do\n update_and_save_resource\n end\n end\n end",
"def member_action(action)\n define_method(action) do\n self.resource ||= resource_scope.find(params[:id])\n\n EffectiveResources.authorize!(self, action, resource)\n\n @page_title ||= \"#{action.to_s.titleize} #{resource}\"\n\n member_post_action(action) unless request.get?\n end\n end",
"def trigger(_identifier, _action_instance)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end",
"def invoke_action(name)\n # used for self-reflection in views\n @action = name\n\n send(name)\n end",
"def perform!(resource_name, action, options = {})\n ClientOperations::Perform.new(resource_name, action, session, options).perform!\n end",
"def trigger\n ai = request_occi_collection(Occi::Core::ActionInstance).action\n check_ai!(ai, request.query_string)\n\n if params[:id]\n result = backend_instance.compute_trigger_action(params[:id], ai)\n else\n result = backend_instance.compute_trigger_action_on_all(ai)\n end\n\n if result\n respond_with(Occi::Collection.new)\n else\n respond_with(Occi::Collection.new, status: 304)\n end\n end",
"def perform(action, data = {})\n check_subscribed!\n subscription.perform_action(data.stringify_keys.merge(\"action\" => action.to_s))\n end",
"def _call_action(action)\n send(action)\n end",
"def resource_updated(resource, action)\n updates << [ resource, action ]\n end",
"def resource_action_start(resource, action, notification_type=nil, notifier=nil)\n end",
"def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end",
"def proxy_action(action)\n Chef::Log.debug(\"[#{new_resource} Running proxied #{action} action\")\n new_resource.subresources.each do |r|\n begin\n r.run_action(action) if r.allowed_actions.include?(action)\n rescue Chef::Exceptions::UnsupportedAction\n # Don't care, just move on.\n end\n end\n end",
"def _one_item_action(func, resource_id, action, data = nil)\n url = detail_action_url(resource_id, action)\n @api_request.send(\n func,\n url,\n data,\n nil,\n self,\n resource_id\n )\n end",
"def apply\n @item.run_action(@action_name, *@action_args, current_intention: self)\n end",
"def perform!(resource_name, action, options={})\n raise Copy::AuthenticationError unless session\n resource(resource_name).send(action, options_with_session(options))\n end",
"def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n check_action_whitelisted!(params[:action])\n authorize! params[:action].to_sym, resource\n instance_variable_set(\"@#{resource_name}\", resource)\n end",
"def invoke_action(path)\n controller(path).send(action_name)\n end",
"def invoke_action(name)\n end",
"def invoke_action(name)\n end",
"def invoke_action(name)\n end",
"def resource_action_command\n ACTION_COMMANDS[action_name.to_sym]\n end",
"def resource_updated(resource, action)\n # Output should be yellow (changes are applied)\n resource_exec_time = Time.now.to_f - @resource_start_time\n puts(\" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)\", :yellow)\n end",
"def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end",
"def resource_up_to_date(resource, action)\n end",
"def publication_perform_action\n publication = Publication.find_by_uuid!(params[:id])\n publication.send(ActionMethodLookup[params[:action_to_perform]])\n rescue Exception => e\n flash[:alert] = \"Couldn't not perform action '#{params[:action_to_perform]}' on publication\"\n Rails.logger.error(e.message)\n ensure\n redirect_to admin_all_publications_path\n end",
"def trigger(action_class, *args)\n if uses_concurrency_control\n trigger_with_concurrency_control(action_class, *args)\n else\n world.trigger { world.plan_with_options(action_class: action_class, args: args, caller_action: self) }\n end\n end",
"def authorize_resource\n EffectiveResources.authorize!(self, action_name.to_sym, resource)\n end",
"def update\n unless @action.nil?\n log_action( action.name, @environment[:api_key] )\n\n @success.call( action ) if @success && @action\n @action = nil;\n end\n end",
"def change(resource_id, data)\n @change_resource_mixin.change(resource_id, data)\n end",
"def resource_action?(resource_type, action)\n resource_check?(:actions, resource_type, action)\n end",
"def fire_action_event\n require 'canis/core/include/ractionevent'\n fire_handler :PRESS, ActionEvent.new(self, :PRESS, text)\n end",
"def process_action(...)\n send_action(...)\n end",
"def member_post_action(action)\n raise 'expected post, patch or put http action' unless (request.post? || request.patch? || request.put?)\n\n if save_resource(resource, action)\n flash[:success] ||= resource_flash(:success, resource, action)\n redirect_to(referer_redirect_path || resource_redirect_path)\n else\n flash.now[:danger] ||= resource_flash(:danger, resource, action)\n\n if resource_edit_path && (referer_redirect_path || '').end_with?(resource_edit_path)\n @page_title ||= \"Edit #{resource}\"\n render :edit\n elsif resource_new_path && (referer_redirect_path || '').end_with?(resource_new_path)\n @page_title ||= \"New #{resource_name.titleize}\"\n render :new\n elsif resource_show_path && (referer_redirect_path || '').end_with?(resource_show_path)\n @page_title ||= resource_name.titleize\n render :show\n else\n @page_title ||= resource.to_s\n flash[:danger] = flash.now[:danger]\n redirect_to(referer_redirect_path || resource_redirect_path)\n end\n end\n end",
"def flash_notice_for_resource_action(action = params[:action])\n return if resource_instance_variable.errors.any?\n\n case action.to_sym\n when :create\n verb = \"created\"\n when :update\n verb = \"updated\"\n when :destroy\n verb = \"removed\"\n end\n flash[:notice] = Alchemy.t(\n \"#{resource_handler.resource_name.classify} successfully #{verb}\",\n default: Alchemy.t(\"Successfully #{verb}\")\n )\n end",
"def action(&replacement_action)\n if replacement_action\n @action = replacement_action\n else\n @action\n end\n end",
"def action_run\n status = @recipe_helper.run(@new_resource.name, @new_resource.tags, @new_resource.attributes, @new_resource.match_all)\n Chef::Log.info \"Recipe executed '#{new_resource.name}' status:#{status}\"\n new_resource.updated_by_last_action(true)\n end",
"def exec_action_object(action)\n\t\t\taction.execute\n\t\tend",
"def wkf_action(action, context={})\n self.class.rpc_exec_workflow(action, self.id) #FIXME looks like OpenERP exec_workflow doesn't accept context but it might be a bug\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"def user_action_on_resource_authorized\n end",
"def action\n trigger :click\n end",
"def perform name\n real_action = action_for name\n raise Accessibility::LookupFailure.new(self, name) unless real_action\n perform real_action, for: @ref\n end",
"def default_handle_resource(resource, resource_type, resource_desc_str, action)\n question = \"#{action}?\".to_sym\n output_method = action.to_s.upcase\n\n b_ok = false\n\n if resource.send(question)\n outputs output_method, \"#{resource_desc_str} is already #{action}.\", :ok2\n b_ok = true\n else\n resource.send(action)\n\n if resource.send(question)\n outputs output_method, \"#{resource_desc_str} is #{action}.\", :ok\n b_ok = true\n else\n outputs output_method, \"#{resource_desc_str} could not be brought #{action}.\", :err\n end\n end\n\n state.update(resource_type, resource.name, action) if b_ok\n b_ok\n end",
"def send_action action_name, service_name\n self.class.actions[action_name][service_name].run(self)\n end",
"def authorize_action_for(authority_resource, *options)\n # `action_name` comes from ActionController\n authority_action = self.class.authority_action_map[action_name.to_sym]\n if authority_action.nil?\n raise MissingAction.new(\"No authority action defined for #{action_name}\")\n end\n\n Authority.enforce(authority_action, authority_resource, authority_user, *options)\n self.authorization_performed = true\n end",
"def perform( action, workitem )\n @action, @workitem = action, workitem\n\n begin\n send( action )\n run_callbacks\n rescue => e\n handle_exception( e )\n end\n end",
"def perform_action(*args)\n end",
"def resource_update_applied(resource, action, update)\n @updates_by_resource[resource.name] << update\n end",
"def action(action, *args)\n if @opSys == nil\n raise \"no operating system configured for vm #{@name}\"\n end\n \n script = \"./scripts/#{@opSys.type}/action_#{action}.#{@opSys.scriptExtension}\"\n \n # check if action script exists\n unless File.file? script\n raise \"#{@name} ==> no such action: #{action}\"\n end\n \n # call according script\n Vagrant.configure(2) do |config|\n config.vm.define @name do |m|\n m.vm.provision \"shell\" do |s|\n s.path = script\n if(args.length > 0)\n s.args = args \n end\n end\n end\n end\n \n # call triggers\n actConf = @conf.getAction(action)\n call_triggers(actConf)\n end",
"def method_missing(method_id, *args)\n return super unless @resource.respond_to? method_id\n @resource.public_send method_id, *args\n end",
"def set_action\n @action = Action.find(params[:id])\n end",
"def action_missing(name, *args)\n if name == action_name\n perform\n else\n raise AbstractController::ActionNotFound\n end\n end",
"def find_resource_action(name)\n resource_actions.detect { |action| action.name.to_sym == name.to_sym }\n end",
"def collection_action(action)\n define_method(action) do\n if params[:ids].present?\n self.resources ||= resource_scope.where(id: params[:ids])\n end\n\n if effective_resource.scope?(action)\n self.resources ||= resource_scope.public_send(action)\n end\n\n self.resources ||= resource_scope.all\n\n EffectiveResources.authorize!(self, action, resource_klass)\n\n @page_title ||= \"#{action.to_s.titleize} #{resource_plural_name.titleize}\"\n\n collection_post_action(action) unless request.get?\n end\n end",
"def resource_updated(new_resource, action)\n initialize_resource_report_if_needed(new_resource, action)\n current_resource_report.updated unless nested_resource?(new_resource)\n end",
"def trigger(*args)\n username, arguments = extract_username(args)\n trigger_id = get_id_from_arguments(arguments)\n\n get api_url(username, 'triggers', trigger_id)\n end",
"def action(name, &block)\n action = Moonrope::Action.new(@controller, name)\n action.dsl.instance_eval(&block) if block_given?\n @controller.actions[name] = action\n action\n end",
"def perform_action( position, action, estream, new_branch_info = nil )\n return send( action.specialize_method_name(\"perform\"), position, action, estream, new_branch_info )\n end",
"def perform_action(method, action)\n @client.send(method, \"/api/mod/conversations/#{id}/#{action}\")\n end",
"def can(action, resource, options={})\n before do\n ability.can action, resource, options\n end\n end",
"def perform action\n @ref.perform TRANSLATOR.cocoaify action\n end",
"def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end",
"def flash_notice_for_resource_action(action = params[:action])\n return if resource_instance_variable.errors.any?\n case action.to_sym\n when :create\n verb = \"created\"\n when :update\n verb = \"updated\"\n when :destroy\n verb = \"removed\"\n end\n flash[:notice] = _t(\"#{resource_handler.resource_name.classify} successfully #{verb}\", :default => _t(\"Succesfully #{verb}\"))\n end",
"def method_for_action(action_name); end",
"def action(&block)\n @action = block\n end",
"def acquire_action\n case @event['action']\n when 'create'\n 'error'\n when 'resolve'\n 'success'\n end\n end",
"def get_action(plugin, action_id)\n the_plugin = hawk_escape plugin\n the_action_id = hawk_escape action_id\n ret = http_get \"/actions/#{the_plugin}/#{the_action_id}\"\n Trigger::Action.new(ret)\n end",
"def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end",
"def run(*args)\n @action.call(args)\n end",
"def run(*args)\n @action.call(args)\n end",
"def perform_action(data)\n action = extract_action(data)\n\n raise UnproccessableActionError unless processable_action?(action)\n\n log(:debug) { log_fmt(\"Perform action #{action}(#{data})\") }\n dispatch_action(action, data)\n end",
"def resource_up_to_date(resource, action)\n # Output should be green\n resource_exec_time = Time.now.to_f - @resource_start_time\n puts(\" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)\", :green)\n end",
"def method_missing(id, *args, &blk)\n if @resource.respond_to?(id, true)\n @resource.send(id, *args, &blk)\n else\n super\n end\n end",
"def resource\n instance_variable_get(resource_name) || params[:id] && set_resource(controller_model.find(params[:id]))\n end",
"def action _obj, _args\n \"_obj action _args;\" \n end",
"def call_resource\n @env['kiwi.resource'].new(self).\n call(@env['kiwi.method'], @env['kiwi.path'], @env['kiwi.params'])\n end",
"def ar_resource_path action, resource= @resource\n # resource_method is a helper of auto_rest that determines the url helper method\n # name based on the presence of the parent.\n meth= \"#{controller.ardata.resource_method(@parent_resource, action)}_path\"\n \n case \n when @parent_resource && resource\n send meth, @parent_resource, resource\n when resource\n send meth, resource\n when @parent_resource\n send meth, @parent_resource\n else\n send meth\n end\n end",
"def setAction(action)\n @action = action\n end",
"def action!(name)\n action = action(name)\n\n unless action\n raise ActionNotFound, \"#{self.class.keyword} '#{_attributes_[:name]}' does not have the action '#{name}'\"\n end\n\n action\n end",
"def begin(resource)\n end",
"def load_resource_instance\n if new_actions.include?(params[:action].to_sym)\n build_resource\n elsif params[:id]\n find_resource\n end\n end",
"def register_subresource(resource)\n super.tap do |added|\n if added && action_on_update\n Chef::Log.debug(\"[#{self}] Registering #{action_on_update_immediately ? 'immediate ' : ''}#{action_on_update} notification from #{resource}\")\n resource.notifies action_on_update.to_sym, self, (action_on_update_immediately ? :immediately : :delayed)\n end\n end\n end",
"def action\n authorize! :read, @doc\n\n if request.post?\n User.create_action(params[:action_type], target: @doc, user: current_user)\n\n if params[:action_type] == \"star\"\n Activities::Doc.new(@doc).star\n end\n else\n User.destroy_action(params[:action_type], target: @doc, user: current_user)\n end\n @doc.reload\n end",
"def set_my_action\n @my_action = MyAction.find(params[:id])\n end",
"def action\n @action ||= flow.execute\n end",
"def set_action(action)\n @action = action\n end",
"def resource_actions=(value)\n @resource_actions = value\n end",
"def resource_actions=(value)\n @resource_actions = value\n end",
"def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end",
"def run_action_edit(item)\n validate_item(item)\n run_action_create(item)\n end",
"def on\n attachment = hpg_resolve(shift_argument)\n action(\"Activating #{attachment.config_var} (#{attachment.resource_name})\") do\n RestClient.post( authed_pgsnapshot_url('/client/resource'),\n json_encode({\"name\" => attachment.resource_name}) )\n end\n end",
"def set_resource_actions\n self.actions[:index] = Action.new(self.entity, :index, :collection, :resource => true)\n self.actions[:new] = Action.new(self.entity, :new, :collection, :resource => true)\n self.actions[:edit] = Action.new(self.entity, :edit, :member, :resource => true)\n self.actions[:show] = Action.new(self.entity, :show, :member, :resource => true)\n self.actions[:create] = Action.new(self.entity, :create, :collection, :method => :post, :resource => true)\n self.actions[:update] = Action.new(self.entity, :update, :member, :method => :put, :resource => true)\n self.actions[:delete] = Action.new(self.entity, :delete, :member, :method => :delete, :resource => true)\n end",
"def action\n ::HubEdos::Common::Reference::Descriptor.new(@data['action']) if @data['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 do_action(server, action)\n puts \"Checking action #{action} on server #{server.name}.\"\n if server.state == \"ACTIVE\"\n puts \"Doing action #{action} on server #{server.name}.\"\n server.send(action)\n end\n end",
"def remote_call_for_action_on_entity(action, entity, options = {})\n action or fail \"helper 'remote_call_for_action' lacks of input params.\"\n entity or return # do nothing\n action = action.to_s\n controller = options[:controller] || entity.controller_name\n options.merge!(:url => \"\\/#{controller}\\/#{action}\\/#{entity.to_param}\")\n remote_function_with_params(options) \n end"
] | [
"0.72843325",
"0.68376297",
"0.66839916",
"0.6670168",
"0.6620549",
"0.63868994",
"0.6315961",
"0.6310027",
"0.6249608",
"0.61784345",
"0.6167657",
"0.611064",
"0.6110357",
"0.6109257",
"0.61065155",
"0.6082767",
"0.6062792",
"0.6048649",
"0.60390425",
"0.60064507",
"0.5959702",
"0.5932547",
"0.59261894",
"0.59261894",
"0.5923779",
"0.5911292",
"0.5895182",
"0.5880577",
"0.58698463",
"0.58350277",
"0.57959825",
"0.57751817",
"0.5742119",
"0.5722828",
"0.5715766",
"0.57154936",
"0.57012427",
"0.56939834",
"0.5680576",
"0.5663052",
"0.56262815",
"0.5605848",
"0.55931365",
"0.5590393",
"0.55850106",
"0.5580584",
"0.55792785",
"0.55358666",
"0.5534973",
"0.55285436",
"0.5527008",
"0.5520421",
"0.5514394",
"0.55052257",
"0.54914874",
"0.5489712",
"0.54888076",
"0.54854274",
"0.54800665",
"0.5467869",
"0.5462198",
"0.54568905",
"0.5453815",
"0.54462916",
"0.54461265",
"0.544332",
"0.544056",
"0.5436596",
"0.5434121",
"0.5429294",
"0.54228455",
"0.541049",
"0.5408988",
"0.5408988",
"0.54067075",
"0.5384731",
"0.53821725",
"0.53746754",
"0.5366585",
"0.5342458",
"0.53412795",
"0.5337682",
"0.53375536",
"0.5321419",
"0.5318032",
"0.52938205",
"0.5292906",
"0.5289327",
"0.52873915",
"0.5282257",
"0.5281614",
"0.5281614",
"0.52802426",
"0.5278104",
"0.52730775",
"0.52694917",
"0.5261918",
"0.5253691",
"0.52526283",
"0.5246025"
] | 0.6943681 | 1 |
Refreshes the Occi::Model used inside the client. Useful for updating the model without creating a new instance or reconnecting. Saves a lot of time in an interactive mode. | def refresh
# re-download the model from the server
set_model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh\n if new_model?\n return WscSdk::Errors.model_does_not_exist(self.endpoint)\n else\n return self.endpoint.refresh(self)\n end\n end",
"def reload!\n ensure_service!\n @gapi_json = service.get_model dataset_id, model_id\n @reference = nil\n @exists = nil\n self\n end",
"def reload\n model = self.class.find(to_remote)\n\n if model.errors?\n add_errors(model.errors)\n else\n copy_from(model)\n persist!\n end\n\n self\n end",
"def reload\n raise Couchbase::Error::MissingId, 'missing id attribute' unless @id\n pristine = model.find(@id)\n update_attributes(pristine.attributes)\n @meta[:cas] = pristine.meta[:cas]\n clean!\n self\n end",
"def refresh\n update_attributes_from_id(@id)\n end",
"def reload\n return if new_record?\n refresh\n end",
"def refresh\n set_attributes\n end",
"def refresh\n return unless self[\"@odata.id\"]\n\n # TODO(@tadeboro): raise more sensible exception if resource cannot be\n # refreshed.\n @connector.reset(self[\"@odata.id\"])\n initialize_from_service(self[\"@odata.id\"])\n end",
"def reload(options = nil)\n clear_changes\n clear_relationships\n clear_composition_cache\n reset_attributes\n unless reload_from_database\n set_deleted_properties\n freeze\n end\n self\n end",
"def refresh!\n self.class.find(id)\n end",
"def refresh!\n self.class.find(id)\n end",
"def reload!\n clear_changes_information\n self.exclude_from_save = false\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def reload\n refresh\n end",
"def reload\n refresh\n end",
"def refresh\n do_refresh\n self\n end",
"def reload\n self\n end",
"def refresh\n raise \"Can't refresh a resource without a REST Client\" unless @client\n @updated = false\n set_up_properties_from(@client.get(@path))\n self\n end",
"def refresh\n raise \"Can't refresh a resource without a REST Client\" unless @client\n @updated = false\n set_up_properties_from(@client.get(@path))\n self\n end",
"def _save_refresh\n _save_set_values(_refresh_get(this.server?(:default)) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end",
"def _save_refresh\n _save_set_values(_refresh_get(this.server?(:default)) || raise(NoExistingObject, \"Record not found\"))\n changed_columns.clear\n end",
"def refresh\n # FIXME\n end",
"def save_and_reload! model\n model.save!\n model.reload\nend",
"def refresh\n self.class.new(__getobj__)\n end",
"def refresh\n fetch_api_data\n self\n end",
"def reload!\n fetch_data!\n end",
"def refresh\n do_refresh\n end",
"def refresh\n do_refresh\n end",
"def reload\n begin_reset_model\n clear\n\n @items_to_models = Hash.new\n @models_to_items = Hash.new\n @names_to_item = Hash.new\n @items_metadata = Hash[self => Metadata.new([], [], Set.new)]\n @resolver_from_model = Hash.new\n\n seen = Set.new\n sorted_roots = @root_models.\n sort_by(&:priority).reverse\n\n sorted_roots.each do |root_model|\n models = discover_model_hierarchy(root_model.model, root_model.categories, root_model.resolver, seen)\n models.each do |m|\n @resolver_from_model[m] = root_model.resolver\n end\n end\n\n rowCount.times do |row|\n compute_and_store_metadata(item(row))\n end\n self.horizontal_header_labels = [\"\"]\n ensure\n end_reset_model\n end",
"def refresh!\n records true\n self\n end",
"def refresh\n store\n\n render\n\n self\n end",
"def reload\n return false if !persisted?\n fresh_object = self.class.find(id)\n refresh_data fresh_object.instance_variable_get('@attributes')\n self\n end",
"def reload\n clear_memoizations!\n perform_reload\n self\n end",
"def reload!\n @data = reload.raw\n self\n end",
"def reload\n self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data\n end",
"def refresh!\n self.data = client.get(path).data\n end",
"def refresh\n load if changed?\n end",
"def refresh(resource)\n resource.client = self\n resource.refresh\n end",
"def reload!\n if saved?\n response = GoodData.get(uri)\n @json = response\n end\n self\n end",
"def reload!(conditions = {})\n unless new_record?\n reloaded_object = self.class.find(client, primary_key, scope_parameters, conditions)\n self.attributes.clear\n self.attributes = reloaded_object.attributes\n mark_as_saved!\n end\n\n self\n end",
"def reload\n do_url 'reload', :put\n end",
"def reload\n end",
"def reload!\n load force: true\n end",
"def reload\n begin_reset_model\n @id_to_module = []\n @filtered_out_modules = Set.new\n \n info = discover_module(Object)\n info.id = id_to_module.size\n info.name = title\n update_module_type_info(info)\n info.row = 0\n id_to_module << info\n\n @object_paths = Hash.new\n generate_paths(object_paths, info, \"\")\n ensure\n end_reset_model\n end",
"def reload\n self.attributes = self.class.find(self.Id).attributes\n self\n end",
"def refresh\n end",
"def refresh\n raise NotImplementedError.new('I do not know how to refresh myself, please implement it in subclass.')\n end",
"def reload\n get\n end",
"def reload\n self.data = self.class.load_data\n self\n end",
"def reload\n\t\tself.request( :reload )\n\tend",
"def reload\n self.edits.clear\n end",
"def refresh(op)\n check_connection\n @protocol.refresh_command op\n self\n end",
"def start_refresh\n self.refresh_in_progress = true\n save\n end",
"def reload(options = nil)\n self.class.connection.clear_query_cache\n\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { self.class.lock(options[:lock]).find(id) }\n else\n self.class.find(id)\n end\n\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n @new_record = false\n self\n end",
"def refresh\r\n @view.refresh\r\n end",
"def reload\n self.attributes = Connection.get(create_route(:get)).body['data']\n self\n end",
"def refresh\n end",
"def refresh\n end",
"def reload\n requires :instance, :identity\n\n data = collection.get(self.instance, self.identity)\n merge_attributes(data.attributes)\n self\n end",
"def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end",
"def refresh\n # logger.debug(\"refreshing registration #{to_param}\")\n self.last_all_fetch = nil\n self.last_day_fetch = nil\n self.save!\n end",
"def reload!\n get('')[self.class.api_name].each do |attr, value|\n self.send :\"#{attr}=\",value\n end\n end",
"def reload\n raise \"Can't reload object without id\" if !@id || @id.to_i == 0\n new_obj = self.class.find(@id)\n self.database_fields = new_obj.database_fields\n self.class.table_fields.each {|key| self.send(\"#{key}=\", new_obj.send(key)) }\n end",
"def reload_after_odata(options = nil)\n # aggregations.rb\n clear_aggregation_cache\n\n # autosave_association.rb\n @marked_for_destruction = false\n @destroyed_by_association = nil\n\n # associations.rb\n clear_association_cache\n\n # persistence.rb (only 1 line of code chaned in here)\n self.class.connection.clear_query_cache\n\n fresh_object =\n if options && options[:lock]\n self.class.unscoped { self.class.lock(options[:lock]).find(id) }\n else\n # Remove unscope here\n self.class.find(id)\n end\n\n @attributes = fresh_object.instance_variable_get(\"@attributes\")\n @new_record = false\n\n # attribute_methods/dirty.rb\n @previous_mutation_tracker = nil\n clear_mutation_trackers\n @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new\n\n self\n end",
"def reload\n @instance = nil\n self.instance\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def refresh!\n raise NotImplementedError, \"#refresh! is not implemented on #{@provider}:#{@type}\"\n end",
"def refresh!\n load if changed?\n end",
"def refresh!; end",
"def reload\n requires :identity\n\n data = collection.get(identity)\n merge_attributes(data.attributes)\n self\n end",
"def reload\n new_attributes = resource.find(self)._attributes_\n @_attributes_ = nil\n mass_assign(new_attributes)\n self\n end",
"def reload\n requires :instance, :identity\n\n data = collection.get(instance, identity)\n merge_attributes(data.attributes)\n self\n end",
"def reload!\n @client = EspSdk::Api.new(@options)\n 'Reloaded!'\n end",
"def reload\n @dirty = []\n @cache = Preference.find_all_by_model_type_and_model_id(@model.class.name, @model.id).index_by(&:key)\n end",
"def update\n update_cache\n reload\n\n self\n end",
"def refresh\r\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get\n end",
"def refresh_node_group_model(node_group_model)\n get_node_group(node_group_model['id'])\n end",
"def refresh\n raise Occi::Api::Client::Errors::NotImplementedError, \"#{__method__} is just a stub!\"\n end",
"def reload_with_clear_original_attributes #:nodoc:\n clear_original_attributes\n reload_without_clear_original_attributes\n end",
"def reload\n reset\n to_a\n self\n end",
"def reload\n if @self\n @self.reload rescue nil\n @self = nil\n end\n end",
"def reload!\n Aura.models.each { |m| m.send :set_columns, nil }\n end",
"def reload_data\n reset_collection_data\n reload_collection_data\n end",
"def refresh\n send_cmd \"refresh\"\n nil\n end",
"def reload!\n end",
"def refresh\n raise ConnectionError.new(\"Connection closed\") unless open?\n\n use_service do |service|\n service.ResetCatalog\n end\n end",
"def reload\n end",
"def reload\n end",
"def reload_model(*models)\n models.each &:reload\n end",
"def refresh!\n description.update!(send_messages([ refresh_command ]).documents[0])\n end",
"def refresh!\n refresh_expiry\n save!\n end",
"def reload\n restart\n end"
] | [
"0.72774494",
"0.69155174",
"0.6836855",
"0.6687198",
"0.6518902",
"0.6508058",
"0.64933074",
"0.6480971",
"0.6407291",
"0.6396982",
"0.6396982",
"0.63861495",
"0.6360549",
"0.6360549",
"0.6346192",
"0.6346192",
"0.6329491",
"0.623688",
"0.6203208",
"0.6203208",
"0.62001175",
"0.62001175",
"0.61872655",
"0.6184717",
"0.6156957",
"0.6153101",
"0.61438483",
"0.61335087",
"0.61335087",
"0.6109881",
"0.6093249",
"0.6062434",
"0.6050367",
"0.60310096",
"0.6003024",
"0.5976046",
"0.59642404",
"0.59524685",
"0.5933701",
"0.59218967",
"0.59195405",
"0.5917073",
"0.5914779",
"0.5914748",
"0.5893741",
"0.5870595",
"0.58612645",
"0.58556604",
"0.58523405",
"0.5850103",
"0.58321124",
"0.582826",
"0.5814231",
"0.5803262",
"0.5792882",
"0.57803977",
"0.57642025",
"0.576362",
"0.576362",
"0.5759186",
"0.5748341",
"0.5739622",
"0.57389444",
"0.57267916",
"0.57193357",
"0.57173187",
"0.57165724",
"0.57165724",
"0.57165724",
"0.57165724",
"0.57165724",
"0.57165724",
"0.57165724",
"0.5710107",
"0.5703032",
"0.56989753",
"0.56979215",
"0.5696415",
"0.56944025",
"0.5690965",
"0.5680815",
"0.567851",
"0.56774867",
"0.56738716",
"0.56723064",
"0.56700134",
"0.5662562",
"0.5658906",
"0.5656954",
"0.56508255",
"0.56367636",
"0.56354576",
"0.56307334",
"0.5621923",
"0.56180984",
"0.56180984",
"0.56171244",
"0.56118375",
"0.56117487",
"0.5600575"
] | 0.82634836 | 0 |
Performs GET request and parses the responses to collections. | def get(path='', filter=nil)
# remove the leading slash
path = path.gsub(/\A\//, '')
response = if filter
categories = filter.categories.collect { |category| category.to_text }.join(',')
attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')
headers = self.class.headers.clone
headers['Content-Type'] = 'text/occi'
headers['Category'] = categories unless categories.empty?
headers['X-OCCI-Attributes'] = attributes unless attributes.empty?
self.class.get(@endpoint + path, :headers => headers)
else
self.class.get(@endpoint + path)
end
response_msg = response_message response
raise "HTTP GET failed! #{response_msg}" unless response.code.between? 200, 300
Occi::Log.debug "Response location: #{('/' + path).match(/\/.*\//).to_s}"
kind = @model.get_by_location(('/' + path).match(/\/.*\//).to_s) if @model
Occi::Log.debug "Response kind: #{kind}"
if kind
kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil
entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link
end
Occi::Log.debug "Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}"
collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)
Occi::Log.debug "Parsed collection: empty? #{collection.empty?}"
collection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(options = {})\n url = build_url(options)\n puts \"Getting #{url}\"\n\n json = get_response(url)\n\n if self.is_json?\n data = JSON.parse(json)\n else\n data = XmlSimple.xml_in(json)\n end\n\n # TODO: Raise hell if there is a problem\n\n collection = OpenCongressApi::Collection.build(json_result(data))\n collection.map!{|result| format_result(result)}\n end",
"def fetch(options = {})\n validate_collection_options(options)\n\n collection_class.new(client.get(base_uri, options).body, client)\n end",
"def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"def fetch\n @_fetch ||= begin\n path = @parent.build_request_path(@query_attrs)\n @parent.request(@query_attrs.merge(:_method => :get, :_path => path)) do |parsed_data, response|\n @parent.new_collection(parsed_data)\n end\n end\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def perform_get_with_objects_from_collection(path, options, klass, collection_name)\n perform_request_with_objects_from_collection(:get, path, options, klass, collection_name)\n end",
"def index\n @collections = Collection.all\n respond_with(@collections)\n end",
"def perform\n @response = Configuration.client.get(self.url + self.params, self.to_json)\n if @response.failure?\n STDERR.puts \"[REQUEST FAILED] #{self.to_curl}\\n\"\n raise SearchRequestFailed, @response.to_s\n end\n @json = MultiJson.decode(@response.body)\n @results = @json['responses'].map {|response| Results::Collection.new(response, @options)}\n return self\n ensure\n logged\n end",
"def fetch(options = {})\n\n url = build_url(options)\n\n puts \"this is the url #{url}\"\n puts \"these are the options #{options}\"\n\n json = get_response(url)\n\n puts json.to_yaml\n\n data = JSON.parse(json)\n\n #puts \"dump data after parse: #{data.to_yaml}\"\n\n # Check to see if the api returned an error\n raise ApiError.new(data['details'],url) if data.has_key?('problem')\n\n\n if !options[:id]\n\n puts \"in options\"\n\n collection = RMeetup::Collection.build(data)\n\n #puts \"value of collection:#{collection.to_yaml}\"\n\n # Format each result in the collection and return it\n collection.map!{|result| format_result(result)}\n\n return collection\n else\n puts \"not in options\"\n return data\n\n end\n\n\n end",
"def api_get_collection(path, collection, page_number: 1, page_size: 100, **kwargs)\n Enumerator.new do |enum|\n loop do\n query = kwargs.fetch(:query, '')\n query += '&' unless query.empty?\n query += \"pageSize=#{page_size}&pageNumber=#{page_number}\"\n new_kwargs = kwargs.merge(query: query)\n\n res = api_get(path, **new_kwargs)\n raise TableauError, res if res.code.to_s != '200'\n\n # ensure the result is an array because it will not be an array if there is only one element\n [collection.split('.').reduce(res['tsResponse']) { |acc, elem| acc && acc[elem] }].flatten.compact.each do |obj|\n enum.yield obj\n end\n\n break if res['tsResponse']['pagination'].nil?\n break if page_number >= (res['tsResponse']['pagination']['totalAvailable'].to_i / page_size.to_f).ceil\n\n page_number += 1\n end\n end\n end",
"def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\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 list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\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 list\n url = prefix + \"list\"\n return response(url)\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def all\n api_get(path)\n end",
"def all(options = {})\n response = client.get(base_path, options)\n\n return parse(response) unless block_given?\n\n yield response\n end",
"def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def get\n start { |connection| connection.request http :Get }\n end",
"def fetch\n @results = []\n @http.start unless @http.started?\n @pairs.each do |pair|\n uri = URI(format(self.class.const_get(:ENDPOINT), pair))\n request = Net::HTTP::Get.new(uri)\n\n with_retry Net::HTTPBadResponse, JSON::ParserError do\n @results << [pair, JSON.parse(@http.request(request)&.body)]\n end\n end\n self\n end",
"def index\n @collections = get_collections(@state);\n respond_to do |format| \n respond_do(format, @collections)\n end \n end",
"def list\n call(:get, path)\n end",
"def all(options = {})\n raise MethodNotAllowed.new(self, :all) unless self.class.permissions && self.class.permissions[:read]\n response_body = http_get(parse_params(options))\n response = parse_response(response_body, options)\n response_items = response.response_items || []\n end",
"def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end",
"def list\n get()\n end",
"def index\n respond_with Collection.all\n end",
"def index\n respond_with Collection.all\n end",
"def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end",
"def get\n if(resource.exist?)\n #print_range(request)\n res = resource.get(request, response)\n if(res == OK && !resource.collection?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Content-Length'] = resource.content_length.to_s\n response['Last-Modified'] = resource.last_modified.httpdate\n end\n res\n else\n NotFound\n end\n end",
"def collections\n response = RequestResponse.new\n name_resp = collection_names\n name_resp.callback do |names|\n collections = names.map do |name|\n EM::Mongo::Collection.new(@db_name, name, @em_connection)\n end\n response.succeed collections\n end\n name_resp.errback { |err| response.fail err }\n response\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def list_collections_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CollectionsApi.list_collections ...'\n end\n # resource path\n local_var_path = '/v4/collections'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].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] || 'ListCollectionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['BasicAuth']\n\n new_options = opts.merge(\n :operation => :\"CollectionsApi.list_collections\",\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: CollectionsApi#list_collections\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end",
"def list\n get('/')\n end",
"def index\n @gets = Get.all\n end",
"def index\n respond_with(@collection) do |format|\n format.json { render :json => @collection.to_json(collection_serialization_options) }\n end\n end",
"def index\n conditions = { :client_id => @client.id }\n if params[\"tags\"]\n conditions.merge!({:tags => params[\"tags\"]})\n end\n\n @collections = Collection.where(conditions).order('updated_at DESC')\n @collections.reject! { |item| ! item.read?(@user, @client) }\n\n entries = Array.new\n if @collections\n @collections.each do |item|\n entries << item.info_hash(@user, @client)\n end\n end\n render_json :entry => entries and return\n end",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def get\n JSON.parse(self.class.get(url).response.body)\n end",
"def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def query(options = {})\n paginate = if options.has_key?(:paginate)\n options.delete(:paginate)\n else\n true\n end\n\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for\n\n request = api_client.get(url, options)\n\n if request.success?\n raw_results = []\n\n metadata = Automatic::Models::Response::Metadata.new(request.body.fetch('_metadata', {}))\n link_header = Automatic::Models::Response::LinkHeader.new(request.headers['Link'])\n links = link_header.links\n\n raw_results.concat(request.body.fetch('results', []))\n\n if links.next? && paginate\n loop do\n request = api_client.get(links.next.uri)\n\n link_header = Automatic::Models::Response::LinkHeader.new(request.headers['Link'])\n links = link_header.links\n\n raw_results.concat(request.body.fetch('results', []))\n\n break unless links.next?\n end\n end\n\n raw_results\n else\n raise StandardError.new(request.body)\n end\n end",
"def find_all\n response = fetch()\n new(response)\n end",
"def get\n raise NoMethodError unless is_full_route? @cur_route\n @retrieved_url = @cur_url\n response = HTTParty.get(\"https://api.uwaterloo.ca/v2#{@cur_url}.json\", { query: { key: @api_key, format: 'json' } })\n case response.code\n when 400...600\n raise \"UWaterloo API Server returned a #{response.code} error\"\n end\n @response = RecursiveOpenStruct.new response, recurse_over_arrays: true\n @meta = response['meta']\n @response.data\n end",
"def get\n res = connection.get url.to_s\n Response.const_get(class_basename).new res.body, res.status\n end",
"def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def get\n check_response( @httpcli.get(@endpoint) )\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n respond_with(Response.collection_as_unity_JSON(:all))\n end",
"def catalogs\n path = \"#{api_root}/index/catalogs\"\n process_api_request(:get, path)\n end",
"def available_collections\n api = API.new\n params = {:limit => 9999, :preserve_original => true}\n response = api.send_and_receive('collections', {:params => params})\n response.map {|n| [n['title'], n['identifier']]}\n end",
"def retrieve!\n response = @client.rest_get(self.class::BASE_URI)\n body = @client.response_handler(response)\n set_all(body)\n true\n end",
"def get_user_collections()\n uri = build_uri('info/collections')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end",
"def perform_get_with_object_from_collection(path, options, klass, collection_name)\n perform_request_with_object_from_collection(:get, path, options, klass, collection_name)\n end",
"def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end",
"def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end",
"def call\n response = client.mget options\n\n pairs = response[\"docs\"].map { |doc| [doc[\"_id\"], doc[\"_source\"]] }\n\n pairs.to_h\n end",
"def index\n respond_with(@collection) do |format|\n format.html\n format.json { render :json => json_data }\n end\n end",
"def fetch\n fetch_response.results\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def view\n if params[:id]\n [client.get(params)]\n elsif params[:scroll]\n scroll_enumerator(client, response)\n else\n response.fetch(\"hits\").fetch(\"hits\")\n end\n end",
"def call(**params)\n url = construct_url(**full_params(params))\n\n @client.get(url).yield_self do |response|\n guard_errors!(response)\n self.class.parse(response.body)\n end\n rescue API::Error\n raise # Not catching in the next block\n rescue StandardError => e\n raise unless url\n raise API::Error, \"#{e.class} at #{url}: #{e.message}\"\n end",
"def get_data\n uri = URI(\"#{@url_base}/#{@url_path}\")\n uri.query = @params\n use_ssl = { use_ssl: uri.scheme == 'https', verify_mode: OpenSSL::SSL::VERIFY_NONE }\n response = {}\n\n Net::HTTP.start(uri.host, uri.port, use_ssl) do |http|\n request = Net::HTTP::Get.new(uri)\n response = http.request(request)\n end\n\n raise JSON.parse(response.body)['error'] if !JSON.parse(response.body)['error'].nil?\n\n raise \"page_arg_must_be_integer\" if !@page_number.empty? && @page_number.scan(/\\d/).join('').to_i == 0\n\n raise \"no_response\" if JSON.parse(response.body).nil?\n\n raise \"no_orders_found\" if JSON.parse(response.body)['orders'].nil?\n\n { res: JSON.parse(response.body), status: get_response_status(response) }\n end",
"def solr_collection_api(host_name,port,params,config_name=nil,path=\"/solr/admin/collections\")\n if not config_name.nil?\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&collection.configName=\"+config_name+\"&wt=json\"\n else\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&wt=json\"\n end\n Chef::Log.info(\" HostName = \" + host_name + \", Port = \" + port + \", Path = \" + path)\n http = Net::HTTP.new(host_name, port)\n req = Net::HTTP::Get.new(path)\n\n unless !SolrAuth::AuthUtils.auth_enabled?\n admin_creds = SolrAuth::AuthUtils.get_solr_admin_credentials\n req.basic_auth(admin_creds['username'], admin_creds['password'])\n end\n response = http.request(req)\n if response != nil then\n return JSON.parse(response.body())\n end\n raise StandardError, \"empty response\"\n end",
"def read_collections\n site.collections.each_value do |collection|\n next if collection.data?\n\n collection.read\n end\n end",
"def collection\n return @client.api_helper.collection(\"items\")\n end",
"def get\n @response = Net::HTTP.get_response(URI(@url))\n end",
"def index\n\t\tif user_signed_in? && (current_user.has_role? :admin)\n\t\t\t@collections = Collection.order(\"created_at DESC\")\n\t\telse\n\t\t\t@collections = Collection.where(published: true).order(\"created_at DESC\")\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @collections }\n\t\tend\n\tend",
"def collection\n if @collection.empty? && @loaded == false\n @collection = forward( :\"#{@key}_fetch!\" ) || @collection || []\n @loaded = true\n end\n\n @collection\n end",
"def fetch!\n old_path = path\n if old_path && path.length > 0\n path = \"\"\n @results = get(old_path, @options)\n end\n end",
"def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def get_all\n get_docs\n get_text\n return JSON.pretty_generate(@data)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def all(options = {})\n response = get(options)\n xml = Nokogiri::XML(response).css(\"#{defaults[:collection_name]}\")\n \n collection = xml.inject([]) do |result, item|\n result << new(item)\n result\n end\n collection\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def _ls\n @response[:list] = []\n end",
"def all\n results_from(response)\n end",
"def fetch(request) \n\t\ttable_name = @model.table_name\n\t\tdata = request.data\n\t\t# check the advanced cretira\n\t\tunless request.advancedCriteria.nil?\t\t\t\n\t\t\tquery = buildAdvancedCriteria(request, table_name)\n\t\t\t@obj_items = @model.find_by_sql(query) \n\t\telse\n\t\t\tunless request.data.empty?\n\t\t\t\tquery = buildStandardCriteria(request, table_name)\n\t\t\t\t@obj_items = @model.find_by_sql(query) \n\t\t\telse\n\t\t\t\t@obj_items = @model.find(:all) \n\t\t\tend\n\t\tend\t\t \n\t\tobjs_count = @obj_items.count\n\t\t# get the count of the obj_items \n\t\tendRow = (objs_count > 0)?objs_count - 1 : objs_count\n\n\t\t# make the Response result object \n\t\tresponse = DSResponse.new\n\t\tresponse.data = @obj_items\n\t\tresponse.startRow = 0\n\t\tresponse.endRow = endRow\n\t\tresponse.status = 0\n\t\tresponse.totalRow = objs_count \n\n\t\treturn response \n end",
"def requests\n @requests_obj.list\n end",
"def get()\n return @http.request(@req)\n end",
"def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def _get\n http_method(:get)\n end",
"def results(client)\n @client = client\n\n res = @client.search\n collections = load_all(res.data.hits.hit.map(&:id))\n if @client.parameters[:size] && @client.parameters[:start]\n round_correct_page\n\n Nazrin.paginated_array(\n collections,\n current_page: @current_page,\n per_page: @client.parameters[:size],\n total_count: res.data.hits.found,\n last_page: @last_page)\n else\n collections\n end\n end",
"def show\n set_meta_tags title: @application.name + ' | Collections - Repositories'\n @access_tokens = @application.access_tokens.where(resource_owner: current_user)\n @token = @access_tokens.last\n if params[:q].present?\n url = \"#{@application.url}?q=#{url_encode(params[:q])}&limit=#{params[:limit]}\"\n begin\n response = RestClient.get(url, {:Authorization => \"#{@token.try(:token_type)} #{@token.try(:token)}\"})\n rescue Errno::ECONNREFUSED\n puts \"Server at #{url} is refusing connection.\"\n flash.now[:warning] = \"Results from #{@application.name} missing. Can't connect to server.\"\n end\n @results = JSON.parse(response) if response\n end\n end",
"def index\n @custom_collections = CustomCollection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @custom_collections }\n end\n end",
"def collection(http_verb, action = nil, body = nil, options)\n actual_client(options).send(http_verb, path(action), body, options)\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 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 http( *args )\n p http_get( *args )\n end",
"def fetch\n endpoint = URI(uri)\n Net::HTTP.get(endpoint)\n rescue *@errors => e\n pp e\n nil\n end",
"def index\n @data_collections = DataCollection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_collections }\n end\n end",
"def call()\n json = do_request()\n parse(json)\n end",
"def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend",
"def get_document_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocumentApi.get_document_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/document'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageDocument')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentApi#get_document_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def perform_get_with_objects(path, options, klass)\n perform_request_with_objects(:get, path, options, klass)\n end"
] | [
"0.7126692",
"0.68431854",
"0.68389094",
"0.6793959",
"0.662105",
"0.662105",
"0.64062643",
"0.631757",
"0.6298959",
"0.62942183",
"0.62928504",
"0.62890637",
"0.62890637",
"0.6245959",
"0.6221773",
"0.6149454",
"0.61449116",
"0.6141196",
"0.6135513",
"0.60983306",
"0.60759926",
"0.6073099",
"0.60722315",
"0.6068277",
"0.6039344",
"0.6038147",
"0.6038147",
"0.6019305",
"0.60157865",
"0.6012334",
"0.6004848",
"0.59972835",
"0.59640783",
"0.59383386",
"0.5936905",
"0.59333396",
"0.593137",
"0.5915526",
"0.5915375",
"0.5890594",
"0.58801156",
"0.5869399",
"0.5850063",
"0.58423156",
"0.5825489",
"0.5825204",
"0.5824316",
"0.5815869",
"0.581475",
"0.58146185",
"0.5813317",
"0.5802839",
"0.5801167",
"0.57984334",
"0.5784995",
"0.5761321",
"0.57587284",
"0.5751288",
"0.5747256",
"0.5743171",
"0.5741595",
"0.5732168",
"0.5732028",
"0.5726006",
"0.5721754",
"0.5718892",
"0.57127804",
"0.5711076",
"0.5699749",
"0.5697585",
"0.56953067",
"0.56947345",
"0.56846744",
"0.5680842",
"0.56803",
"0.56803",
"0.56754386",
"0.5669375",
"0.5669375",
"0.5662695",
"0.5660036",
"0.5659683",
"0.56573963",
"0.56556934",
"0.5649014",
"0.5643949",
"0.5638715",
"0.56375057",
"0.5623293",
"0.5621002",
"0.56206113",
"0.56206113",
"0.56188303",
"0.5601038",
"0.5595845",
"0.5594165",
"0.55927986",
"0.5591753",
"0.5589888",
"0.5586004"
] | 0.60493284 | 24 |
Performs POST requests and returns URI locations. Resource data must be provided in an Occi::Collection instance. | def post(path, collection)
# remove the leading slash
path = path.gsub(/\A\//, '')
headers = self.class.headers.clone
headers['Content-Type'] = @media_type
response = case @media_type
when 'application/occi+json'
self.class.post(@endpoint + path,
:body => collection.to_json,
:headers => headers)
when 'text/occi'
self.class.post(@endpoint + path,
:headers => collection.to_header.merge(headers))
else
self.class.post(@endpoint + path,
:body => collection.to_text,
:headers => headers)
end
response_msg = response_message response
case response.code
when 200
collection = Occi::Parser.parse(response.header["content-type"].split(";").first, response)
if collection.empty?
Occi::Parser.locations(response.header["content-type"].split(";").first, response.body, response.header).first
else
collection.resources.first.location if collection.resources.first
end
when 201
Occi::Parser.locations(response.header["content-type"].split(";").first, response.body, response.header).first
else
raise "HTTP POST failed! #{response_msg}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, collection)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = @media_type\n\n response = case @media_type\n when 'application/occi+json'\n self.class.post(@endpoint + path,\n :body => collection.to_json,\n :headers => headers)\n when 'text/occi'\n self.class.post(@endpoint + path,\n :headers => collection.to_header.merge(headers))\n else\n self.class.post(@endpoint + path,\n :body => collection.to_text,\n :headers => headers)\n end\n\n response_msg = response_message response\n\n case response.code\n when 200\n collection = Occi::Parser.parse(response.header[\"content-type\"].split(\";\").first, response.body)\n\n if collection.empty?\n Occi::Parser.locations(response.header[\"content-type\"].split(\";\").first, response.body, response.headers).first\n else\n collection.resources.first.location if collection.resources.first\n end\n when 201\n # TODO: OCCI-OS hack, look for header Location instead of uri-list\n # This should be probably implemented in Occi::Parser.locations\n if response.header['location']\n response.header['location']\n else\n Occi::Parser.locations(response.header[\"content-type\"].split(\";\").first, response.body, response.headers).first\n end\n else\n raise \"HTTP POST failed! #{response_msg}\"\n end\n end",
"def post(attrs = {}, request_opts = {})\n # assumes that the current collection is a singleton, and the uri_spec\n # has no components that require resolution.\n if @uri_spec.include?(\":\")\n UriError.new(\"Singleton collection expected, \" +\n \"but collection URI requires resolution: #{@uri_spec}\")\n end\n\n self.new().post(attrs, request_opts)\n end",
"def perform_post_with_objects_from_collection(path, options, klass, collection_name)\n perform_request_with_objects_from_collection(:post, path, options, klass, collection_name)\n end",
"def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end",
"def locations\n locations = Occi::Core::Locations.new\n\n all(params[:entity]).each do |bt|\n bt_ids = backend_proxy_for(bt).identifiers\n locations_from(bt_ids, bt, locations)\n end\n return if locations.empty?\n\n respond_with locations\n end",
"def locations\n locations_params = Hashie::Mash.new( {f: params.f} )\n response = make_request(LOCATIONS_BASE, locations_params)\n return not_available (response) unless response.status == 200\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n response_body.data\n end",
"def perform_post_with_object_from_collection(path, options, klass, collection_name)\n perform_request_with_object_from_collection(:post, path, options, klass, collection_name)\n end",
"def locations\n get('locations')\n end",
"def location_submissions\n\t\t\n\tend",
"def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end",
"def bulk_push\n ReadLater.bulk_push(read_laters_params[:url])\n\n redirect_to read_laters_path\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def post\n resource.post(request, response)\n end",
"def create\n @collection = Collection.new(params[:collection])\n\n # scrape each resource URL to add those fields\n @collection.collectionizes.each do |each_collectionize|\n resource_object = Resource.scrape_data(each_collectionize.resource.raw_url)\n\n each_collectionize.resource\n resource_object = Resource.scrape_data(@resource.raw_url)\n each_collectionize.resource.keywords_scraped = resource_object[:keywords_scraped] ? resource_object[:keywords_scraped] : nil\n each_collectionize.resource.description_scraped = resource_object[:description_scraped] ? resource_object[:description_scraped] : nil\n each_collectionize.resource.title_scraped = resource_object[:title_scraped] ? resource_object[:title_scraped] : nil\n each_collectionize.resource.raw_html = resource_object[:raw_html] ? resource_object[:raw_html] : nil\n end\n\n respond_to do |format|\n if @collection.save\n redirect_to @collection, notice: 'Collection was successfully created.'\n else\n render action: \"new\"\n end\n end\n end",
"def serialize_collection(collection)\n url_for(collection)\n end",
"def locations(place)\n get :loc => place\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def location_primer\n render(json: location_list)\n end",
"def save\n @item = Collection.new(collection_params)\n @collection.collections << @item\n @collection.save\n\n @collections = @collection.collections\n\n # return_to = @collection.is_root? ? collections_path : collection_path\n #\n # respond_to do |format|\n # if @item.save\n # format.html { redirect_to return_to, notice: 'Collection was successfully created.' }\n # format.json { render :show, status: :created, location: @collection }\n # else\n # format.html { render :new }\n # format.json { render json: @collection.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def post_json(location, json_data)\n response = RestClient::Request.new(\n :method => :post,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json},\n :payload => json_data\n ).execute\n results = JSON.parse(response.to_str)\n end",
"def post_json(location, json_data)\n response = RestClient::Request.new(\n :method => :post,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json},\n :payload => json_data\n ).execute\n results = JSON.parse(response.to_str)\n end",
"def add_to_collection_action (collection, item)\n\n api = Harvard::LibraryCloud::API.new\n path = 'collections/' + collection\n\n connection = Faraday.new(:url => api.get_base_uri + path) do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n faraday.headers['X-LibraryCloud-API-Key'] = ENV[\"LC_API_KEY\"]\n end\n\n raw_response = begin\n response = connection.post do |req|\n req.body = '[{\"item_id\": \"' + item + '\"}]'\n end\n { status: response.status.to_i, headers: response.headers, body: response.body.force_encoding('utf-8') }\n rescue Errno::ECONNREFUSED, Faraday::Error => e\n raise RSolr::Error::Http.new(connection, e.response)\n end\n end",
"def entries_to_http entries, url, http = Atom::HTTP.new\n coll = Atom::Collection.new url, http\n\n entries.each { |entry| coll.post! entry }\n end",
"def perform(locs)\n Location.create_all(self, locs[0..LOCS_LIMIT])\n results = []\n self.locations.each do |loc|\n results_in_loc = self.call_api(loc)\n results_in_loc.each do |item| \n results << self.simplify(item)\n end\n end\n results.uniq.sort_by_date\n end",
"def remote_search(*args)\n params = args.extract_options!\n collection = args.flatten\n ::FactoryGirl::RemoteStrategy.register_request(:get, FactoryGirl::RemoteStrategy.collection_url(collection, params),\n body: (collection.first.is_a?(Class) ? \"[]\" : collection.map { |e| FactoryGirl::RemoteStrategy.entity_hash(e, params) }.to_json))\nend",
"def post (dir, data) #DIR is path to REST, Data is HASH of post data\r\n\tbegin\r\n\t\taddress=$server + dir\r\n\t\turi = URI.parse(address)\r\n\t\tdebugging \"Post URI: #{uri}, data: #{data}\"\r\n\t\trequest=Net::HTTP.post_form(uri,data)\r\n\t\tdebugging \"Response #{request}\"\r\n\t\treturn request\r\n\trescue Exception =>msg\r\n\t\tresponse={'body'=>msg,'code'=>401, 'exception' =>true}\r\n\tend\r\nend",
"def post_data(body)\r\n raise ConfigError, 'no json_records' if body.empty?\r\n # Create REST request header\r\n header = get_header(body.bytesize)\r\n # Post REST request \r\n response = RestClient.post(@uri, body, header)\r\n\r\n return response\r\n end",
"def http_post(uri, data)\n RestClient.post uri, data\n end",
"def POST(uri, data, type, credentials)\n post = Net::HTTP::Post.new(uri.path)\n post.content_type = type\n\n set_upload_body(post, data)\n\n response = submit(post, uri, credentials)\n\n case response\n when Net::HTTPCreated\n # return the URI of the newly created item\n URI.parse(response['location'])\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"POST\", uri.path, response, credentials)\n end\n end",
"def locations\n @client.get('/BikePoint')\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def post_data; end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def index\n @recipe_locations = RecipeLocation.all\n end",
"def request_raw(uris_data)\r\n \r\n http = setup_https(uris_data[0][0])\r\n \r\n #Setup output array\r\n responses = Array.new\r\n \r\n uris_data.each do |uri_data|\r\n headers = OAuth.sign(@method.upcase, @key, @secret, uri_data[0], uri_data[1])\r\n (uri_data[0].query.nil?) ? (query = \"\") : (query = \"/\" + uri_data[0].query)\r\n headers['Content-Type'] = 'application/xml'\r\n resp = http.send_request(@method, uri_data[0].path + query, uri_data[1], headers)\r\n responses << resp\r\n end\r\n return responses\r\n end",
"def perform_request_with_objects_from_collection(request_method, path, options, klass, collection_name) # rubocop:disable Metrics/ParameterLists\n options = {collection_name.to_sym => options} unless options.empty?\n\n perform_request(request_method, path, options).fetch(collection_name.to_sym).collect do |element|\n klass.new(element)\n end\n end",
"def perform_post_with_objects(path, options, klass)\n perform_request_with_objects(:post, path, options, klass)\n end",
"def index\n @processed_locations = ProcessedLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_locations }\n end\n end",
"def upload_submission(sub_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Post.new(\"/ontologies/#{sub_info['ontology']['acronym']}/submissions\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n # Check if the source BioPortal is pulling the ontology from an URL\n # If yes then we will pull the ontology from this place (allow auto update of the ontology when the ontology is changed in its source URL)\n if sub_info['pullLocation'].nil?\n pull_location = \"#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}\"\n else\n pull_location = sub_info['pullLocation']\n end\n\n # Extract contacts\n contacts = []\n sub_info['contact'].each do |contact|\n contacts.push({'name': contact['name'],'email': contact['email']})\n end\n\n # Build the json body\n # hasOntologyLanguage options: OWL, UMLS, SKOS, OBO\n # status: alpha, beta, production, retired\n req.body = {\n 'contact': contacts,\n 'hasOntologyLanguage': sub_info['hasOntologyLanguage'],\n 'released': sub_info['released'],\n 'ontology': \"#{TARGET_API}/ontologies/#{sub_info['ontology']['acronym']}\",\n 'description': sub_info['description'],\n 'status': sub_info['status'],\n 'version': sub_info['version'],\n 'homepage': sub_info['homepage'],\n 'documentation': sub_info['documentation'],\n 'publication': sub_info['publication'],\n 'naturalLanguage': sub_info['naturalLanguage'],\n 'pullLocation': pull_location\n }.to_json\n\n #puts req.body.to_s\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend",
"def create\n @input = Input.new(input_params)\n\n respond_to do |format|\n if @input.save\n @file = @input.input_file.download\n data = CSV.parse(@file, headers: true)\n # TODO S in SOLID\n coords_ary = []\n data.each do |i|\n # iterate each row (address), call geolocate api for each\n # to get lat-lon coords\n i = i.to_h\n zip = i[\"Zipcode\"]\n addr = i[\"Address\"]\n town = i[\"Town\"]\n state = i[\"State\"]\n # POST or GET\n response = RestClient.get \"https://app.geocodeapi.io/api/v1/search?apikey=#{ENV['GEOLOCATION_KEY']}&text=#{addr},#{town},#{state},#{zip},United States\"\n parsed = JSON.parse(response)\n coords = parsed[\"features\"][0][\"geometry\"][\"coordinates\"].reverse\n puts \"coordinates for #{addr}, #{town} #{state}, #{zip}\"\n puts coords\n coords_ary << coords\n File.write('response.json', parsed)\n end\n osrm_api(coords_ary)\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render :show, status: :created, location: @input }\n else\n format.html { render :new }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enter_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n enter_auto_complete(location_input(index), location_options(index), location[UseOfCollections::LOCATION.name], 'Local Places')\n end\n end",
"def index\n @specific_locations = SpecificLocation.all\n end",
"def post(request_opts = {})\n store_result(http(request_opts).post(resolved_path, @attrs))\n end",
"def list\n # list possible locations \n\n @location_suggest = get_location_suggest\n\n if params[:location]\n locations = WoeidHelper.search_by_name params[:location]\n if not locations.nil? and locations.count == 1\n set_location locations[0]\n else\n @location_asked = locations\n end\n end\n end",
"def getLocationMultiple( location_ids)\n params = Hash.new\n params['location_ids'] = location_ids\n return doCurl(\"get\",\"/location/multiple\",params)\n end",
"def collection(http_verb, action = nil, body = nil, options)\n actual_client(options).send(http_verb, path(action), body, options)\n end",
"def post(url_variables:, body:)\n ensure_service_document\n\n end",
"def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end",
"def index\n @locations = Location.all\n\n respond_with(@locations)\n end",
"def post path_and_params, post_body\n start if not @pid\n @lock.synchronize do\n @last_use = Time.new.to_f\n\n # Make request to xtractr\n Net::HTTP.start('localhost', @port) do |http|\n http.request_post \"/#{path_and_params}\", post_body do |response|\n headers = {}\n response.each_header {|name,val| headers[name] = val}\n return response.code.to_i, headers, response.body\n end\n end\n end\n end",
"def POST; end",
"def post(path, *data, &block)\n map(path, R3::POST, *data, &block)\n end",
"def enter_locations(test_data)\n locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n logger.info \"Entering location data set at index #{index}: #{location}\"\n enter_auto_complete(location_input(index), location_options(index), location[CoreUseOfCollectionsData::LOCATION.name], 'Local Places')\n end\n end",
"def attach_locations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CompanyApi.attach_locations ...\"\n end\n # resource path\n local_var_path = \"/company/add-location\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?\n query_params[:'latitude'] = opts[:'latitude'] if !opts[:'latitude'].nil?\n query_params[:'longitude'] = opts[:'longitude'] if !opts[:'longitude'].nil?\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 = []\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 => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CompanyApi#attach_locations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(uri, request_headers, body)\n request('post', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end",
"def index\n @item_locations = ItemLocation.all\n end",
"def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def add_to_collection\n\n if request.post?\n # Actually add the item to the collection\n ids = request.params[:id].split(',')\n ids.each do |id|\n add_to_collection_action(request.params[:collection], id)\n end\n\n # Don't render the default \"Add to Collection\" dialog - render the \"Success!\" dialog contents\n flash[:success] ||= \"The item has been added to the collection\"\n render 'catalog/add_to_collection_success'\n end\n\n end",
"def posts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:post,path,params,opts,&block)\n end",
"def post(path, options = {}, &block)\n map(path, options, :post, &block)\n end",
"def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend",
"def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def on_post(resource_uri, opts) # resource_uri = Nodes\n debug \"on_post: #{resource_uri}\"\n resource = update_resource(resource_uri, false, opts)\n show_resource(resource, opts)\n end",
"def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end",
"def index\n @locations = current_user.locations\n respond_with @locations\n end",
"def tag_provider_collections_single_post\n post_body = nil\n post_body_providers = ''\n EOSDIS_PROVIDERS.each do |provider|\n if !provider.blank?\n provider = provider.strip\n Rails.logger.info(\"Processing provider: #{provider}\")\n #ensure that provider is present\n if (@all_providers[provider] != nil)\n Rails.logger.info(\"LOCATED PROVIDER: #{provider}\")\n # COLLECTIONS ARE BEING TAGGED so let's check if there are collections for each provider\n # help with debugging of timing issues since the tagging occurs at midnight and perhaps the collections expected\n # in the results set are tagged after that\n response = RestClient::Request.execute :method => :get, :url => \"#{@catalog_rest_endpoint}collections\",\n headers: {params: {provider: provider}},\n :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n hits = response.headers[:cmr_hits].to_i\n if hits > 0\n Rails.logger.info(\"PROVIDER #{provider} HAS #{hits} COLLECTIONS\")\n post_body_providers = post_body_providers + '{\"provider\": \"' + provider + '\"},'\n end\n else\n Rails.logger.info(\"COULD NOT LOCATE PROVIDER: #{provider}\")\n end\n end\n end\n if (!post_body_providers.blank?)\n post_body_providers = post_body_providers.chomp(',')\n post_body = '{\n \"condition\": {\"or\" : [' + post_body_providers +\n ']}}'\n Rails.logger.info(\"POST request body: #{post_body}\")\n # one request takes much longer so we must increase the read_timeout (seconds)\n response = RestClient::Request.execute :method => :post, :url => \"#{@catalog_rest_endpoint}tags/#{@tag}/associations/by_query\", :payload => post_body,\n :headers => {'Authorization' => @token, 'Content-Type' => 'application/json'},\n :verify_ssl => OpenSSL::SSL::VERIFY_NONE, :timeout => 240\n if (response.code != 200)\n Rails.logger.info(\"COULD NOT TAG PROVIDERS, ERROR: #{response.code}, BODY: #{response.body} \")\n else\n Rails.logger.info(\"SUCCESSFULY TAGGED ALL PROVIDERS\")\n end\n end\n end",
"def solr_collection_api(host_name,port,params,config_name=nil,path=\"/solr/admin/collections\")\n if not config_name.nil?\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&collection.configName=\"+config_name+\"&wt=json\"\n else\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&wt=json\"\n end\n Chef::Log.info(\" HostName = \" + host_name + \", Port = \" + port + \", Path = \" + path)\n http = Net::HTTP.new(host_name, port)\n req = Net::HTTP::Get.new(path)\n\n unless !SolrAuth::AuthUtils.auth_enabled?\n admin_creds = SolrAuth::AuthUtils.get_solr_admin_credentials\n req.basic_auth(admin_creds['username'], admin_creds['password'])\n end\n response = http.request(req)\n if response != nil then\n return JSON.parse(response.body())\n end\n raise StandardError, \"empty response\"\n end",
"def post(path, data, initheader = nil, dest = nil, &block) #:nodoc:\n res = nil\n\n req = Post.new(path, initheader); req.set_form_data(data)\n request(req) {|r| r.read_body dest, █ res = r}\n\n unless @newimpl\n res.value\n return res, res.body\n end\n\n res\n end",
"def post_paths\n %(/site/home\n /content/999/BOXID/TYPENAME\n /file/999/BOXID\n /shard/0000000000000000000000000000000000000000\n /schema/delete\n )\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def bulk(data, options={})\n request(:post, \"_bulk\", options, data)\n end",
"def index()\n method_url = @resource\n return self.get(method_url)\n end",
"def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end",
"def bulk(data, options = {})\n request(:post, \"_bulk\", options, data)\n end",
"def post(uri, request_headers, body)\n raise NotImplementedError\n end",
"def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end",
"def store_data_from(collection)\n collection.map do |c|\n @data.dup.inject({ \"id\" => c.id }) do |options, data|\n options[data[\"mapping\"]] = (c.instance_eval(data[\"method\"]) rescue I18n.t(\"admin.labels.not_found\"))\n options\n end\n end\n end",
"def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def http_post(request, response)\n content_type = request.header('Content-Type')\n content_type = content_type.split(';').first\n\n if content_type != 'application/x-www-form-urlencoded' &&\n content_type != 'multipart/form-data'\n return nil\n end\n\n post_vars = request.post_data\n return nil unless post_vars.key?('sabreAction')\n\n uri = request.path\n\n if @server.emit('onBrowserPostAction', [uri, post_vars['sabreAction'], post_vars])\n\n case post_vars['sabreAction']\n when 'mkcol'\n if post_vars.key?('name') && !post_vars['name'].blank?\n # Using basename because we won't allow slashes\n folder_name = Http::UrlUtil.split_path(post_vars['name'].strip)[1]\n\n if post_vars.key?('resourceType')\n resource_type = post_vars['resourceType'].split(',')\n else\n resource_type = ['{DAV:}collection']\n end\n\n properties = {}\n post_vars.each do |var_name, var_value|\n # Any _POST variable in clark notation is treated\n # like a property.\n next unless var_name[0] == '{'\n var_name = var_name.gsub('*DOT*')\n properties[var_name] = var_value\n end\n\n mk_col = MkCol.new(resource_type, properties)\n @server.create_collection(uri + '/' + folder_name, mk_col)\n end\n when 'put' # FIXME\n # USE server.http_request.post_data (Rack.POST)\n file = nil\n server.http_request.params.each do |_, value|\n if value.is_a?(Rack::Multipart::UploadedFile)\n file = value\n break\n end\n end\n\n if file\n # Making sure we only have a 'basename' component\n new_name = ::File.basename(file.original_filename).strip\n\n if post_vars.key?('name') && !post_vars['name'].blank?\n new_name = ::File.basename(post_vars['name']).strip\n end\n\n # is there a necessary equivalent in ruby?\n # if (is_uploaded_file(file['tmp_name'])) {\n @server.create_file(\"#{uri}/#{new_name}\", ::File.open(file.path), 'r')\n # end\n end\n end\n end\n\n response.update_header('Location', request.url)\n response.status = 302\n false\n end",
"def listing_locations_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListingsApi.listing_locations_search ...'\n end\n # resource path\n local_var_path = '/v1/listings/locations'\n\n # query parameters\n query_params = {}\n query_params[:'terms'] = opts[:'terms'] if !opts[:'terms'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainPublicAdapterWebApiModelsV1ListingsListingLocation>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListingsApi#listing_locations_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @locations = Spree::Location.all\n end",
"def all(params = {})\n query = params.map { |key, value| \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\" }.join(\"&\")\n query = \"?\" + query unless query.empty?\n code, data = @session.get(collection_path + '.json' + query)\n data.collect { |data|\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session => @session, :prefix => @prefix))\n }\n end",
"def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end",
"def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"def publishLoc(niUri, locList, destHost, msgId)\n url=URI::parse(\"http://#{destHost}/netinfproto/publish\")\n\n res=nil\n req=nil\n\n loc1=locList[0]\n loc2=locList[1]\n \n if loc2\n req = Net::HTTP::Post::Multipart.new(url.path,\n \"URI\" => niUri.to_s,\n \"msgid\" => msgId,\n \"loc1\" => loc1,\n \"loc2\" => loc2)\n elsif loc1\n req = Net::HTTP::Post::Multipart.new(url.path,\n \"URI\" => niUri.to_s,\n \"msgid\" => msgId,\n \"loc1\" => loc1)\n end\n if req\n print \"Sending request: #{req.to_s} to #{url}\\n\"\n \n res = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end \n end\n res\n \n end",
"def post(resource, data)\n proxy(method: :post, url: url_for(resource), data: data)\n end",
"def post\n request_object.post_query\n end",
"def call_api(path, data)\n base_data = {\n apiKey: 'Your bulk whois api key',\n outputFormat: 'json'\n }\n\n url = 'https://www.whoisxmlapi.com/BulkWhoisLookup/bulkServices' + path\n\n body = base_data.merge(data).to_json\n\n http_post(url, body)\nend",
"def create\n @locations = Location.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @location = Location.create(params[:location])\n end",
"def perform_request(method, path, params, body)\n CONNECTION.run_request \\\n method.downcase.to_sym,\n path,\n ( body ? MultiJson.dump(body): nil ),\n {'Content-Type' => 'application/json'}\n end",
"def post\n @posting = Posting.new\n @location = Location.find(params[:location_id], :include => [:categories, :subcategories], :order => \"categories.name\")\n @categories = @location.categories\n\n respond_to do |format|\n format.html {render :layout =>\"locations_new_post\" } # new.html.erb \n format.xml { render :xml => @location }\n end\n end",
"def assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = Solr::Query.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = {}\n item['pid'] = doc.id\n item['files'] = assets_and_surrogates(doc)\n\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end",
"def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end",
"def create\n parameters = post_params\n @post = Post.new(title: parameters[:title], description: parameters[:description], user_id: current_user.id, images: parameters[:images], files: parameters[:files])\n latitude = post_params[:post_locations][:lat].to_f\n longitude = post_params[:post_locations][:lng].to_f\n location_id = post_params[:post_locations][:location_id]\n location = Location.find_by_location(location_id)\n respond_to do |format|\n if @post.save\n if post_params[:post_locations][:lat] != \"\" and post_params[:post_locations][:lng] != \"\"\n @post_location = PostLocation.create!(latitude: latitude, longitude: longitude, post_id: @post.id, location_id: location.id)\n end\n format.html {redirect_back(fallback_location: profile_path(@current_profile.id)); flash[:success] = 'Post created'}\n else\n format.html {redirect_back(fallback_location: profile_path(@current_profile.id)); flash[:danger] = 'Error creating post'}\n end\n end\n end",
"def post(uri, request_headers, body)\n request('post', uri, request_headers, body)\n end",
"def index\n @item_locations = ItemLocation.all\n end",
"def test_sitemap_geos_and_queries\n geos = ['ca', 'co', 'il', 'ny']\n\n geos.each do |loc|\n # Step 1\n params = {\n 'g' => loc,\n 'h_geos' => 0,\n 'h_queries' => 0\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(0, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(0, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 2\n params = {\n 'g' => loc,\n 'h_geos' => 10,\n 'h_queries' => 30\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(10, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(30, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 3\n params = {\n 'g' => loc,\n 'h_geos' => 50,\n 'h_queries' => 100\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(50, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(100, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 4\n params = {\n 'g' => loc\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(50, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(50, @parsed_response['Queries']['NumFound'], @parsed_response)\n\n # Step 5\n params = {\n 'g' => loc,\n 'h_geos' => 100,\n 'h_queries' => 1000\n }\n\n get '/site_map/geos_and_queries', params\n assert_response(@response, :success)\n assert_equal(50, @parsed_response['Geos']['NumFound'], @parsed_response)\n assert_equal(100, @parsed_response['Queries']['NumFound'], @parsed_response)\n end\n end",
"def perform(method, path, form: nil, query: nil, body: nil, json: nil, &_block) # rubocop:disable Metrics/ParameterLists\n url = build_url(path)\n response = request(method, url, form: form, query: query, body: body, json: json)\n status = response.status\n resource = response.body\n block_given? ? yield(response, status, resource) : response\n end"
] | [
"0.6200585",
"0.5874095",
"0.58321387",
"0.56579345",
"0.5649235",
"0.5547596",
"0.5384626",
"0.5366917",
"0.5357277",
"0.5171335",
"0.5162472",
"0.51528513",
"0.5135156",
"0.50979334",
"0.5093289",
"0.5046608",
"0.50332016",
"0.50166285",
"0.50048697",
"0.50016797",
"0.5000459",
"0.5000459",
"0.4998217",
"0.49809054",
"0.49632567",
"0.49407715",
"0.4934886",
"0.49246514",
"0.48922062",
"0.48834556",
"0.48617986",
"0.4853049",
"0.48524094",
"0.48488298",
"0.4845461",
"0.48450384",
"0.48315623",
"0.48205248",
"0.48181033",
"0.48134157",
"0.48098838",
"0.4805371",
"0.47784588",
"0.4776996",
"0.47658473",
"0.47639066",
"0.47635546",
"0.47563475",
"0.47527388",
"0.47524157",
"0.47519013",
"0.47335672",
"0.47313935",
"0.47304365",
"0.47276446",
"0.4724936",
"0.4723415",
"0.4710003",
"0.46963438",
"0.46839225",
"0.46821952",
"0.46802488",
"0.46739593",
"0.4673609",
"0.46712676",
"0.4667349",
"0.46624663",
"0.4659184",
"0.46425247",
"0.46320772",
"0.46315598",
"0.46305037",
"0.46296114",
"0.46257412",
"0.46247384",
"0.4622716",
"0.4619216",
"0.46161133",
"0.46161065",
"0.4613388",
"0.46133652",
"0.4611965",
"0.46080378",
"0.4601812",
"0.4601774",
"0.45977136",
"0.45969334",
"0.45939434",
"0.4593722",
"0.45886856",
"0.45861372",
"0.45844182",
"0.45841026",
"0.45776954",
"0.45736936",
"0.4572415",
"0.45717904",
"0.45706064",
"0.45678538",
"0.4565"
] | 0.6008173 | 1 |
Performs PUT requests and parses responses to collections. | def put(path, collection)
# remove the leading slash
path = path.gsub(/\A\//, '')
headers = self.class.headers.clone
headers['Content-Type'] = @media_type
response = case @media_type
when 'application/occi+json'
self.class.post(@endpoint + path,
:body => collection.to_json,
:headers => headers)
when 'text/occi'
self.class.post(@endpoint + path,
:headers => collection.to_header.merge(headers))
else
self.class.post(@endpoint + path,
:body => collection.to_text,
:headers => headers)
end
response_msg = response_message response
case response.code
when 200, 201
Occi::Parser.parse(response.header["content-type"].split(";").first, response)
else
raise "HTTP POST failed! #{response_msg}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_put_with_objects_from_collection(path, options, klass, collection_name)\n perform_request_with_objects_from_collection(:put, path, options, klass, collection_name)\n end",
"def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(:metadata, :read_only, :title, :tags, :priv))\n render_json :entry => @collection.to_hash(@user, @client) and return\n end",
"def put(path, collection)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = @media_type\n\n response = case @media_type\n when 'application/occi+json'\n self.class.post(@endpoint + path,\n :body => collection.to_json,\n :headers => headers)\n when 'text/occi'\n self.class.post(@endpoint + path,\n :headers => collection.to_header.merge(headers))\n else\n self.class.post(@endpoint + path,\n :body => collection.to_text,\n :headers => headers)\n end\n\n response_msg = response_message response\n\n case response.code\n when 200, 201\n Occi::Parser.parse(response.header[\"content-type\"].split(\";\").first, response.body)\n else\n raise \"HTTP POST failed! #{response_msg}\"\n end\n end",
"def populate_collection(args)\n\targs[:keys].each do |key|\n\t\tapi_url = \"#{@base_url}/#{args[:collection]}/#{key}\"\n\t\tputs do_the_put_call({ url: api_url, user: @user, json: args[:json][key] })\n\tend\nend",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def perform_put_with_object_from_collection(path, options, klass, collection_name)\n perform_request_with_object_from_collection(:put, path, options, klass, collection_name)\n end",
"def update\n if @collection.update(collection_params)\n render json: @collection, status: :ok#, location: @collection\n else\n render json: @collection.errors, status: :unprocessable_entity\n end\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end",
"def add_collection_replace_handler( route, rsrcobj, options )\n\t\t\tpkey = rsrcobj.primary_key\n\t\t\tself.log.debug \"Creating handler for replacing all %p resources: PUT %s\" %\n\t\t\t\t[ rsrcobj, route ]\n\n\t\t\tself.add_route( :PUT, route, options ) do |req|\n\n\t\t\t\t# Make a validator that can be reused to validate each resource's attributes\n\t\t\t\tvalidator = self.class.paramvalidator.dup\n\t\t\t\tadd_resource_params( validator, rsrcobj )\n\t\t\t\tbody = req.parse_body\n\t\t\t\tbody = [ body ] unless body.is_a?( Array )\n\n\t\t\t\t# Create resource objects out of the incoming data\n\t\t\t\tnew_resources = []\n\t\t\t\tbody.each do |attributes|\n\t\t\t\t\tvalidator.validate( attributes )\n\t\t\t\t\tfinish_with( HTTP::BAD_REQUEST, validator.error_messages.join(\", \") ) unless\n\t\t\t\t\t\tvalidator.okay?\n\n\t\t\t\t\tnew_resources << rsrcobj.new( validator.valid )\n\t\t\t\tend\n\t\t\t\tself.log.debug \"Replacing %p collection with new values: %p\" %\n\t\t\t\t\t[ rsrcobj, new_resources ]\n\n\t\t\t\t# Save it in a transaction, erroring if any of 'em fail validations\n\t\t\t\tbegin\n\t\t\t\t\trsrcobj.db.transaction do\n\t\t\t\t\t\trsrcobj.truncate\n\t\t\t\t\t\tnew_resources.each( &:save )\n\t\t\t\t\tend\n\t\t\t\trescue Sequel::ValidationFailed => err\n\t\t\t\t\tfinish_with( HTTP::BAD_REQUEST, err.message )\n\t\t\t\tend\n\n\t\t\t\tres = req.response\n\t\t\t\tres.status = HTTP::NO_CONTENT\n\n\t\t\t\treturn res\n\t\t\tend\n\n\t\t\tself.resource_verbs[ route ] << :PUT\n\t\tend",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end",
"def perform_put_with_objects(path, options, klass)\n perform_request_with_objects(:put, path, options, klass)\n end",
"def update(attributes, collection)\n #collection[0].model.last_query = [attributes, collection]\n fm_params = prepare_fmp_attributes(attributes)\n counter = 0\n collection.each do |resource|\n rslt = layout(resource.model).edit(resource.instance_variable_get(:@_record_id), fm_params)\n merge_fmp_response(resource, rslt[0])\n resource.persistence_state = DataMapper::Resource::PersistenceState::Clean.new resource\n counter +=1\n end\n counter \n end",
"def set_objects(objecttypes, results, data, login, password_callback=PasswordCallback)\n # Convert any keys which don't already specify a model\n # from 'foo' to 'objecttype[foo]'\n objecttype = singularize(objecttypes)\n cleandata = {}\n data.each_pair do |key, value|\n if key !~ /\\[.+\\]/\n cleandata[\"#{objecttype}[#{key}]\"] = value\n else\n cleandata[key] = value\n end\n end\n\n #puts cleandata.inspect if (@debug)\n puts YAML.dump(cleandata) if (@debug)\n\n successcount = 0\n if results && !results.empty?\n results.each_pair do |result_name, result|\n if @delete\n warn \"Deleting objects via set_objects is deprecated, use delete_objects instead\"\n uri = URI::join(@server, \"#{objecttypes}/#{result['id']}.xml\")\n req = Net::HTTP::Delete.new(uri.request_uri)\n req.set_form_data(cleandata)\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Delete.new(uri.request_uri)\n response = send_request(req, uri, login, password_callback)\n end\n if response.kind_of?(Net::HTTPOK)\n successcount += 1\n else\n puts \"DELETE to #{uri} failed for #{result_name}:\"\n puts response.body\n end\n # PUT to update an existing object\n elsif result['id']\n uri = URI::join(@server, \"#{objecttypes}/#{result['id']}.xml\")\n req = Net::HTTP::Put.new(uri.request_uri)\n req.set_form_data(cleandata)\n warn \"PUT to URL: #{uri}\" if (@debug)\n if !@dryrun\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Put.new(uri.request_uri)\n req.set_form_data(cleandata)\n response = send_request(req, uri, login, password_callback)\n end\n if response.kind_of?(Net::HTTPOK)\n successcount += 1\n else\n puts \"PUT to #{uri} failed for #{result_name}:\"\n puts response.body\n end\n end\n else\n warn \"set_objects passed a bogus results hash, #{result_name} has no id field\"\n end\n end\n else\n uri = URI::join(@server, \"#{objecttypes}.xml\")\n req = Net::HTTP::Post.new(uri.request_uri)\n req.set_form_data(cleandata)\n warn \"POST to URL: #{uri}\" if (@debug)\n if !@dryrun\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Post.new(uri.request_uri)\n req.set_form_data(cleandata)\n response = send_request(req, uri, login, password_callback)\n end\n if response.kind_of?(Net::HTTPOK) || response.kind_of?(Net::HTTPCreated)\n successcount += 1\n else\n puts \"POST to #{uri} failed.\"\n puts response.body\n end\n end\n end\n\n successcount\n end",
"def update\n respond_with []\n end",
"def put options={}, &block\n handle_exceptions do\n Chimps.log.info(\"PUT #{url}\")\n Response.new(super(encoded_body, options, &block))\n end\n end",
"def update\n authorize! :update, params[:id]\n @collection = Collection.find(params[:id])\n flash[:notice] = 'Collection was successfully updated.' if @collection.update(collection_params)\n respond_with(@collection)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update(options = {}, &block)\n object = get_resource_ivar || find_and_update_resource\n\n options[:location] = collection_path if object.errors.empty?\n\n respond_with_dual(object, options, &block)\n end",
"def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end",
"def collection(http_verb, action = nil, body = nil, options)\n actual_client(options).send(http_verb, path(action), body, options)\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, success: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { redirect_to @collection, alert: 'Collection was not updated.' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, request_headers, body)\n request('put', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end",
"def put_docs(dir)\n try_operation do |log|\n success = true\n log << \"Loading documents in #{dir}\\n\"\n Dir.each_child(dir) do |f|\n log << \"\\t#{f}: \"\n filepath = File.join(dir, f)\n if f.end_with?(\".rb\") && File.exists?(filepath) && !File.directory?(filepath)\n # Read the file into a Ruby hash (incredibly unsafe, obviously) and convert to JSON\n hash = eval(IO.read(filepath))\n json = JSON.generate(hash)\n \n uri = URI::HTTP.build(\n host: DB_HOST,\n port: DB_PORT,\n path: DB_DBNAME\n )\n\n # Send the PUT request to create the corresponding document\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'application/json'\n response = Net::HTTP.start(uri.hostname, uri.port, {}) do |http|\n http.request(request, json)\n end\n\n # Record the result.\n log << \"#{response.code} #{response.message}\\n\"\n if response.code.to_i < 200 || response.code.to_i > 299\n success = false\n end\n end\n end\n return success, log\n end\nend",
"def put(options={}, &block)\n response = http.put_uri(options.merge(:body => serialize), &block)\n handle_response(response)\n self\n end",
"def update\n authorize! :update, @collection\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to collection_url(@collection), notice: \"Collection '#{@collection.title}' was successfully updated.\" }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_collection_with_http_info(collection_id, update_mask, collection, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CollectionsApi.update_collection ...'\n end\n # verify the required parameter 'collection_id' is set\n if @api_client.config.client_side_validation && collection_id.nil?\n fail ArgumentError, \"Missing the required parameter 'collection_id' when calling CollectionsApi.update_collection\"\n end\n # verify the required parameter 'update_mask' is set\n if @api_client.config.client_side_validation && update_mask.nil?\n fail ArgumentError, \"Missing the required parameter 'update_mask' when calling CollectionsApi.update_collection\"\n end\n # verify the required parameter 'collection' is set\n if @api_client.config.client_side_validation && collection.nil?\n fail ArgumentError, \"Missing the required parameter 'collection' when calling CollectionsApi.update_collection\"\n end\n # resource path\n local_var_path = '/v4/collections/{collection_id}'.sub('{' + 'collection_id' + '}', CGI.escape(collection_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'update_mask'] = update_mask\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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(collection)\n\n # return_type\n return_type = opts[:debug_return_type] || 'Collection'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['BasicAuth']\n\n new_options = opts.merge(\n :operation => :\"CollectionsApi.update_collection\",\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: CollectionsApi#update_collection\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update(attributes, collection)\n @log.debug(\"Update called with:\\nAttributes #{attributes.inspect} \\nCollection: #{collection.inspect}\")\n updated = 0\n the_properties = {}\n attributes.each{|property, value| the_properties[property.field] = value}\n collection.each do |resource|\n model = resource.model\n class_name = class_name(model)\n id = model.serial.get(resource)\n @log.debug(\"Building edit URL with #{model} and #{id}\")\n edit_url = build_edit_url(class_name, id)\n begin\n page = @agent.get(edit_url) \n form_id = build_form_id(class_name, :update_form_id, id)\n @log.debug(\"Form id is #{form_id}\")\n the_form = page.form_with(:id => form_id)\n update_form = fill_form(the_form, the_properties, class_name)\n @log.debug(\"Update form is #{update_form.inspect}\")\n response = @agent.submit(update_form)\n @log.debug(\"Result of actual update call is #{response.code}\")\n if response.code.to_i == 302\n updated += 1\n end\n rescue => e\n @log.error(\"Failure while updating #{e.inspect}\")\n end\n end\n\n updated\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to account_collections_url, notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to collection_documents_path(@collection), notice: 'The collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = Collection.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to @collection, :notice => 'Collection was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_put_and_post_requests(request, data)\n content_type = request['Content-Type'] ||= 'application/x-www-form-urlencoded'\n case content_type\n when 'application/x-www-form-urlencoded'; request.form_data = data\n when 'application/json'; request.body = (data.is_a?(Hash) or data.is_a?(Array)) ? JSON.generate(data) : data\n else\n #data = data.to_s unless request.body.is_a?(String)\n request.body = data\n end\n process_request(request)\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateCollectionResultSet.new(resp)\n return results\n end",
"def update\n @collection = Collection.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = Collection.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = Collection.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_collection(collection)\n # Take the name out of the list of keys so that all that remains are fields to\n # be updated\n name = collection.delete(:name)\n # Because the name may come in many forms we must use something like titlecase to help\n # account for variations\n name = name.last.titleize\n \n # Due to the way that batches are handled a collection may appear multiple times. Presume\n # that if it has already been processed it is safe to skip any duplicates\n if (@successful_updates.include?(name) or \n @failed_updates.include?(name))\n log_message(\"Skipping duplicate collection entry\")\n return\n end\n\n coll = Collection.where(title: name).first\n \n if (coll.present? and (coll.title == name))\n log_message(\"Processing #{coll.title}\")\n update_and_save_metadata(coll, collection) \n @successful_updates << name\n else\n log_message(\"Could not locate #{name}\", Logger::WARN)\n @failed_updates << name\n end\n end",
"def put!\n request! :put\n end",
"def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end",
"def update\n begin\n @collection = Collection.find(params[:id])\n if params[:collection][:invite_only] && params[:invitations]\n @collection.invited_user_ids = params[:invitations][:user_ids] \n end\n @collection.assign_attributes(params[:collection])\n\n @collection.transaction do\n @collection.save!\n end\n\n render \"show\", handlers: [:rabl]\n \n rescue ActiveRecord::RecordInvalid => invalid\n render :json => @collection.errors.full_messages, status: 422\n end\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def put\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.put do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def update\n return_to = @collection.is_root? ? collections_path : collection_path\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to return_to, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_sync_collection_response(sync_token, collection_url, added, modified, deleted, properties)\n full_paths = []\n\n # Pre-fetching children, if this is possible.\n (added + modified).each do |item|\n full_path = collection_url + '/' + item\n full_paths << full_path\n end\n\n responses = []\n @server.properties_for_multiple_paths(full_paths, properties).each do |full_path, props|\n # The 'Property_Response' class is responsible for generating a\n # single {DAV:}response xml element.\n responses << Xml::Element::Response.new(full_path, props)\n end\n\n # Deleted items also show up as 'responses'. They have no properties,\n # and a single {DAV:}status element set as 'HTTP/1.1 404 Not Found'.\n deleted.each do |item|\n full_path = collection_url + '/' + item\n responses << Xml::Element::Response.new(full_path, {}, 404)\n end\n\n multi_status = Xml::Response::MultiStatus.new(responses, SYNCTOKEN_PREFIX + sync_token.to_s)\n\n @server.http_response.status = 207\n @server.http_response.update_header('Content-Type', 'application/xml; charset=utf-8')\n @server.http_response.body = @server.xml.write('{DAV:}multistatus', multi_status, @server.base_uri)\n end",
"def put(path, options={})\n response = request(path, :put, options)\n validate response\n responsed_response = parse response\n data = { headers: response.headers, body: parsed_response }\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n unless params[:update_collection].nil?\n process_banner_input\n process_logo_input\n end\n\n process_member_changes\n @collection.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE unless @collection.discoverable?\n # we don't have to reindex the full graph when updating collection\n @collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX\n if @collection.update(collection_params.except(:members))\n # This is the reason for the monkey patch.\n redirect_to hyrax.dashboard_collection_path, notice: t('hyrax.dashboard.my.action.collection_update_success')\n else\n after_update_error\n end\n end",
"def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tweet_collection.update(tweet_collection_params)\n format.html { redirect_to @tweet_collection, notice: 'Tweet collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @tweet_collection }\n else\n format.html { render :edit }\n format.json { render json: @tweet_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def do_PUT(req, res)\n perform_proxy_request(req, res) do |http, path, header|\n http.put(path, req.body || '', header)\n end\n end",
"def update\n respond_to do |format|\n if @users_collection.update(users_collection_params)\n format.html { redirect_to @users_collection, notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @users_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_put_request(url, data)\n headers = {\n \"Content-Type\" => \"application/json\",\n }\n\n response = HTTParty.put(url, body: data.to_json, headers: headers)\n\n if response.success?\n response\n else\n puts \"Request failed with response code: #{response.code}\"\n puts \"Response message: #{response.message}\"\n nil\n end\nend",
"def bulk_update(ids, pairs)\n # Bulk load documents\n # Map to doc\n # Filter out errors, or none founds (compact)\n # Select the Couch objects\n docs = database.couchrest_database.bulk_load(ids)['rows'].map{|r| r['doc']}.compact.select{|d| d.is_a?(SimplyStored::Couch)}\n for doc in docs\n pairs.each_pair do |k, v|\n doc.send(\"#{k}=\", v) if doc.respond_to?(\"#{k}=\")\n end\n doc.save # Should become a bulk update in the future\n end\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to '/collections'}#@collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end",
"def put_collection_key(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: args[:json] )\nend",
"def put(request, response)\n NotImplemented\n end",
"def put(request, response)\n NotImplemented\n end",
"def solr_collection_api(host_name,port,params,config_name=nil,path=\"/solr/admin/collections\")\n if not config_name.nil?\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&collection.configName=\"+config_name+\"&wt=json\"\n else\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&wt=json\"\n end\n Chef::Log.info(\" HostName = \" + host_name + \", Port = \" + port + \", Path = \" + path)\n http = Net::HTTP.new(host_name, port)\n req = Net::HTTP::Get.new(path)\n\n unless !SolrAuth::AuthUtils.auth_enabled?\n admin_creds = SolrAuth::AuthUtils.get_solr_admin_credentials\n req.basic_auth(admin_creds['username'], admin_creds['password'])\n end\n response = http.request(req)\n if response != nil then\n return JSON.parse(response.body())\n end\n raise StandardError, \"empty response\"\n end",
"def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n respond_to do |format|\n action_message_for(@collection.content_item.status)\n if update_collection\n format.html { redirect_to redirect_target(@collection), flash: @feedback_flash }\n format.json { render :show, status: :ok, location: @collection }\n else\n 1.times { @collection.collection_sections.new } if @collection.collection_sections.empty?\n @collection.collection_sections.each do |section|\n (6 - section.section_items.size).times { section.section_items.new }\n end\n @collection.content_item.status = session[:content_item_status]\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(docs, params = {}, body = {}, &block)\n ingest_docs = docs.map do |doc|\n { update: { _index: @index, _id: doc.delete('id'), data: { doc: doc } } }\n end\n if (slice = params.delete(:slice))\n ingest_docs.each_slice(slice) { |items| update(items, params, &block) }\n else\n bulk_request(ingest_docs, params, &block)\n end\n end",
"def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end",
"def update\n update! do |success, failure|\n success.html { redirect_to collection_path }\n end\n end",
"def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end",
"def update\n @collection = Collection.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n flash[:notice] = 'Collection was successfully updated.'\n format.html { redirect_to(@collection) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def web_dav_put(*args, &block)\n args = web_dav_args args\n map_method :put, args, &block\n end",
"def update\n @objects.map(&:update);\n end",
"def update\n @collection = @current_user.collections.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to [@current_user, @collection],\n notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, \n status: :unprocessable_entity }\n end\n end\n end",
"def update(attributes, collection)\n raise NotImplementedError, \"#{self.class}#update not implemented\"\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def batch_upsert_catalog_objects_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogApi.batch_upsert_catalog_objects ...\"\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling CatalogApi.batch_upsert_catalog_objects\" if body.nil?\n # resource path\n local_var_path = \"/v2/catalog/batch-upsert\".sub('{format}','json')\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 header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\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 => 'BatchUpsertCatalogObjectsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#batch_upsert_catalog_objects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\n end",
"def put(*args)\n request :put, *args\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @prev_page_token = args[:prev_page_token] if args.key?(:prev_page_token)\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @prev_page_token = args[:prev_page_token] if args.key?(:prev_page_token)\n end",
"def update\n task\n if @item.update(item_params)\n render json: @list.as_json, status: :ok\n else\n render json: {list: @item.errors, status: :unprocessable_entity}\n end\n end",
"def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end",
"def update\n put :update\n end",
"def update_many\n if @users.update_all(user_params)\n render json: @users, status: :ok, location: users_url\n else\n render json: @users.errors, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request, adapter = request_and_adapter_from(args)\n\n with_adapter :put, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end",
"def perform_request_with_objects_from_collection(request_method, path, options, klass, collection_name) # rubocop:disable Metrics/ParameterLists\n options = {collection_name.to_sym => options} unless options.empty?\n\n perform_request(request_method, path, options).fetch(collection_name.to_sym).collect do |element|\n klass.new(element)\n end\n end",
"def make_put_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Put.new(@uri.request_uri)\n request.body = @request_text\n @response = http.request(request)\n end\n puts \"Response is: #{get_response_code}\"\n puts \"Body is: #{@response.body}\"\n @response.body\n end"
] | [
"0.65280616",
"0.6281938",
"0.6096951",
"0.60133374",
"0.5982197",
"0.59089094",
"0.5884129",
"0.5857716",
"0.5815823",
"0.5771142",
"0.57020533",
"0.56889784",
"0.5671537",
"0.5665331",
"0.5625474",
"0.55587906",
"0.5538064",
"0.5535803",
"0.55294317",
"0.5424259",
"0.5415645",
"0.5380549",
"0.5376806",
"0.5373915",
"0.537332",
"0.53681916",
"0.5362702",
"0.5362702",
"0.5362702",
"0.5360023",
"0.5359995",
"0.53565913",
"0.5355598",
"0.5338102",
"0.5329728",
"0.5267089",
"0.5259539",
"0.52572364",
"0.52572364",
"0.52572364",
"0.5236752",
"0.52276295",
"0.5220782",
"0.5215845",
"0.5215806",
"0.5204388",
"0.5197628",
"0.5196234",
"0.51888984",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51830137",
"0.51710963",
"0.51692206",
"0.516744",
"0.5165497",
"0.5164792",
"0.5164791",
"0.5142936",
"0.51298434",
"0.5129123",
"0.5127378",
"0.5123632",
"0.5123632",
"0.51194435",
"0.5116344",
"0.51100886",
"0.51097876",
"0.51094097",
"0.5094114",
"0.50881624",
"0.50868356",
"0.50672805",
"0.5052934",
"0.50528455",
"0.50497764",
"0.50493234",
"0.5048104",
"0.5041413",
"0.50372756",
"0.5026388",
"0.5024385",
"0.5019848",
"0.50183237",
"0.50183237",
"0.501071",
"0.5005546",
"0.5003822",
"0.49970788",
"0.4988424",
"0.4986759",
"0.49842286"
] | 0.61211956 | 2 |
Performs DELETE requests and returns True on success. | def del(path, filter=nil)
# remove the leading slash
path = path.gsub(/\A\//, '')
response = self.class.delete(@endpoint + path)
response_msg = response_message response
raise "HTTP DELETE failed! #{response_msg}" unless response.code.between? 200, 300
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(api_path)\n true\n rescue Error::HTTPError\n false\n end",
"def delete\n client.delete(api_path)\n true\n rescue Error::HTTPError\n false\n end",
"def delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def DELETE(uri, credentials)\n delete = Net::HTTP::Delete.new(uri.path)\n\n response = submit(delete, uri, credentials)\n\n case response\n when Net::HTTPNoContent\n # Success, carry on...\n true\n else\n report_error(\"DELETE\", uri.path, response, credentials)\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\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 execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\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(*args)\n delete!(*args)\n rescue *exceptions\n false\n end",
"def send_delete_request(path)\n response = self.class.delete(path)\n # need auth\n case (response.code)\n when 200\n # just continue\n when 401\n authenticate(response)\n response = self.class.delete(path)\n else\n end\n if response.code != 200 && response.code != 202\n throw \"Could not finish request, status #{response.code}\"\n end\n response\n end",
"def delete(user)\n Rails.logger.debug \"Call to poll.delete\"\n reqUrl = \"/api/poll/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n return false if destroyed? || new_record?\n\n response = @client.connection.delete(url || path)\n\n @destroyed = true # FIXME always returns true\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def http_delete(request, response)\n path = request.path\n\n return false unless @server.emit('beforeUnbind', [path])\n\n @server.tree.delete(path)\n\n @server.emit('afterUnbind', [path])\n\n response.status = 204\n response.update_header('Content-Length', '0')\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\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 request(:delete)\n end",
"def cleanup\n for _ in 1..@attempts\n begin\n resp=@client.delete(@path)\n return true if @oks.include?(resp.status)\n rescue Exception => ex\n STDERR.puts \"WARNING: #{ex}\"\n end\n end\n STDERR.puts \"ERROR: Could not DELETE #{@path}\"\n false\n end",
"def delete(http_connection)\n success = true\n tries ||= 3\n display = []\n display.push file_path\n if File.exists?(self.file_path)\n begin\n request = Net::HTTP::Delete.new(api_url_for_delete)\n WebTranslateIt::Util.add_fields(request)\n display.push Util.handle_response(http_connection.request(request))\n puts ArrayUtil.to_columns(display)\n rescue Timeout::Error\n puts StringUtil.failure(\"Request timeout. Will retry in 5 seconds.\")\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n rescue\n display.push StringUtil.failure(\"An error occured: #{$!}\")\n success = false\n end\n else\n puts StringUtil.failure(\"\\nMaster file #{self.file_path} doesn't exist locally!\")\n end\n return success\n end",
"def test_delete_preconditions_failed\n request = Http::Request.new(\n 'DELETE',\n '/file1',\n 'If-Match' => \"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"\n )\n\n response = self.request(request)\n\n assert_equal(\n 412,\n response.status,\n \"Incorrect status code. Response body: #{response.body_as_string}\"\n )\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete!\n return if @deleted\n delete_page = @client.get @delete_url\n delete_form = delete_page.form_with(:action => /delete/i)\n delete_button = delete_form.button_with(:name => /delete/i)\n delete_form.submit delete_button\n @deleted = true\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 begin\n conn.delete(escaped_path)\n true\n rescue => e\n puts \"carrierwave-ucloud delete failed: #{e.inspect}\"\n nil\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end",
"def delete()\n\n client.delete(\"/tasks/#{gid}\") && true\n end",
"def delete\n return false\n end",
"def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end",
"def delete\n request('delete').auth_required!\n end",
"def delete?\r\nHTTP_METHOD_LOOKUP[request_method] == :delete\r\nend",
"def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end",
"def destroy!\n return false if destroyed? || new_record?\n\n @client.connection.delete(url || path) do |req|\n yield req if block_given?\n end\n\n @destroyed = true\n end",
"def delete\n code = @session.delete_research_object(@uri)[0]\n @loaded = false\n code == 204\n end",
"def http_delete(path, headers = {})\n clear_response\n path = process_path(path)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\n end",
"def delete!\n request! :delete\n end",
"def do_delete(uri = '')\n build_request(:delete, uri)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def perform_delete(path, options = {})\n perform_request(:delete, path, options)\n end",
"def delete\n response = @api.delete(@cloud.url(:delete, @process_id), token: @cloud.access_token.token)\n if response['StatusCode'] == 200\n true\n else\n false\n end\n end",
"def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end",
"def delete(params: {}, headers: {})\n self.class.delete(id, params: params, headers: headers)\n true\n end",
"def delete\n if params[:id]\n result = backend_instance.compute_delete(params[:id])\n else\n result = backend_instance.compute_delete_all\n end\n\n if result\n respond_with(Occi::Collection.new)\n else\n respond_with(Occi::Collection.new, status: 304)\n end\n end",
"def destroy\n response = API.instance.send_request('docs.delete', :doc_id => self.id)\n return response.elements['/rsp'].attributes['stat'] == 'ok'\n end",
"def delete(status, headers, env)\n [204, headers, destroy]\n end",
"def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def delete(path, options = {})\n request = Net::HTTP::Delete.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\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 delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def test_delete_not_found\n request = Http::Request.new('DELETE', '/file2')\n response = self.request(request)\n\n assert_equal(\n 404,\n response.status,\n \"Incorrect status code. Response body: #{response.body_as_string}\"\n )\n end",
"def post_delete_result!\n @operation = DELETE_REQUEST\n post_outcome_request\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end",
"def delete(key)\n\n # FIXME: insert code that connects to the backend and affects the delete\n # operation\n #\n # - This delete should be done atomically\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => false, :err_msg => 'FIXME: not implemented' }\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete(uri, options = {})\n build_response(request.delete(uri, build_request_options({:input => options.to_params})))\n end",
"def delete\n code = @session.delete_resource(@proxy_uri)[0]\n @loaded = false\n @research_object.remove_resource(self)\n code == 204\n end",
"def delete\n delete_from_server single_url\n end",
"def delete\n api_client.delete(url)\n end",
"def delete(path, params = {}, env = {}, &block)\n env[:request_method] = \"DELETE\"\n mock_request(path, params, env, &block)\n end",
"def destroy!\n response = perform(:delete, ref)\n @ref = nil\n @last_request_time = response.request_time\n true\n end",
"def destroy!\n response = perform(:delete, ref)\n @ref = nil\n @last_request_time = response.request_time\n true\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def delete(path, query = { }, headers = {})\n clear_response\n path = process_path(path, query)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def delete(auth, pullRequest)\n\t\t\turi = URI(\"#{auth.url}/#{auth.repo}/pulls/#{pullRequest.prnum}/reviews/#{@id}\")\n\t\t\t\n response = nil\n\t\t\tNet::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n \t\t\t\trequest = Net::HTTP::Delete.new(uri)\n\t\t\t request['Authorization'] = \"token #{auth.token}\"\n\t\t\t request['accept'] = \"application/json\"\n\t\t\t \n \t\t\t\tresponse = http.request request\n\t\t\tend\n\n\t\t\tif response.code.to_i < 200 or response.code.to_i >= 300\n\t\t\t\tputs \"Error: unexpected response code received from server: #{response.code}\"\n\t\t\t\tputs response\n\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\treturn true\n\t\tend",
"def delete_request?\n @operation == DELETE_REQUEST\n end",
"def delete(path, options={})\n url = build_url path, options\n headers = options[:headers] || {}\n # nothing returned in response body for DELETE\n Response.new(@client[url].delete headers)\n rescue RestClient::Exception => e\n Response.new e.response\n end",
"def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def delete(url, headers)\n conn = create_connection_object(url)\n\n http = conn.delete(:head => add_authorization_to_header(headers, @auth))\n\n action = proc do\n response = Response.new(http.response.parsed, http)#.response.raw)\n yield response if block_given?\n end\n\n http.callback &action\n http.errback &action \n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end",
"def delete(uri, options = {})\n execute(uri, :delete, options)\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete(path, options={})\n response = request(path, :delete, options)\n validate response\n parsed_response = parse response\n data = { headers: response.headers, body: parsed_response }\n end",
"def verify_delete(id)\n request(:delete, \"verify/#{id}\")\n end",
"def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end",
"def delete(id)\n @client.make_request(:delete, \"carrier_accounts/#{id}\")\n\n # Return true if succeeds, an error will be thrown if it fails\n true\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"def delete_host(fqdn, url, cookie)\n begin\n # set the headers\n headers = {\n :content_type => :json,\n :accept => :json,\n 'Cookie' => cookie,\n 'Referer' => url\n }\n\n # set the payload\n payload = {\n :method => 'host_del',\n :params => [\n [ fqdn ],\n {\n :continue => false,\n :updatedns => true\n }\n ]\n }\n\n # get response and convert to json\n response = call_rest(:post, url, headers, 'session/json', JSON.generate(payload))\n\n # validate response and return system object\n if response\n log(:info, \"delete_host: Response body: #{response.body}\") if @debug\n if response.code == DELETE_HOST_SUCCESS_CODE\n errors = JSON.parse(response.body)['error']\n log(:info, \"delete_host: The following errors were logged during the previous REST call: #{errors.inspect}\")\n\n # NOTE: success code 4001 indicate the host didn't exist\n if errors.nil? || errors['code'].to_i == 4001\n log(:info, \"delete_host: Successfully deleted host object for system: #{fqdn}\")\n return true\n else\n log(:warn, \"delete_host: Unable to delete system: #{fqdn} from IDM\")\n raise \"Please review the following errors: #{errors.inspect}\"\n end\n else\n log(:warn, \"delete_host: Unable to retrieve node object from PuppetDB for system: #{fqdn}. Returning false\")\n return false\n end\n else\n raise \"Invalid Response: #{response.inspect}\"\n end\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"delete_host: #{err}. Returning false\")\n return false\n end\nend",
"def delete(opts = {})\n response = Crocodoc.connection.post 'document/delete', :uuid => @uuid\n response.body.chomp.downcase == 'true'\n end",
"def delete\n\t\tfalse\n\tend",
"def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end",
"def delete\n fail CoachClient::NotFound.new(self), 'User not found' unless exist?\n CoachClient::Request.delete(url, username: @username, password: @password)\n true\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def destroy\n if @client.dois.present?\n message = \"Can't delete repository that has DOIs.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @client.update(is_active: nil, deleted_at: Time.zone.now)\n @client.send_delete_email unless Rails.env.test?\n head :no_content\n else\n # Rails.logger.error @client.errors.inspect\n render json: serialize_errors(@client.errors, uid: @client.uid),\n status: :unprocessable_entity\n end\n end",
"def deleteRequest\n\n end"
] | [
"0.76359123",
"0.76359123",
"0.7346285",
"0.732964",
"0.7224901",
"0.7188649",
"0.7170333",
"0.71282035",
"0.71282035",
"0.7117946",
"0.7095823",
"0.7095823",
"0.70018715",
"0.69749314",
"0.6956935",
"0.69361585",
"0.69131804",
"0.69006157",
"0.68136466",
"0.676404",
"0.67482144",
"0.67443585",
"0.66999024",
"0.669947",
"0.6692791",
"0.6667062",
"0.66660535",
"0.6616487",
"0.6616487",
"0.6616487",
"0.6616487",
"0.66116667",
"0.6605455",
"0.6579293",
"0.6573955",
"0.65558404",
"0.6549562",
"0.6527083",
"0.65207106",
"0.6517358",
"0.65167326",
"0.65108746",
"0.65060526",
"0.6504786",
"0.6487947",
"0.648781",
"0.64667565",
"0.6447951",
"0.64358026",
"0.6425397",
"0.642129",
"0.64033365",
"0.63920325",
"0.63895005",
"0.63738966",
"0.6359893",
"0.63579893",
"0.6337361",
"0.6322195",
"0.63117915",
"0.62905306",
"0.62837964",
"0.62829196",
"0.6282557",
"0.62823236",
"0.62795323",
"0.62612975",
"0.62548095",
"0.6254799",
"0.6254799",
"0.62457865",
"0.6231014",
"0.6230601",
"0.6229206",
"0.6207786",
"0.62004036",
"0.61995953",
"0.61925775",
"0.61806136",
"0.6177407",
"0.6160184",
"0.6156762",
"0.615216",
"0.61514896",
"0.61482805",
"0.6146485",
"0.6140761",
"0.61400247",
"0.6136983",
"0.6131295",
"0.61299586",
"0.6129144",
"0.6120739",
"0.6115385",
"0.61003596",
"0.60996175",
"0.6099548",
"0.6096361",
"0.60913336"
] | 0.6231254 | 72 |
Creates a link of a specified kind and binds it to the given resource. | def link(kind, source, target_location, target_kind, attributes=Occi::Core::Attributes.new, mixins=[])
link = Occi::Core::Link.new(kind)
link.mixins = mixins
link.attributes = attributes
link.target = (target_location.kind_of? URI::Generic) ? target_location.path : target_location.to_s
link.rel = target_kind
jj link
link.check @model
source.links << link
link
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(href, opts={})\n @resource.tap {|obj| obj.add_link(@rel, href, opts) }\n end",
"def link(resource,tag)\n self.class.link(self,resource,tag)\n end",
"def link!(resource, uuid)\n build_link(resource, uuid).save!\n end",
"def create_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'create')\n # text to be displayed\n link_text = crud_link_text(options, 'create')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n\n if defined? CanCan\n link += link_to link_text, url_for(resource), options if can?(:create, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n\n link\n end",
"def add_link(rel, target, opts={})\n raise ArgumentError, \"target must not be nil or empty\" if target.nil? || target.empty?\n templated = opts.fetch(:templated, false)\n\n new_link =\n if templated\n tmpl = if target.respond_to?(:pattern)\n target\n else\n Addressable::Template.new(target)\n end\n\n TemplatedLink.new(rel: rel,\n template: tmpl,\n hal_client: repr.hal_client)\n else\n SimpleLink.new(rel: rel,\n target: RepresentationFuture.new(target, repr.hal_client),\n embedded: false)\n end\n\n new_repr = Representation.new(repr.href,\n repr.properties,\n repr.all_links + [new_link],\n repr.hal_client)\n\n self.class.new(new_repr, orig_repr)\n end",
"def link(relation, href, options={})\n @resource.add_link relation, href, options\n end",
"def bi_link(resource,tag,reverse_tag=nil)\n self.class.bi_link(self,resource,tag,reverse_tag)\n end",
"def create_link(url, title = nil, description = nil)\n Dropio::Resource.client.create_link(self, url, title, description)\n end",
"def link_to_resource(namespace, resource)\n cls = \"navigation__link navigation__link--#{nav_link_state(resource)}\"\n link_to display_resource_name(resource), [namespace, resource.path],\n class: cls\n end",
"def create_and_link(title, itype, ltype, o={})\n item = Item.find_or_create(title, itype, o)\n Link.find_or_create(item.id, id, ltype, o)\n end",
"def create\n @link_resource = LinkResource.new(link_resource_params)\n\n respond_to do |format|\n if @link_resource.save\n format.html { redirect_to @lab, notice: 'Link resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link(what = nil)\n escaped_ident = URI.escape(ident) + \".#{extension}\"\n\n case what\n when :sync\n \"/api/SYNC/#{escaped_ident}\"\n when :perma\n \"/#{escaped_ident}?sha=#{sha}\"\n when :edit\n # FIXME:\n \"/edit/#{escaped_ident}\"\n when :version\n \"/#{escaped_ident}?sha=#{history.first.sha}\"\n when :history\n \"/history/#{escaped_ident}\"\n when :compare\n \"/compare/#{sha}/#{history.first.sha}/#{escaped_ident}\"\n when :revert\n \"/revert/#{sha}/#{escaped_ident}\"\n when :revert_do\n \"/revert/#{sha}/#{escaped_ident}?do_it=1\"\n when :reread\n \"/clear_cache/#{URI.escape(ident)}.#{extension}\"\n else\n \"/#{escaped_ident}\"\n end\n end",
"def resource(rel, href=nil, &embedded_definition)\n embedded = Halibut::Builder.new(href, &embedded_definition)\n\n @resource.embed_resource(rel, embedded.resource)\n end",
"def link_of_item(kind)\n\titem = @items.find { |i| i.attributes()[:kind] == kind }\n\tlink_to(kind.capitalize, @site.config()[:base_url] + item.path) unless item.nil?\nend",
"def create\n raise ArgumentError, 'Symlink target undefined' unless to\n might_update_resource do\n provider.create\n end\n end",
"def set_link_resource\n @link_resource = LinkResource.find(params[:id])\n end",
"def resource(href=nil, &embedded_definition)\n embedded = Halibut::Builder.new(href, &embedded_definition)\n\n @resource.embed_resource(@rel, embedded.resource)\n end",
"def link(*args, &block)\r\n name, options = args.shift, args.extract_options!\r\n\r\n if association_name = args.shift\r\n association = model.reflect_on_association association_name\r\n\r\n if association.nil?\r\n raise Error, \"#{model} has no association `#{association_name}'\"\r\n end\r\n\r\n class_eval <<CODE, __FILE__, __LINE__ + 1\r\ndef #{name}\r\n unless attributes.has_key?(:#{name})\r\n raise Restful::Resource::Base::UnknownAttributeError,\r\n \"unknown attribute for version \\#{version}: #{name}\"\r\n end\r\n\r\n Restful::Resource::AssociationProxy.new self, :#{association_name}, :#{name}\r\nend\r\nCODE\r\n elsif association_name == false\r\n attribute name, false, options\r\n return\r\n else\r\n association = model.reflect_on_association(association_name = name)\r\n end\r\n\r\n if association\r\n versions[@version][:associations] ||= {}\r\n versions[@version][:associations][name] = association_name\r\n\r\n if query_template && query_template !~ /include/\r\n self.query_template = query_template.gsub /\\}/, \",include}\"\r\n end\r\n end\r\n\r\n case name\r\n when nil, self, :href\r\n if block_given?\r\n attribute :href, options, &block\r\n else\r\n instance_eval <<CODE, __FILE__, __LINE__ + 1\r\nattribute :href, options do\r\n resources_#{self.name.demodulize.underscore}_path(resource, format)\r\nend\r\nCODE\r\n end\r\n when false\r\n attribute :href, false, options\r\n else # when Symbol\r\n if block_given?\r\n attribute name, options, &block\r\n elsif association\r\n model = begin\r\n association.klass\r\n rescue NameError => e\r\n \"nil\"\r\n end\r\n\r\n if association.macro.to_s =~ /^(?:belongs_to|has_one)$/\r\n instance_eval <<CODE, __FILE__, __LINE__ + 1\r\nattribute name, options do\r\n if resource.#{association_name}\r\n klass = Restful::Resource.class_for_model(#{model})\r\n\r\n path = if klass\r\n send \"resources_\\#{klass.name.demodulize.underscore}_path\",\r\n resource.#{association_name}, format\r\n else\r\n polymorphic_path [:resources, resource.#{association_name}],\r\n :format => format\r\n end\r\n\r\n query_template = if options[:query_template]\r\n options[:query_template]\r\n elsif klass\r\n klass.query_template(version).to_s\r\n else\r\n DEFAULT_COLLECTION_QUERY_TEMPLATE\r\n end\r\n\r\n path + query_template\r\n end\r\nend\r\nCODE\r\n else # :has_many\r\n path = self.name.demodulize.underscore\r\n instance_eval <<CODE, __FILE__, __LINE__ + 1\r\nattribute name, options do\r\n query_template = if options[:query_template]\r\n options[:query_template]\r\n elsif klass = Restful::Resource.class_for_model(#{model})\r\n klass.query_template(version).to_s\r\n else\r\n DEFAULT_COLLECTION_QUERY_TEMPLATE\r\n end\r\n\r\n #{name}_resources_#{path}_path(resource, format) + query_template\r\nend\r\nCODE\r\n end\r\n else\r\n instance_eval <<CODE, __FILE__, __LINE__ + 1\r\nattribute name, options do\r\n polymorphic_path [:#{name}, :resources, resource], :format => format\r\nend\r\nCODE\r\n end\r\n end\r\n end",
"def resource_link=(value)\n @resource_link = value\n end",
"def add_hardlink(uri, targeturi)\n @hardlinks[uri] = targeturi\n end",
"def resource(rel, href=nil, &embedded_definition)\n embedded = self.class.new(@view_context, href: href)\n @view_context._swap_context(embedded, &embedded_definition) if block_given?\n @resource.embed_resource(rel, embedded._resource)\n end",
"def link(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::LINK, path, to, as, constraints, &blk)\n end",
"def link(label, target, op, flow_name=nil)\n label = label.to_sym unless label.nil?\n op = op.to_sym unless op.nil?\n flow_name = flow_name.to_sym unless flow_name.nil?\n raise ConfigError.new(\"Link #{label} already exists.\") unless @links[label].nil?\n @links[label] = Link.new(flow_name, target.to_sym, op)\n end",
"def link(param)\n if param.is_a? String\n param\n else\n \"#{Starwars::Base::BASE_URL}/#{const_get('RESOURCE_NAME')}/#{param}/\"\n end\n end",
"def call(_obj, args, ctx)\n Link.create! description: args[:description],\n url: args[:url],\n user: ctx[:current_user]\n end",
"def make_link(label, path, **opt, &block)\n label = opt.delete(:label) || label if opt.key?(:label)\n named = accessible_name?(label, **opt)\n title = opt[:title]\n new_tab = (opt[:target] == '_blank')\n sign_in = has_class?(opt, 'sign-in-required')\n http = path.is_a?(String) && path.start_with?('http')\n\n opt = add_inferred_attributes(:a, opt)\n hidden = opt[:'aria-hidden']\n disabled = opt[:'aria-disabled']\n\n opt[:'aria-label'] = title if title && !named\n opt[:tabindex] = -1 if hidden && !opt.key?(:tabindex)\n opt[:tabindex] = 0 if sign_in && !opt.key?(:tabindex)\n opt[:rel] = 'noopener' if http && !opt.key?(:rel)\n append_tooltip!(opt, NEW_TAB) if new_tab && !disabled\n\n link_to(label, path, html_options!(opt), &block)\n end",
"def add_link(target)\n link = Link.new\n link.target_type = target.class.to_s\n link.target_id = target.id\n #adding a link to the link collection should set the polymorphic assosication\n links << link\n link\n end",
"def link(text, target, attributes = {})\n if target.is_a? Fixnum\n attributes[:rel] = rel_value(target)\n target = url(target)\n end\n @template.link_to(text, target, attributes)\n end",
"def activation_resource(sapi_name, sapi_file = nil)\n sapi_file ||= sapi_file_path(sapi_name, new_resource.priority)\n link sapi_file do\n to new_resource.path\n action :nothing\n end\n end",
"def link uri\n self.apply_hyperlink java.net.URI.new(uri)\n end",
"def create_symlink(dest_path); end",
"def link_object(obj, title = T.unsafe(nil), anchor = T.unsafe(nil), relative = T.unsafe(nil)); end",
"def add_link(el, href, title, alt_text = nil, ial = nil)\n el.options[:ial] = ial\n update_attr_with_ial(el.attr, ial) if ial\n if el.type == :a\n el.attr['href'] = href\n else\n el.attr['src'] = href\n el.attr['alt'] = alt_text\n el.children.clear\n end\n el.attr['title'] = title if title\n @tree.children << el\n end",
"def link(*args)\n Restfulie::Common::Builder::Rules::Link.new(*args)\n end",
"def create_symlink(source = nil, dest = nil)\n end",
"def make_link(source:, link:)\n @output.item @i18n.t('setup.ln', target: link, source: source)\n FileUtils::rm link if (File::symlink? link and not File::exist? link)\n FileUtils::ln_s source, link unless File::exist? link\n end",
"def new\n @resource = Resource.new \n @link = Link.new\n end",
"def link(from,to,tag)\n if(to.local?)\n raise JiakResourceException, \"Can't link to a local resource\"\n end\n\n link = JiakLink.new(to.jiak.object.bucket, to.jiak.object.key, tag)\n unless from.jiak.object.links.include?(link)\n from.jiak.object.links << link\n do_auto_update(from)\n end\n from\n end",
"def external_link(label, path, **opt, &block)\n opt[:target] = '_blank' unless opt.key?(:target)\n make_link(label, path, **opt, &block)\n end",
"def link_new(text = t(\"admin.common.new_link\"), url = new_resource_url)\n link_to text, url, :class => 'new'\n end",
"def get_link_uri(resource_type)\n refresh if links.nil?\n links[resource_type.to_sym]\n end",
"def view_link(resource, *args)\n link = ''.html_safe\n\n resource_name = normalized_resource_name(resource)\n object = determine_proper_resource(resource)\n options = args.first || {}\n\n # CSS classes for this crud link\n crud_link_css(options, 'view')\n # text to be displayed\n link_text = crud_link_text(options, 'view')\n\n # (optional) add a tooltip to the link\n if options.keys.include?(:tooltip)\n add_tooltip(options)\n end\n\n options[:id] = 'view-' + link_id(object)\n options[:title] = 'View this ' + resource_name\n\n if defined? CanCan\n link += link_to link_text, url_for(resource), options if can?(:read, object)\n else\n link += link_to link_text, url_for(resource), options\n end\n\n link\n end",
"def link_target(name, resource)\n read(name, resource) do |file|\n if file.header.typeflag == \"2\"\n return File.absolute_path(file.header.linkname,File.dirname(resource))\n end\n return nil\n end\n return nil\n end",
"def link_to(url, text = nil, label = nil, attributes = {})\n if label.is_a?(Hash)\n attributes = label\n label = nil\n end\n if text.is_a?(Model) || text.is_a?(Class) && text.ancestors.include?(Model)\n text.link_for(url, label, attributes)\n elsif url.is_a?(Model) || url.is_a?(Class) && url.ancestors.include?(Model)\n url.link_for(url, text, attributes)\n else\n tag(:a, text, attributes.merge(href: url))\n end\n end",
"def resource(name, type=nil, &block)\n resource = GenericResource.new\n resource.type = type\n resource.evaluate &block\n add_resource name, resource\n end",
"def kind=(str)\n self.linkinfo ||= LinkInfo.new\n linkinfo.kind = str\n end",
"def link_resource_params\n params.require(:link_resource).permit(:lab_id, :name, :url, :description)\n end",
"def link\n display_change\n begin\n File.symlink(@real_path, new_path)\n rescue NotImplemented\n puts \"Error: cannot create symlinks\"\n end\n end",
"def activate_resource(resource, version)\n unless synced?(resource, version)\n log.error \"attempt to activate resource #{resource} version #{version} but it is not synced from server\"\n return\n end\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n work_link = %W(#{@workdir} #{resource}).join('/')\n deactivate_resource(resource) if File.symlink?(work_link)\n FileUtils.mkdir_p(File.dirname(work_link))\n File.symlink data_file, work_link\n log.debug \"activated resource #{resource} version #{version}\"\n end",
"def uri_discoverer(service_type, resource_name)\n rd = ResourceDescriptor.new(self, service_type, resource_name)\n lambda { rd.href } \n end",
"def transform_Resource(o, scope)\n Types::TypeFactory.resource(o.type, o.title)\n end",
"def link(tag)\n apply_uri_template @tag_link_template, tag: safe_parameterize(tag)\n end",
"def serialize_resource(resource)\n link_id, link_type = link_id_and_type(resource)\n\n linkage = if link_id\n {\n inverse_id => link_id,\n :type => link_type\n }\n else\n nil\n end\n\n {\n linkage: linkage,\n related: url_for(resource)\n }\n end",
"def link (rel, res, opts={})\n\n id, opts = if opts.is_a?(Hash)\n [ opts.delete(:id), opts ]\n else\n [ opts, {} ]\n end\n\n href = \"/#{res}\"\n\n href = \"#{href}/#{OpenWFE.to_uscores(id)}\" if id\n\n href = \"#{href}?#{opts.collect { |k, v| \"#{k}=#{v}\" }.join('&')}\" \\\n if opts.size > 0\n\n [ href, rel ]\n end",
"def external_link(link_label, url, options={})\n attributes = options[:attributes] || {}\n children = options[:children] || {}\n image = options[:image] || {}\n\n img =\"\"\n unless image.empty?\n img = self.external_image(image[:url], image, true) \n end\n\n child_elements = self.children_list(children) << img\n link_label = self.tag('label', link_label)\n url = self.tag('url', url)\n link = self.tag('externalLink', url << link_label << child_elements, attributes)\n\n cell = options[:cell] || {}\n row = options[:row] || {}\n self.row_cell(link, cell, row)\n end",
"def link(text, target, attributes = {})\n if target.is_a? Fixnum\n attributes[:rel] = rel_value(target)\n target = url(target)\n end\n @template.link_to(text, target, attributes.merge(:remote => true))\n end",
"def new_link\n @link = Link.new\n end",
"def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end",
"def <<(resource)\n relate_resource(resource)\n super\n end",
"def new_resource_url\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_url\")\n end",
"def create_resource id, url, hash\n # TODO\n page = resource_page id\n if is_url? url\n create_new_archive page, url, hash\n end\n content = 'TODO'\n write! page, content\n end",
"def linked_to_for(name, predicate, options)\n Tripod::Links::LinkedTo.new(name, predicate, options)\n end",
"def link_to(dest)\n dir = File.dirname(dest)\n FileUtils.makedirs(dir) unless Dir.exist?(dir)\n FileUtils.symlink(@path, dest)\n end",
"def add(name, resource, attributes = {})\n resources[name] = resource\n resource.update_attributes(attributes) if attributes.any?\n resource\n end",
"def link_to (label, url)\n \"<a href='#{url}'>#{label}</a>\"\n end",
"def ar_show_link resource= @resource\n link_to(controller.ardata.labels[:show], ar_resource_path('', resource))\n end",
"def text_link(label,options={})\n options[:label]=label\n set RGhost::TextLinkIn.new(options)\n end",
"def link( src, dest )\n if ( win? )\n FileUtils.cp_r( src, dest )\n else\n File.symlink( src, dest )\n end\n end",
"def link_to(name, url, options = {}); end",
"def link(opts)\n \"#{opts[:name]} !LINK_OPEN_TAG!#{opts[:href]}!LINK_CLOSE_TAG!\"\n end",
"def ar_resource_url resource= @resource\n meth= \"#{ardata.resource_method(@parent_resource, '')}_url\"\n \n if @parent_resource\n send meth, @parent_resource, resource\n else\n send meth, resource\n end\n end",
"def add_link(lh)\n lnk_wid = lh[:wid]\n\tlnk_role = lh[:role]\n\t\n\t# find or create the attach node\n if @doc.xpath('//field[@id=\"linkedWorkItems\"]/list').last.nil?\n Nokogiri::XML::Builder.with(@doc.xpath('//work-item').last) do\n field(:id => 'linkedWorkItems') {\n\t list {}\n\t }\n end\n end\n\t\n\t# build and attach the link struct\n\tNokogiri::XML::Builder.with(@doc.xpath('//field[@id=\"linkedWorkItems\"]/list').last) do\n\t struct {\n\t item(:id => 'revision')\n\t\titem(:id => 'workItem') {\n\t\t text lnk_wid\n\t\t}\n\t\titem(:id => 'role') {\n\t\t text lnk_role\n\t\t}\n\t }\n\tend\n end",
"def create(resource, format=@default_format)\n options = { resource: resource.class, format: format }\n reply = post resource_url(options), resource, fhir_headers(options)\n if [200,201].include? reply.code\n type = reply.response[:headers][:content_type]\n if !type.nil?\n if type.include?('xml') && !reply.body.empty?\n reply.resource = resource.class.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n reply.resource = resource.class.from_fhir_json(reply.body)\n else\n reply.resource = resource # just send back the submitted resource\n end\n else\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n reply.resource = resource # just send back the submitted resource\n end\n reply.resource_class = resource.class\n reply\n end",
"def make_link(old) File.link(old, path) end",
"def make_link( old ) File.link( old, expand_tilde ) end",
"def declare_resource(type, name, created_at=nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n resource = build_resource(type, name, created_at, &resource_attrs_block)\n\n run_context.resource_collection.insert(resource, resource_type: type, instance_name: name)\n resource\n end",
"def single_link_for_rel(rel)\n sym = rel.sym\n Link.new(self, nil, :label => sym, :local => rel.alias?) do \n send(sym)\n end\n end",
"def link *args\n self.destination_and_options( args ) do |lnk, opts|\n symlink_requested = self.directory? || opts[:symbolic] || opts[:sym] || opts[:soft]\n \n if symlink_requested\n self.symlink lnk, opts\n else\n FileUtils.ln self, lnk, ** Utils::Opts.narrow_file_utils_options( opts, :ln )\n end\n \n lnk.fwf_filepath\n end\n end",
"def add_resource_route( resource, info)\n\n namespaces = resource.split('::')\n resource_name = namespaces.pop\n h = @resources_routes\n namespaces.each do |namespace|\n h[namespace] ||= {}\n h = h[namespace]\n end\n h[resource_name] ||= []\n h[resource_name].push(info)\n\n# @resources_routes[resource.to_sym] ||= []\n# @resources_routes[resource.to_sym].push( info )\n end",
"def declare_resource(type, name, created_at: nil, run_context: self.run_context, enclosing_provider: nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n resource = build_resource(type, name, created_at: created_at, enclosing_provider: enclosing_provider, &resource_attrs_block)\n\n run_context.resource_collection.insert(resource, resource_type: resource.declared_type, instance_name: resource.name)\n resource\n end",
"def add_nested_resource(resource, nested_resource, options={})\n target = options[:target].present? ? options[:target] : \".#{nested_resource.to_s}\"\n\n if options[:content] == false\n resource.link_to_add(fa_icon('plus'), nested_resource, data:{target: target, toggle:'tolltip', title: t('simple_form.nested_btn.defaults.add')}, class:'btn btn-primary')\n else\n content = options[:content] || nested_resource.to_s.singularize\n content = t(\"mongoid.models.#{content}.one\") if options[:localize] && options[:content].blank?\n resource.link_to_add(fa_icon('plus', text: t('simple_form.nested_btn.add', model: content)), nested_resource, data:{target: target}, class:'btn btn-primary')\n end\n end",
"def link(content,href,options={})\n options.update :href => href\n tag :a, content, options\n end",
"def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end",
"def kind\n linkinfo && linkinfo.kind\n end",
"def add_resource(name, opts)\n if (resources[name])\n raise RuntimeError,\n \"The supplied resource '#{name}' is already added.\", caller\n end\n\n # If a procedure was passed, mount the resource with it.\n if (opts['Proc'])\n mount(name, Handler::Proc, false, opts['Proc'], opts['VirtualDirectory'])\n else\n raise ArgumentError, \"You must specify a procedure.\"\n end\n end",
"def add_link(uri, x0, y0, x1, y1)\n PDF::Writer::Object::Annotation.new(self, :link, [x0, y0, x1, y1], uri)\n end",
"def create_symlink(old_name, new_name)\n File.symlink(old_name, new_name)\n end",
"def create_symlink(old_name, new_name)\n File.symlink(old_name, new_name)\n end",
"def link(link, title, content)\n link = OodAppkit.files.api(path: @app_path.to_s + '/' + link).to_s if @app_path && relative?(link)\n return \"<a href=\\\"#{link}\\\" rel=\\\"noopener\\\" target=\\\"_blank\\\">#{content}</a>\" unless id_link?(link)\n return \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end",
"def link_schema\n @schema['definitions'][@resource_name]['links'][@link_index]\n end",
"def link *a, &b; app.link *a, &b end",
"def command_link(m, uri_string)\n if uri_string.empty?\n m.user.send help_link\n else\n # Verify this is a valid URI\n uri = Addressable::URI::parse(uri_string)\n\n if uri.scheme.nil?\n # No scheme for URI, parse it again with http in front\n uri = Addressable::URI.parse(\"http://#{uri.to_s}\")\n end\n\n new_link = Link.create(\n :uri => uri,\n :user => m.user.nick\n )\n\n if new_link.saved?\n m.user.send \"Added link suggestion #{new_link.uri}\"\n else\n new_link.errors.each do |e|\n m.user.send e.first\n end\n end\n end\n end",
"def link(params)\n kind = get_param(params, :kind)\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would create a link of type #{kind} from issue #{params[:issue]} to issue #{params[:to]}\",\n :tags => [:jira, :dryrun])\n nil\n else\n from_key = get_param(params, :issue)\n to_key = get_param(params, :to)\n issue = issueify(from_key)\n to = issueify(to_key)\n if issue && to\n # The SOAP and RPC apis don't support linking so we have go via the web form instead\n uri = URI.parse(@config[:address])\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n # Login first to get the cookie and token\n req = Net::HTTP::Post.new('/login.jsp')\n req.set_form_data('os_authType' => 'basic', 'os_cookie' => true)\n req.basic_auth(@config[:auth][:username], @config[:auth][:password])\n\n response = http.request(req)\n\n if response.code.to_i == 200\n cookies = response.get_fields('set-cookie').collect { |cookie| cookie.split(';')[0] }\n doc = Nokogiri::HTML(response.body)\n token = ''\n doc.xpath(\"//meta[@id='atlassian-token']\").each do |meta_tag|\n token = meta_tag['content']\n end\n\n req = Net::HTTP::Post.new('/secure/LinkExistingIssue.jspa')\n req.set_form_data('id' => issue.id,\n 'linkKey' => to.key,\n 'linkDesc' => kind,\n 'comment' => params[:comment] || '',\n 'atl_token' => token)\n req['Cookie'] = cookies.to_s\n\n response = http.request(req)\n if response.code.to_i >= 400\n raise \"Could not link JIRA issue #{issue.key} to #{to.key}, response status was #{response.code.to_i}\"\n end\n notify(:msg => \"[#{@name}] Created a link of type #{kind} from issue #{issue.key} to issue #{to.key}\",\n :tags => [:jira, :trace])\n else\n raise \"Could not login to JIRA via http/https, response status was #{response.code.to_i}\"\n end\n else\n raise \"Could not find the JIRA issue #{from_key}\" unless issue\n raise \"Could not find the target JIRA issue #{to_key}\" unless to\n end\n issue\n end\n end",
"def create_link(auth)\n\t\texp = auth['credentials']['expires_at']\n\t\texp = DateTime.strptime(\"#{exp}\",'%s') if exp\n\t\tlinks.create(\n\t\t\tprovider: auth['provider'],\n\t\t\tuid: auth['uid'],\n\t\t\taccess_token: auth['credentials']['token'],\n\t\t\taccess_token_secret: auth['credentials']['secret'],\n\t\t\trefresh_token: auth['credentials']['refresh_token'],\n\t\t\ttoken_expires_at: exp\n\t\t)\n\tend",
"def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end",
"def link( index )\n\t\tLink.new( \n\t\t\tself.words[ self.link_lword(index) ],\n\t\t\tself.words[ self.link_rword(index) ],\n\t\t\tself.link_length(index),\n\t\t\tself.link_label(index),\n\t\t\tself.link_llabel(index),\n\t\t\tself.link_rlabel(index),\n\t\t\tLinkTypes[ self.link_label(index).gsub(/[^A-Z]+/, '').to_sym ]\n\t\t)\n\tend",
"def add_link step, condition\n # need to review whether we need links as a has table of this kind\n link = Link.new(step, condition)\n @links[condition] = link\n condition.step.add_link link\n link\n end",
"def add(resource)\n get_resource(resource.type).add(resource.value)\n end",
"def link(_content, _url)\n raise NotImplementedError\n end",
"def network_share_link(network, resource = '')\n base_uri = 'https://twitter.com/home?status=%23OffeneGesellschaft%20' if network == :twitter\n base_uri = 'https://www.facebook.com/sharer.php?u=' if network == :facebook\n resource_uri = request.original_url if resource == ''\n resource_uri = event_url(resource) if resource.is_a? Event\n resource_uri = user_url(resource) if resource.is_a? User\n resource_uri = slugged_blogpost_url(slug: resource.slug) if resource.is_a? Blogpost\n \"#{base_uri}#{URI.escape(resource_uri)}\"\n end"
] | [
"0.66841847",
"0.66141325",
"0.63976157",
"0.63182503",
"0.62598115",
"0.62305516",
"0.596212",
"0.5918566",
"0.58841217",
"0.5785351",
"0.57206076",
"0.5716628",
"0.5707941",
"0.56757027",
"0.5627898",
"0.5571536",
"0.5528279",
"0.5518384",
"0.5507917",
"0.5470062",
"0.54669935",
"0.53211004",
"0.5315702",
"0.53143674",
"0.529141",
"0.52903676",
"0.5262471",
"0.5258585",
"0.52376443",
"0.5236337",
"0.52266544",
"0.5216518",
"0.52048075",
"0.5201388",
"0.5195667",
"0.5193425",
"0.518736",
"0.51825345",
"0.51637065",
"0.51574403",
"0.51483077",
"0.51410735",
"0.5130209",
"0.51281905",
"0.51154643",
"0.51064974",
"0.50993615",
"0.5095813",
"0.5093158",
"0.50872356",
"0.50859624",
"0.508274",
"0.50812286",
"0.5080406",
"0.5064068",
"0.5055176",
"0.50549835",
"0.503038",
"0.5027374",
"0.502094",
"0.5004443",
"0.50022995",
"0.49906826",
"0.49823785",
"0.49713126",
"0.49699253",
"0.49643368",
"0.49631867",
"0.4963086",
"0.496293",
"0.49609888",
"0.4957125",
"0.49425298",
"0.4937617",
"0.4909603",
"0.4900115",
"0.48972884",
"0.48889187",
"0.48730528",
"0.48670834",
"0.48618436",
"0.48465893",
"0.48457432",
"0.48432052",
"0.48429546",
"0.4836361",
"0.4835929",
"0.4835929",
"0.4818771",
"0.4816698",
"0.48157892",
"0.48146072",
"0.48106366",
"0.48029917",
"0.4802991",
"0.48009992",
"0.4784598",
"0.4780148",
"0.47790155",
"0.47788483"
] | 0.6589466 | 2 |
Checks whether the given endpoint URI is valid and adds a trailing slash if necessary. | def prepare_endpoint(endpoint)
raise 'Endpoint not a valid URI' if (endpoint =~ URI::ABS_URI).nil?
@endpoint = endpoint.chomp('/') + '/'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_url_ends_with_slash(url)\n return \"#{url}/\" unless url.end_with?(\"/\")\n\n return url\n end",
"def valid_endpoint(ep)\n if ep == nil\n raise ArgumentError, \"Request: An endpoint must be set\", caller\n elsif not ep.is_a? String\n raise TypeError, \"Request: An endpoint must be a string\", caller\n elsif ep.length == 0 # If endpoint was set to \"\"\n raise TypeError, \"Request: Endpoint cannot be empty\", caller\n elsif ep[0] != '/'\n raise ArgumentError, \"Request: Endpoint must begin with a '/'\", caller\n end\n\n # If we make it to here, we're good - so just return the endpoint\n ep\n end",
"def invalid_uri?(uri)\n uri.grep(/^(#{PROTOCOLS.join('|')}):\\/\\/\\w/).empty?\n end",
"def conform_uri(uri_string)\n uri_string.gsub(/^(?!\\/)(.*)/, '/\\1').gsub(/[\\/]+$/, '')\n end",
"def validate_uri( uri, dir, doc )\n # do not retry external uris that have already been validated\n return if @valid_uris.include? uri.to_s\n\n return validate_relative_uri(uri, dir, doc) if uri.relative?\n return validate_external_uri(uri, dir, doc) if uri.respond_to? :open\n\n # otherwise, post a warning that the URI could not be validated\n @log.warn \"could not validate URI '#{uri.to_s}'\"\n end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def endpoint_present?\n endpoint = Endpoint.find_by(user_id: user_id, verb: verb, path: path)\n if endpoint && (id.present? ? id != endpoint[:id] : true)\n errors.add(:verb, \"Endpoint already exist for the combination verb: #{verb} and path: #{path}\")\n errors.add(:path, \"Endpoint already exist for the combination path: #{path} and verb #{verb}\")\n end\n end",
"def validate\n unless self.uri.blank?\n self.uri = \"http://#{self.uri}\" unless URI.parse(self.uri).absolute? \n end\n rescue\n errors.add(:uri, \"malformed uri -- please check it\")\n end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def calculate_uri(uri)\n if uri[0] != '/' && uri.index('://') && uri.index('://') > 0\n uri = ::URI.split(uri)[5] # path component of uri\n end\n\n uri = Uri.normalize(uri.gsub('//', '/'))\n base_uri = Uri.normalize(self.base_uri)\n\n if uri.index(base_uri) == 0\n return Http::UrlUtil.decode_path(uri[base_uri.length..-1]).gsub(%r{^/+}, '').gsub(%r{/+$}, '')\n\n elsif \"#{uri}/\" == base_uri\n # A special case, if the baseUri was accessed without a trailing\n # slash, we'll accept it as well.\n return ''\n else\n fail Exception::Forbidden, \"Requested uri (#{uri}) is out of base uri (#{self.base_uri})\"\n end\n end",
"def valid_endpoint?(target)\n endpoints.include? target\n end",
"def redirect_trailing_slash?\n @redirect_trailing_slash\n end",
"def validate_relative_uri( uri, dir, doc )\n return validate_anchor(uri, doc) if uri.path.empty?\n\n path = if uri.path =~ %r/^\\//\n ::File.join(::Webby.site.output_dir, uri.path)\n else\n ::File.join(dir, uri.path)\n end\n path = ::File.join(path, 'index.html') if ::File.extname(path).empty?\n\n uri_str = path.dup\n (uri_str << '#' << uri.fragment) if uri.fragment\n return if @valid_uris.include? uri_str\n\n if test ?f, path\n valid = if uri.fragment\n validate_anchor(uri, Hpricot(::File.read(path)))\n else true end\n @valid_uris << uri_str if valid\n else\n @log.error \"invalid URI '#{uri.to_s}'\"\n end\n end",
"def validate_uri(url)\n !!URI.parse(url)\n end",
"def sanitize_endpoint(endpoint, interface_specification)\n if endpoint.kind_of? String\n return sanitize_endpoint(@context.lookup_uri(endpoint), interface_specification)\n end\n unless endpoint.respond_to? interface_specification\n endpoint = @context.lookup_uri(\"#{endpoint.uri()}?api=#{interface_specification}\")\n end\n endpoint\n end",
"def validate_endpoint(endpoint)\n begin\n Chef::Log.debug endpoint.get_endpoints\n rescue\n Chef::Log.error \"Unable to connect to the kubernetes api at #{endpoint.api_endpoint}\"\n end\n\n endpoint\n end",
"def validate_uri(url)\n !!URI.parse(url)\n end",
"def trailing_slash_fix\n '/' unless ENV['PROXIED_IIIF_SERVER_URL'].last == '/'\n end",
"def check_path(v)\n # raise if both hier and opaque are not nil, because:\n # absoluteURI = scheme \":\" ( hier_part | opaque_part )\n # hier_part = ( net_path | abs_path ) [ \"?\" query ]\n if v && @opaque\n raise InvalidURIError,\n \"path conflicts with opaque\"\n end\n\n # If scheme is ftp, path may be relative.\n # See RFC 1738 section 3.2.2, and RFC 2396.\n if @scheme && @scheme != \"ftp\"\n if v && v != '' && parser.regexp[:ABS_PATH] !~ v\n raise InvalidComponentError,\n \"bad component(expected absolute path component): #{v}\"\n end\n else\n if v && v != '' && parser.regexp[:ABS_PATH] !~ v &&\n parser.regexp[:REL_PATH] !~ v\n raise InvalidComponentError,\n \"bad component(expected relative path component): #{v}\"\n end\n end\n\n return true\n end",
"def valid?\n return false if relative?\n return false unless to_origin && to_domain\n return false unless URI::DEFAULT_PARSER.make_regexp.match(normalize)\n\n true\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil?\n return true\n end\n\n false\n end",
"def valid?\n endpoints.count > 0\n end",
"def ignore_trailing_slash?\n @ignore_trailing_slash\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(SSH_REGEXP).nil?\n return true\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n false\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(HG_REGEXP).nil?\n return true\n end\n\n false\n end",
"def valid?(uri)\n uri ||= default_uri\n\n uri.host = @default_host if uri.host.nil?\n\n real_domain = domain =~ /^\\./ ? domain[1..-1] : domain\n !!((!secure? || (secure? && uri.scheme == 'https')) &&\n uri.host =~ Regexp.new(\"#{'^' if @exact_domain_match}#{Regexp.escape(real_domain)}$\", Regexp::IGNORECASE))\n end",
"def empty_path?\n super || remaining_path == '/'\n end",
"def validate_uri(uri)\n return validate({:uri => uri})\n end",
"def validate_full_url\n if self.full_url.nil?\n return\n end\n\n if((self.full_url =~ URI::regexp(\"http\")) == nil && (self.full_url =~ URI::regexp(\"https\")) == nil)\n self.errors.add(:full_url, \"Full url is not a valid url\")\n end\n end",
"def propertyElementURI_check(el)\n if (CORE_SYNTAX_TERMS + [RDF_NS.Description.to_s] + OLD_TERMS).include?(el.uri.to_s)\n warn = \"Invalid use of rdf:#{el.name}\"\n add_debug(el, warn)\n raise InvalidPredicate.new(warn) if @strict\n end\n end",
"def endpoint=(endpoint)\n if endpoint.end_with?('/')\n @endpoint = endpoint\n else\n @endpoint = \"#{endpoint}/\"\n end\n end",
"def valid_path?(path)\n if path != '/' && path !~ /^\\/.*\\/$/\n puts \"Path '#{path}' must begin and end with a forward slash.\"\n return false\n end\n\n true\n end",
"def validate_anchor( uri, doc )\n return false if uri.fragment.nil?\n\n anchor = '#' + uri.fragment\n if doc.at(anchor).nil?\n @log.error \"invalid URI '#{uri.to_s}'\"\n false\n else true end\n end",
"def validate_params\n data = endpoint_params\n errors = []\n errors << 'Invalid verb' if %w[GET POST PATCH DELETE].exclude?(data[:verb])\n # check for valid url\n begin\n URI.parse data[:path]\n rescue URI::InvalidURIError => e\n errors << 'Invalid Path'\n end\n render json: { errors: errors }, status: :unprocessable_entity if errors.present?\n end",
"def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveofourown.org/users\")\n self.errors.add(:url, \"cannot be ao3 user\")\n return false\n elsif normalized.match(\"(.*)/collections/(.*)/works/(.*)\")\n normalized = $1 + \"/works/\" + $3\n elsif normalized.match(\"archiveofourown.org/collections\")\n self.errors.add(:url, \"cannot be an ao3 collection\")\n return false\n end\n self.url = normalized\n end",
"def fix_oneoff url\n begin\n uri = URI.parse url\n return (\"\" == uri.path) ? url + '/' : url\n rescue\n #puts \"Ran into issue processing #{url}\"\n end\n end",
"def generic_enforce_valid(record, uri, value)\n return false unless uri.is_a?(URI::Generic)\n\n if value.match(%r{^\\w+://.+}).nil?\n record.url = \"http://\" + value\n true\n else\n false\n end\n end",
"def matches?(uri)\n !expired? && valid?(uri) && uri.path.start_with?(path)\n end",
"def valid_url?\n @url =~ URI::regexp\n end",
"def check_uri_build\n\n end",
"def normalize_uri\n if @uri.start_with? '/api/'\n return @uri\n else\n return \"/api/#{@uri}\"\n end\n end",
"def valid_uri?\n !self.contentable.blank? || !self.uri_path.blank?\n end",
"def normalize_uri\n \n # Don't do anything on blanks\n return if self.uri.blank?\n\n # Try to parse, and set to nil if it fails\n uri = Addressable::URI.heuristic_parse(self.uri) rescue nil\n\n # Seems like it's possible to get here with a non-blank URI\n return if uri.blank?\n\n # Normalize it!\n self.uri = uri.normalize.to_s\n\n end",
"def validate_uri(url)\n return validate({:url => url})\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
"def url_must_be_valid\n url.blank? ||\n (url_is_remote? and url_has_suffix? and url_matches?) ||\n errors.add(:url, :invalid)\n end",
"def validate_uri(uri)\n validate_text(Net::HTTP.get(URI.parse(uri)))\n end",
"def post_api_uri(endpoint)\n URI(@api_base_url + endpoint)\n end",
"def validate_uri(uri)\n return validate({:doc => uri})\n end",
"def omit_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def is_valid_url?\n (@url =~ URI::DEFAULT_PARSER.make_regexp) != nil\n end",
"def validate_external_uri( uri, dir, doc )\n return unless @validate_externals\n\n if @invalid_uris.include? uri.to_s\n @log.error \"could not open URI '#{uri.to_s}'\"\n return\n end\n\n begin\n uri.open {|_| nil}\n @valid_uris << uri.to_s\n rescue Exception\n @log.error \"could not open URI '#{uri.to_s}'\"\n @invalid_uris << uri.to_s\n end \n end",
"def valid_url?\n\t\t# http:// or not http://\n\t\tx = self.long_url.start_with?(\"http://\", \"https://\")\n\t\tif x == false\n\t\t\treturn \"http://\" + self.long_url\n\t\telse\n\t\t\treturn self.long_url\n\t\tend\n\tend",
"def valid?\n value.present? && uri.present?\n end",
"def verify_url!\n fail InvalidUrlException unless uri.to_s =~ URI::regexp\n fail UnsupportedFileException if !valid_readers_format? && !valid_file_format?\n end",
"def uriish? str\n (str.include? ':') && (UriSniffRx.match? str)\n end",
"def valid_url?(uri)\n parsed = URI.parse(uri)\n return (parsed.scheme == 'http' || parsed.scheme == 'https')\n rescue URI::InvalidURIError\n false\n end",
"def uri?(string)\n URI.parse(string)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end",
"def test_server_to_refuse_invalid_path\n %w[` > < |].each do |char|\n @payload[:path] = char\n response = api.create_endpoint(**@payload)\n\n assert(response.success?)\n assert_equal(422, response.status_code)\n end\n end",
"def valid_url?\n !Sailpoint.config.url.blank?\n end",
"def validate_back_url(back_url)\n return false if back_url.blank?\n\n if CGI.unescape(back_url).include?('..')\n return false\n end\n\n begin\n uri = URI.parse(back_url)\n rescue URI::InvalidURIError\n return false\n end\n\n ## PATCHED : ignore scheme HTTPS/HTTP and port so redirection works behind reverse proxies\n [:host].each do |component|\n if uri.send(component).present? && uri.send(component) != request.send(component)\n return false\n end\n end\n uri.scheme = nil\n uri.host = nil\n uri.port = nil\n\n # Always ignore basic user:password in the URL\n uri.userinfo = nil\n\n path = uri.to_s\n # Ensure that the remaining URL starts with a slash, followed by a\n # non-slash character or the end\n if path !~ %r{\\A/([^/]|\\z)}\n return false\n end\n\n if path.match(%r{/(login|account/register|account/lost_password)})\n return false\n end\n\n if relative_url_root.present? && !path.starts_with?(relative_url_root)\n return false\n end\n\n return path\n end",
"def normalize_reporting_endpoint\n return unless browser_strategy.normalize_reporting_endpoint?\n return unless !same_origin? || URI.parse(report_uri).host.nil?\n\n if forward_endpoint\n @report_uri = FF_CSP_ENDPOINT\n else\n @report_uri = nil\n end\n end",
"def validate_url_format\n valid_url = false\n begin\n uri = URI.parse(url)\n valid_url = uri.scheme.present? || uri.host.present?\n rescue URI::InvalidURIError\n valid_url = false\n end\n errors.add(:url, 'format is invalid') unless valid_url\n end",
"def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end",
"def valid?\n RDF::URI::IRI.match?(to_s) || false\n end",
"def api_uri\n raise Exceptions::BadlyConfigured.new if @api_uri.empty? || @api_uri.nil? || @api_uri == '/'\n @api_uri\n end",
"def normalize_uri(*strs)\n new_str = strs * \"/\"\n\n new_str = new_str.gsub!(\"//\", \"/\") while new_str.index(\"//\")\n\n # Makes sure there's a starting slash\n unless new_str[0,1] == '/'\n new_str = '/' + new_str\n end\n\n new_str\n end",
"def is_a_uri?(value)\n uri = URI.parse(value)\n uri.is_a?(URI::HTTP) && !uri.host.nil? && uri.host.split(\".\").size > 1\n rescue URI::InvalidURIError\n false\n end",
"def absolutify_url(uri)\n if uri =~ /^\\w*\\:/i\n normalize_url(uri)\n else\n Addressable::URI.join(@url, uri).normalize.to_s\n end\n rescue URI::InvalidURIError, Addressable::URI::InvalidURIError => e\n add_fatal_error \"Link parsing exception: #{e.message}\" and nil\n end",
"def uri_eligible?(uri)\n eligible = uri =~ /#{Regexp.escape(@config[:base_url])}/\n debug \"Islandora uri eligible: #{uri}\" if eligible\n eligible\n end",
"def handle_uri_failure(method:, uri:)\n msg = \"received an invalid uri: '#{uri&.to_s}'!\"\n log_error(method: method, error: ExternalApiError.new(msg))\n end",
"def is_uri?(source)\n !!(source =~ URI_REGEXP)\n end",
"def ensure_uri(uri)\n raise ArgumentError, \"ensure_uri: uri may not be nil\" if uri.nil?\n is_uri?(uri) ? uri : URI.parse(uri)\n end",
"def without_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def to_uri(uri, base_uri = nil)\n case base_uri\n when nil, ''\n Utils.normalize_uri(uri.to_s)\n else\n Utils.normalize_uri(base_uri) + Utils.normalize_uri(uri.to_s)\n end\n rescue URI::Error\n nil\n end",
"def request_uri(uri)\n if has_colon_path_separator?(uri)\n path = hostname_and_path(uri).split(':').all_but_first.join('/')\n else\n path = hostname_and_path(uri).split('/').all_but_first.join('/')\n path.blank? ? nil : '/' + path\n end\n end",
"def valid_url?(url)\n return false if url.nil? || url.strip.empty?\n\n URI(url)\n true\n rescue URI::InvalidURIError\n false\n end",
"def service_endpoint url\n endpoint = LIST.find do |(pattern, endpoint)|\n url =~ pattern\n end\n endpoint[1] = endpoint.last.gsub('{2}', endpoint.first.match(url).to_a[2]) if endpoint.first.match(url) && endpoint.first.match(url).to_a[2]\n endpoint ? endpoint.last : false\n end",
"def normalize_base_uri(str) #:nodoc:\n str =~ /^https?:\\/\\// ? str : \"http#{'s' if str.include?(':443')}://#{str}\"\n end",
"def ensure_url(str)\n if str.respond_to?(:scheme)\n str\n else\n str = str.to_s\n str.gsub! /\\s/, ''\n str.gsub! /(\\#|\\?).*/, ''\n Addressable::URI.parse str\n end\n end",
"def fake_url?\n url =~ /^\\d\\d\\d\\d-/\n end",
"def uri?(string)\n\t\turi = URI.parse(string)\n\t\t%w( http https ).include?(uri.scheme)\n\trescue URI::BadURIError\n\t\tfalse\n\trescue URI::InvalidURIError\n\t\tfalse\n\tend",
"def test_valid\n u = uri(\"amqp://u:p@h:1/x\")\n assert_equal URI::AMQP, u.class\n assert_equal ['amqp', 'u:p', 'h', 1, '/x'], u.select(*PARTS)\n\n u = uri(\"amqps://u:p@h:1/x\")\n assert_equal URI::AMQPS, u.class\n assert_equal ['amqps', 'u:p', 'h', 1, '/x'], u.select(*PARTS)\n\n # Schemeless string -> amqp\n assert_equal [\"amqp\", nil, \"h\", 1, \"/x\"], uri_parts(\"//h:1/x\")\n assert_equal [\"amqp\", nil, \"\", 5672, \"/x\"], uri_parts(\"/x\")\n assert_equal [\"amqp\", nil, \"[::1]\", 5672, \"\"], uri_parts(\"//[::1]\")\n\n # Schemeless URI gets amqp: scheme\n assert_equal [\"amqp\", nil, nil, 5672, \"/x\"], uri_parts(URI(\"/x\"))\n\n # Pass-through\n u = uri('')\n assert_same u, uri(u)\n end",
"def valid_path?(path)\n # Maximum length\n return false if path.length > 255\n # Valid characters allowed\n ch = /[A-Za-z0-9_\\-.$\\/~\"'@:+]*/\n # Require leading slash, maximum one wildcard allowed at start or end\n !!path.match(/^\\/( \\*#{ch} | #{ch}\\* | #{ch} )$/x)\nend",
"def test_normalizes_both_delegate_urls\n p = create('julik', DOMAIN, \n :openid_server => 'xxx.com', :openid_delegate => 'xyz.org/x')\n assert_equal 'xxx.com', p.openid_server, \n \"The URL should be normalized with HTTP scheme and trailing slash\"\n assert_equal 'xyz.org/x', p.openid_delegate, \n \"The URL should be normalized with HTTP scheme\"\n end",
"def unc? path\n path.start_with? DOUBLE_SLASH\n end",
"def to_endpoint\n endpoint = @uri.path\n endpoint = '/' + endpoint unless endpoint.start_with?('/')\n Wgit::Url.new(endpoint)\n end",
"def to_endpoint\n endpoint = @uri.path\n endpoint = '/' + endpoint unless endpoint.start_with?('/')\n Wgit::Url.new(endpoint)\n end",
"def uri?\n !!@uri\n end",
"def uri?\n !!@uri\n end",
"def endpoints?\n endpoints.any?\n end",
"def isEndpointPresent?\n endpoint = Endpoint.find_by_id(params[:id])\n if endpoint.nil?\n render json: { errors:[\n {\n \"code\": \"not_found\",\n \"detail\": \"Requested Endpoint with ID `#{params[:id]}` does not exist\"\n }\n ]\n } , status: :not_found\n end\n end",
"def check_path_re\n check = (self.path_re == '^/$' || self.path_re.blank?) && self.path.present?\n self.path_re = ['^', Regexp.escape(self.path), '$'].join() if check\n end",
"def url_has_a_dot_in?\n (external_resource_url =~ /\\./ )\n end",
"def validate_url_attribute(attribute)\n value = self.read_attribute(attribute)\n return true if value.blank?\n begin\n url = self.normalize_url!(value)\n self.write_attribute(attribute, url)\n return true\n rescue URI::InvalidURIError => e\n self.errors.add(attribute, 'is invalid')\n return false\n end\n end",
"def get_uri_with_format(uri) # :nodoc:\n (@epoint == 'graphql') ? Upwork::Api::GQL_EPOINT : ((@epoint) + uri + ((@epoint == 'api') ? '.' + DATA_FORMAT : ''))\n end"
] | [
"0.6731609",
"0.67035586",
"0.6083759",
"0.5896076",
"0.5839203",
"0.5778053",
"0.5755815",
"0.5754997",
"0.57444066",
"0.5742326",
"0.5742126",
"0.5670484",
"0.5648423",
"0.5637107",
"0.56367683",
"0.55857885",
"0.55705106",
"0.55676526",
"0.55026746",
"0.545672",
"0.5445191",
"0.5440304",
"0.54372025",
"0.5434385",
"0.54340905",
"0.54225326",
"0.5419918",
"0.5417617",
"0.54167134",
"0.53826654",
"0.5375354",
"0.5348273",
"0.53402865",
"0.5322385",
"0.53111637",
"0.5300957",
"0.5296783",
"0.52598596",
"0.5227487",
"0.5210568",
"0.520725",
"0.5207081",
"0.5203095",
"0.51957345",
"0.5188538",
"0.5182861",
"0.5182861",
"0.51785344",
"0.5177223",
"0.51737213",
"0.5165865",
"0.51653695",
"0.5153502",
"0.5151298",
"0.5142264",
"0.5133637",
"0.5130077",
"0.5126065",
"0.510708",
"0.50949377",
"0.5089639",
"0.50733876",
"0.50703496",
"0.5066858",
"0.50625896",
"0.5062154",
"0.50597507",
"0.505406",
"0.505306",
"0.5049764",
"0.5033359",
"0.50280285",
"0.5012835",
"0.5011345",
"0.5005903",
"0.5003789",
"0.50011486",
"0.50011486",
"0.4999027",
"0.4994637",
"0.49747825",
"0.49687967",
"0.49679133",
"0.49477676",
"0.49362427",
"0.49356872",
"0.49272737",
"0.49248487",
"0.49192",
"0.49125445",
"0.4907838",
"0.4907838",
"0.4903197",
"0.4903197",
"0.4899241",
"0.4895692",
"0.48923028",
"0.48921573",
"0.48918143",
"0.48889437"
] | 0.6924188 | 0 |
Creates an Occi::Model from data retrieved from the server. | def set_model
# check credentials and handle OpenStack Keystone
# TODO: check expiration dates on Keystone tokens
raise "You are not authorized to use this endpoint!" unless check_authn
#
model = get('/-/')
@model = Occi::Model.new(model)
@mixins = {
:os_tpl => [],
:resource_tpl => []
}
#
get_os_templates.each do |os_tpl|
unless os_tpl.nil? || os_tpl.type_identifier.nil?
tid = os_tpl.type_identifier.strip
@mixins[:os_tpl] << tid unless tid.empty?
end
end
#
get_resource_templates.each do |res_tpl|
unless res_tpl.nil? || res_tpl.type_identifier.nil?
tid = res_tpl.type_identifier.strip
@mixins[:resource_tpl] << tid unless tid.empty?
end
end
model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_database(data)\n return nil if data.blank?\n \n # Create an instance of the object\n obj = self.new(data['data'])\n obj.raw_data = data\n obj\n end",
"def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end",
"def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Person.from_hash(decoded)\n end",
"def get_model\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/model'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return Employee.from_hash(decoded)\n end",
"def to_model\n @model ||= ActiveFedoraDummyModel.new(hydra_model, id)\n end",
"def buildModel(json)\n classname = name.downcase\n\n model = where(\"id\").eq(json[\"id\"]).first\n if model.present?\n if model.wrap(json)\n model.lastSyncAt = Time.now if model.respond_to?(:lastSyncAt)\n return model\n end\n else\n newModel = self.new\n return newModel if newModel.wrap(json)\n end\n\n return nil\n end",
"def from data\n obj = new\n obj.decode data\n obj\n end",
"def js_model(res)\n # FIXME: deprecate this? this shouldn't be happening in the API, so this is better handled\n # in the respective classes.\n Models::Model.new(@client, res[:json][:data]) if res[:json] && res[:json][:data]\n end",
"def to_model\n __getobj__\n end",
"def from_data(data)\n obj = new\n\n @attributes.each do |key|\n value = obj.send \"parse_#{key}\", data\n obj.send \"#{key}=\", value\n end\n\n obj\n end",
"def to_model(model)\n model.new(attributes)\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend",
"def initialize_model\n # let's create our new empty model\n @model = OpenStudio::Model::Model.new if @model.nil?\n end",
"def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n new_instance = Customer.new(row)\n return new_instance\n end",
"def instantiate\n resource.new(data)\n end",
"def set_model\n @model = ClientService.find(params[:id])\n end",
"def rehydrate_model_from(filename)\n log(\"Reading saved #{method2str} model from #{filename}.\")\n File.open(filename, \"r\") do |file|\n @model = JSON.parse(file.read)\n end \n end",
"def get_model(redis_id)\n model = JSON.parse($redis.get(redis_id))\n model[\"id\"] = redis_id\n model\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def build_model_with(json)\n return nil if json.is_a?(Array)\n\n model = where(\"id\").eq(json[\"id\"]).first || self.new \n model.wrap(json)\n end",
"def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n new_instance = Employee.new(row)\n return new_instance\n end",
"def read(id)\n sql = \"SELECT * FROM #{table_name} WHERE \"\n sql += Database.quote_identifier(@primary_key.name)\n sql += \" = \"\n sql += Database.quote_value(id, @primary_key.type)\n sql += \" LIMIT 1\"\n\n result = Database.execute(sql)\n\n if result.cmd_tuples == 0\n return nil\n else\n new_model = self.new({})\n result[0].each do |key, value|\n new_model.send(key + '=', value, true)\n end\n new_model.attributes.each { |attr| attr.reset }\n new_model\n end\n end",
"def fetch\n @result = Result.new(data, :query => self)\n end",
"def model\n @model ||= Model.new(self)\n end",
"def create input\n table = DB.from(@table) #DB[@table]\n \n result = table.insert input\n\n input[:id] = result\n \n # invalidate a cached range\n @@_cached_range = nil\n \n # return an instance of the model class with the data attributes\n get :id => input[:id]\n end",
"def return_company_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/company'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Company.from_hash(decoded)\n end",
"def new(attrs = {})\n obj = self.model.new\n attrs.each do |k,v|\n obj.send(\"#{k}=\", v)\n end\n obj\n end",
"def read\n r = interface.read(@model_id)\n\n if r.empty?\n add_alert(:error, \"Record ID '#@model_id' not found on the data source\")\n else\n map_to_model(r)\n run_validation(:read)\n @model_status = :okay if @model_status == :unknown\n end\n\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end",
"def build_model\n self.model = nil # set up the model\n end",
"def get options\n table = DB.from(@table)\n result = table.first :id => options[:id]\n # return an instance of the model class with the data attributes\n @model_class.new result\n end",
"def fetch(request) \n\t\ttable_name = @model.table_name\n\t\tdata = request.data\n\t\t# check the advanced cretira\n\t\tunless request.advancedCriteria.nil?\t\t\t\n\t\t\tquery = buildAdvancedCriteria(request, table_name)\n\t\t\t@obj_items = @model.find_by_sql(query) \n\t\telse\n\t\t\tunless request.data.empty?\n\t\t\t\tquery = buildStandardCriteria(request, table_name)\n\t\t\t\t@obj_items = @model.find_by_sql(query) \n\t\t\telse\n\t\t\t\t@obj_items = @model.find(:all) \n\t\t\tend\n\t\tend\t\t \n\t\tobjs_count = @obj_items.count\n\t\t# get the count of the obj_items \n\t\tendRow = (objs_count > 0)?objs_count - 1 : objs_count\n\n\t\t# make the Response result object \n\t\tresponse = DSResponse.new\n\t\tresponse.data = @obj_items\n\t\tresponse.startRow = 0\n\t\tresponse.endRow = endRow\n\t\tresponse.status = 0\n\t\tresponse.totalRow = objs_count \n\n\t\treturn response \n end",
"def build(attributes)\n Model.new(resource_gateway, attributes)\n end",
"def couchrest_model\n ## TODO - deprecate this method\n return if self.term.nil? || instance_database.nil? || self.vocabulary.nil?\n \n write_attribute(:instance_class_name, self.term.singularize.camelize)\n\n if Object.const_defined?(self.instance_class_name.intern)\n klass = Object.const_get(self.instance_class_name.intern)\n else\n db = instance_database\n prop_list = self.vocabulary.properties.inject([]) {|plist, p| plist << p}\n type_list = self.vocabulary.types.inject([]) {|tlist, t| tlist << t} \n \n klass = Object.const_set(self.instance_class_name.intern, \n Class.new(CouchRest::Model::Base) do\n use_database db\n prop_list.each {|p| property p.term.to_sym}\n property :serial_number\n property :data_source_id\n timestamps!\n\n # type_list.each |t| do\n # property t.to_sym do\n # t.properties.each {|tp| property tp.term.to_sym}\n # end\n # end\n # \n design do\n view :by_serial_number\n view :by_data_source_id\n end\n \n end\n )\n end\n klass\n end",
"def request_model\n model = {\n 'content_snapshot': Base64.strict_encode64(snapshot.to_s),\n 'meta': {\n 'signs': signatures\n }\n }\n\n if validation_token\n model[:meta][:validation] = {'token': validation_token.value}\n end\n if relations\n model[:meta][:relations] = relations\n end\n\n return model\n end",
"def get(id)\n result = client.get id: id,\n type: type,\n index: configuration.index\n object_attributes = result[\"_source\"]\n object_attributes.except!(*exclude_from_response)\n model = self.new(object_attributes)\n model.elasticsearch_index = result[\"_index\"]\n model.version = result[\"_version\"]\n model\n end",
"def get_model_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/model'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return decoded.map{|element| Employee.from_hash(element)}\n end",
"def initialize(model)\n\t\t\t@name = model.to_s\n\t\t\t@ar_model = ARModel.new(model)\n\t\t\t\n\n\n @api_model = APIModel.new(model, Hash[@ar_model.schema])\n\t\t\t@field_relationships = generate_field_relationships(@ar_model.schema)\n\t\t\tputs @field_relationships\n\t\tend",
"def generate_model\n\t\tclasses = CartesianClassifier.get_classes(Sample.find_all_by_classname(params[:classnames].split(',')))\n\t\tclassmodel = ClassModel.new({\n\t\t\t:classnames => params[:classnames], # split and join again for validation?\n\t\t\t:modelstring => ActiveSupport::JSON.encode(classes),\n\t\t\t:author => params[:author],\n\t\t\t:notes => params[:notes]\n\t\t})\n\t\tclassmodel.save\n\t\tredirect_to \"/\"\n end",
"def get_model_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Person.from_hash(element) }\n end",
"def set_model\n @model = Response.find(params[:id])\n end",
"def inflate_model(row_data)\n created_at = row_data[:created_at]\n user = Models::User.load(map_from_row!(row_data))\n user.persisted!\n user\n end",
"def create(data = {})\n object = self.new(data)\n object.save\n object\n end",
"def reconstitute\n if record_id.nil?\n record_type.constantize.new(JSON.parse(content))\n else\n return false if !valid?\n record = record_type.constantize.first(:conditions => { :id => record_id })\n record.attributes = JSON.parse(content)\n record\n end\n end",
"def get_object\n class_name.create_from_database(id)\n end",
"def build(attributes = {})\n params = attributes\n return new(params) unless request_new_object_on_build?\n\n path = build_request_path(params.merge(primary_key => 'new'))\n\n request(params.merge(:_method => :get, :_path => path)) do |response|\n new_from_parsed_data(response.body) if response.success?\n end\n end",
"def return_boss_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/boss'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n BossCompany.from_hash(decoded)\n end",
"def obj\n @model\n end",
"def Model(source)\n if cache_anonymous_models\n cache = Sequel.synchronize{@Model_cache ||= {}}\n if klass = Sequel.synchronize{cache[source]}\n return klass\n end\n end\n\n klass = Class.new(self)\n\n if source.is_a?(::Sequel::Database)\n klass.db = source\n else\n klass.set_dataset(source)\n end\n\n if cache_anonymous_models\n Sequel.synchronize{cache[source] = klass}\n end\n\n klass\n end",
"def Model(source)\n if cache_anonymous_models\n cache = Sequel.synchronize{@Model_cache ||= {}}\n if klass = Sequel.synchronize{cache[source]}\n return klass\n end\n end\n\n klass = Class.new(self)\n\n if source.is_a?(::Sequel::Database)\n klass.db = source\n else\n klass.set_dataset(source)\n end\n\n if cache_anonymous_models\n Sequel.synchronize{cache[source] = klass}\n end\n\n klass\n end",
"def model\n @model ||= operation.run\n end",
"def create(data={})\n object = self.new(data)\n object.save\n end",
"def hash_to_model(klass_name, hash)\n model_klass =\n if self.class.const_defined?(klass_name, false)\n self.class.const_get(klass_name)\n else\n self.class.const_set(klass_name, Class.new(BaseModel))\n end\n model_klass.new(api, hash)\n end",
"def hash_to_model(klass_name, hash)\n model_klass =\n if self.class.const_defined?(klass_name, false)\n self.class.const_get(klass_name)\n else\n self.class.const_set(klass_name, Class.new(BaseModel))\n end\n model_klass.new(api, hash)\n end",
"def create(params = {})\n model = new(params)\n model.save\n model\n end",
"def model\n __getobj__\n end",
"def to_model\n m = if self.keys.include?('event_type_ssim')\n EventSolrDoc.new\n else\n ActiveFedora::Base.load_instance_from_solr(id, self)\n end\n m.class == ActiveFedora::Base ? self : m\n end",
"def return_tester_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/tester'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n SoftwareTester.from_hash(decoded)\n end",
"def set_oid_model\n @oid_model = OidModel.find(params[:id])\n end",
"def return_employee_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/employee'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n EmployeeComp.from_hash(decoded)\n end",
"def build_new_record\n @record = record_class.new\n end",
"def build_new_record\n @record = record_class.new\n end",
"def model(ctx, params:, **)\n return unless params[:id]\n ctx[:model] = Song.new(params[:id])\n end",
"def load objid\n DataObj.new @repo, self, objid\n end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def create(attrs = {})\n val = new(attrs)\n R(val, self.database).save\n val\n end",
"def fetch_object(model, url, params = {}, options = {})\n raise ArgumentError, \"missing model to instantiate\" if model.nil?\n response = do_http_get(url, params, {'Content-Type' => 'text/xml'})\n collection = parse_collection(response, model)\n if collection.is_a?(Quickeebooks::Collection)\n collection.entries.first\n else\n nil\n end\n end",
"def build(attributes)\n self.model_instance ||= (base.kind_of?(Class) ? base.new(attributes) : base.build(attributes))\n end",
"def build(data_list)\n @models = []\n\n data_list.each do |data|\n @models << @klass.new(data)\n end\n end",
"def build_model(table)\n model = Mongify::Mongoid::Model.new(class_name: table.name.classify, table_name: table.name)\n model.polymorphic_as = table.polymorphic_as if table.polymorphic?\n #TODO: Might need to check that model doesn't already exist in @models\n @models[table.name.downcase.to_sym] = model\n model\n end",
"def initialize(model_class)\n @model_class = model_class\n @records = []\n end",
"def copy\n new_cfn_model = CfnModel.new\n @conditions.each do |k,v|\n new_cfn_model.conditions[k] = v\n end\n @globals.each do |k,v|\n new_cfn_model.globals[k] = v\n end\n @parameters.each do |k,v|\n new_cfn_model.parameters[k] = v\n end\n @resources.each do |k, v|\n new_cfn_model.resources[k] = v\n end\n @mappings.each do |k, v|\n new_cfn_model.mappings[k] = v\n end\n new_cfn_model.raw_model = @raw_model.dup unless @raw_model.nil?\n new_cfn_model\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def get_model\n return model_classes[item_type].new()\n end",
"def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end",
"def initialize(data)\n self.class.get(data)\n end",
"def data_model\n @data_model ||= items.each_with_object(Hash.new {|h,k| h[k] = [] }) do |item, result|\n result[get_user_mapped_id(item.user_id)] << [get_item_mapped_id(item.item_id), item.interest_score]\n end\n end",
"def model\n obj = versionable.class.new\n YAML::load( self.yaml ).each do |var_name,var_value|\n obj.__send__( \"#{var_name}=\", var_value )\n end\n obj\n end",
"def new\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n end",
"def create(model)\n data = model.attributes\n record = store.create(data, table: table_name)\n model.attributes = record\n end",
"def create_fedora_objects(model, attributes)\n ::Importer::Factory.for(model.to_s).new(attributes, @files_directory, files(attributes)).run\n end",
"def document_to_model(document)\n model = model_class.new(document.hash)\n\n model.key = document.key\n model.rev = document.revision\n\n model\n end",
"def build(attributes = {})\n params = attributes\n return self.new(params) unless self.request_new_object_on_build?\n\n path = self.build_request_path(params.merge(self.primary_key => 'new'))\n method = self.method_for(:new)\n\n resource = nil\n self.request(params.merge(:_method => method, :_path => path)) do |parsed_data, response|\n if response.success?\n resource = self.new_from_parsed_data(parsed_data)\n end\n end\n resource\n end",
"def get(id)\n new(dataset.get(id))\n end",
"def initialize id = new_id\n @id = String id\n @dbm = self.class.dbm\n\n @attributes =\n if data = @dbm[@id] then\n if data.empty? then\n {}\n else\n JSON.parse data\n end\n end\n end",
"def load_object(robject, data)\n robject.raw_data = data[:value]\n robject.content_type = data[:content_type]\n robject.links = data[:links]\n robject.indexes = data[:indexes]\n robject.meta = data[:meta]\n robject.etag = data[:etag]\n robject.last_modified = data[:last_modified]\n robject.vclock = data[:vclock]\n robject\n end",
"def managedObjectModel\n unless @managedObjectModel\n model_url = NSBundle.mainBundle.URLForResource(\"Hubcap\", withExtension:\"momd\")\n @managedObjectModel = NSManagedObjectModel.alloc.initWithContentsOfURL(model_url)\n end\n\n @managedObjectModel\n end",
"def model\n @model ||= resource.model\n end",
"def initialize(object)\n @id = object[\"id\"]\n @data = object[\"data\"]\n end",
"def fetch(site = nil, params = {}, &block)\n raise MotionModelResource::URLNotDefinedError.new \"Resource URL ist not defined! (#{self.class.name}.url)\" if site.blank? && self.class.try(:url).blank?\n raise MotionModelResource::WrapperNotDefinedError.new \"Wrapper is not defined!\" unless self.class.respond_to?(:wrapper)\n\n site = \"#{self.class.url}/#{id}\" if site.blank?\n\n model = self\n BW::HTTP.get(site, params) do |response|\n if response.ok? && response.body.present?\n begin\n json = BW::JSON.parse(response.body.to_str)\n model.wrap(json)\n\n model.save\n rescue BW::JSON::ParserError\n model = nil\n end\n else\n model = nil\n end\n\n block.call model if block.present? && block.respond_to?(:call)\n end\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def json_create(o)\n new(*o[\"data\"])\n end",
"def get(obj)\n collection, query = get_type_info(obj)\n\n record = retrieve(collection, query, limit: 1).first\n return nil unless record\n\n obj.class.new(record)\n end",
"def [](primary_key_value)\n entity = odata_entity_set[primary_key_value]\n return entity if entity.nil?\n model = self.new\n model.instance_variable_set(:@odata_entity, entity)\n model\n end",
"def load_model model_name=nil\n get_schema.load_model(self.get_instance, model_name)\n end",
"def map_to_model(ot)\n merge(ot)\n self\n end",
"def build(*args)\n model = generate(*args)\n model.save\n model\n end",
"def create_from_database(id)\n rec = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{id};\").first\n if rec.nil?\n self.new()\n else\n self.new(rec)\n end\n end"
] | [
"0.6568126",
"0.64901936",
"0.6371203",
"0.61468875",
"0.6092849",
"0.59625506",
"0.5923423",
"0.58872247",
"0.58774096",
"0.58416146",
"0.5789686",
"0.57629895",
"0.5742137",
"0.5742137",
"0.57298857",
"0.5726659",
"0.57034713",
"0.5622811",
"0.5595958",
"0.5557227",
"0.55542165",
"0.5552722",
"0.55451727",
"0.5528568",
"0.55187064",
"0.54998064",
"0.5497734",
"0.5475044",
"0.5469659",
"0.5454393",
"0.5446208",
"0.542374",
"0.5408127",
"0.53943056",
"0.5365643",
"0.536263",
"0.5349344",
"0.53439116",
"0.5342432",
"0.53376913",
"0.53204685",
"0.53168184",
"0.53146833",
"0.530974",
"0.53092766",
"0.5298946",
"0.5292402",
"0.5288495",
"0.5280363",
"0.5273468",
"0.5273468",
"0.5270835",
"0.5270783",
"0.5265302",
"0.5265302",
"0.5264",
"0.5224628",
"0.52153546",
"0.5200907",
"0.5190122",
"0.51810724",
"0.5179076",
"0.5179076",
"0.51765615",
"0.51665455",
"0.5165597",
"0.5165597",
"0.51610726",
"0.51568824",
"0.51534295",
"0.5153289",
"0.5146162",
"0.51387024",
"0.5129723",
"0.51284903",
"0.51247954",
"0.5097632",
"0.5094755",
"0.5093019",
"0.5089014",
"0.5087615",
"0.5084195",
"0.50764525",
"0.507317",
"0.50672626",
"0.50667244",
"0.50605106",
"0.5058435",
"0.5054138",
"0.50527483",
"0.5040801",
"0.50321925",
"0.50267506",
"0.502343",
"0.50224984",
"0.50204635",
"0.50200874",
"0.5018711",
"0.5018478",
"0.50133693"
] | 0.5835865 | 10 |
Checks provided credentials and attempts transparent authentication with OS Keystone using the "wwwauthenticate" header. | def check_authn
response = self.class.head @endpoint
return true if response.success?
if response.code == 401 && response.headers["www-authenticate"]
if response.headers["www-authenticate"].start_with? "Keystone"
keystone_uri = /^Keystone uri='(.+)'$/.match(response.headers["www-authenticate"])[1]
if keystone_uri
if @auth_options[:type] == "x509"
body = { "auth" => { "voms" => true } }
else
body = {
"auth" => {
"passwordCredentials" => {
"username" => @auth_options[:username],
"password" => @auth_options[:password]
}
}
}
end
headers = self.class.headers.clone
headers['Content-Type'] = "application/json"
headers['Accept'] = headers['Content-Type']
response = self.class.post(keystone_uri + "/v2.0/tokens", :body => body.to_json, :headers => headers)
if response.success?
self.class.headers['X-Auth-Token'] = response['access']['token']['id']
return true
end
end
end
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend",
"def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end",
"def authenticate\n uri = create_uri(\"#{@server_url}api/authenticate\")\n h = Net::HTTP.new uri.host, uri.port\n req = Net::HTTP::Get.new uri.request_uri\n res = h.request req\n @digest_auth = Net::HTTP::DigestAuth.new\n @header = res['www-authenticate']\n unless @header\n raise 'No [www-authenticate] header in the server\\'s response'\n end\n end",
"def http_authenticate\n if Rails.env.staging?\n authenticate_or_request_with_http_basic do |username, password|\n (username == Brevidy::Application::HTTP_AUTH_USERNAME && password == Brevidy::Application::HTTP_AUTH_PASSWORD) ||\n (username == Brevidy::Application::HTTP_AUTH_ZEN_USERNAME && password == Brevidy::Application::HTTP_AUTH_ZEN_PASSWORD)\n end\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end",
"def require_authentication( challenge )\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: challenge )\n\tend",
"def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end",
"def authenticate_if_needed\n # Disable this extra authentication in test mode\n return true if Rails.env.test?\n if (is_hidden || is_staging) && !is_api_or_pdf\n authenticate_or_request_with_http_basic do |username, password|\n username == \"samvera\" && password == \"hyku\"\n end\n end\n end",
"def authenticate\n if defined?(APPWALL_USERNAME)\n authenticate_or_request_with_http_basic do |username, password|\n !(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME && \n Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH\n end\n end\n end",
"def authenticate\n if defined?(APPWALL_USERNAME)\n authenticate_or_request_with_http_basic do |username, password|\n !(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME && \n Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH\n end\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end",
"def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end",
"def verify_credentials!\n raise AuthenticationError.new(\"missing client code\") if Applitrack.client_code.nil? || Applitrack.client_code.empty?\n raise AuthenticationError.new(\"missing username\") if Applitrack.username.nil? || Applitrack.username.empty?\n raise AuthenticationError.new(\"missing password\") if Applitrack.password.nil? || Applitrack.password.empty?\n end",
"def require_login\n qop = ''\n case @qop\n when QOP_AUTH\n qop = 'auth'\n when QOP_AUTHINT\n qop = 'auth-int'\n when QOP_AUTH | QOP_AUTHINT\n qop = 'auth,auth-int'\n end\n\n @response.add_header('WWW-Authenticate', \"Digest realm=\\\"#{@realm}\\\",qop=\\\"#{qop}\\\",nonce=\\\"#{@nonce}\\\",opaque=\\\"#{@opaque}\\\"\")\n @response.status = 401\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end",
"def w000thenticate!\n check_token\n authenticate_user!\n end",
"def authenticate_client_access!\n return if api_key_from_params.nil?\n\n return require_api_client if access_from_localhost?\n return require_api_client if access_from_preview_hosting? && restricted_api_access_mode?\n return require_api_client if access_from_production_hosting?\n return require_api_client if access_from_public_hosting?\n\n true # Do not halt otherwise\n end",
"def authenticate_user_with_basic_auth!\n @username, @password = ActionController::HttpAuthentication::Basic::user_name_and_password(request)\n\n request_http_basic_authentication(ENV[\"REALM\"], \"An Authentication object was not found in the SecurityContext\") if @username.blank? || @password.blank?\n end",
"def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end",
"def require_http_basic_auth\n if APP_CONFIG['perform_authentication']\n authenticate_or_request_with_http_basic do |login, password|\n login==APP_CONFIG['username'] and password == APP_CONFIG['password']\n end\n end\n end",
"def w000thenticate\n check_token\n end",
"def require_basic_auth_maybe\n if Rails.env.staging?\n authenticate_or_request_with_http_basic do |user, password|\n user == \"mamajamas\" && (password == \"mamab1rd\" || password == \"welcome\")\n end\n end\n end",
"def require_authenticated_user\n return if authenticate_or_request_with_http_basic do |ident_string, secret_string|\n ident_string == 'karl' && secret_string.to_s.crypt(ident_string)\n end\n render :text => \"You must be logged in to view this site\", :layout => false, :status => status\n end",
"def authenticate!\n # Do nothing yet\n end",
"def authenticate_shopify_request\n unless hmac_valid?()\n unauthorized() and return\n end\n end",
"def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.basic[:username] && \n password == Rails.application.credentials.basic[:password]\n end\n end",
"def capable_plain_auth?; end",
"def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end",
"def none_authenticate\n authenticate_or_request_with_http_basic \"Raptor\" do |user_name, password|\n logger.debug(\"none_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end",
"def process_auth\n return if username.empty? || password.empty?\n \"#{username}:#{password}\"\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"Fun!\") do |username, password|\n username == ENV[\"FUN_ADMIN_USER\"] && password == ENV[\"FUN_ADMIN_PASS\"]\n end\n end",
"def authenticate_user\n if Rails.env.production?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == Wordpressed.password\n end\n end\n #warden.custom_failure! if performed?\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def require_login\n @response.add_header('WWW-Authenticate', \"Basic realm=\\\"#{@realm}\\\"\")\n @response.status = 401\n end",
"def wsse_authenticate(req, url, params = {})\n user, pass = username_and_password_for_realm(url, params[\"realm\"])\n\n nonce = rand(16**32).to_s(16)\n nonce_enc = [nonce].pack('m').chomp\n now = Time.now.gmtime.iso8601\n\n digest = [Digest::SHA1.digest(nonce + now + pass)].pack(\"m\").chomp\n\n req['X-WSSE'] = %Q<UsernameToken Username=\"#{user}\", PasswordDigest=\"#{digest}\", Nonce=\"#{nonce_enc}\", Created=\"#{now}\">\n req[\"Authorization\"] = 'WSSE profile=\"UsernameToken\"'\n end",
"def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end",
"def authenticate!\n token = Configuration.authentication_token\n secret = Configuration.authentication_secret\n creds = {token => params[token], secret => params[secret]}\n\n response = HTTPClient.get(Configuration.authentication_endpoint, creds)\n\n unless response.ok?\n halt(403, \"Authentication failed: #{response.body}\")\n end\n end",
"def apache_authenticate\n logger.info(\"apache_authenticate as #{request.env[\"REMOTE_USER\"]}\")\n common_authenticate(request.env[\"REMOTE_USER\"])\n return true\n end",
"def authenticate\n env = Figaro.env\n\n head :unauthorized unless auth_configured?(env)\n\n authenticate_or_request_with_http_basic do |username, password|\n # This comparison uses & so that it doesn't short circuit and\n # uses `secure_compare` so that length information\n # isn't leaked.\n ActiveSupport::SecurityUtils.secure_compare(\n username, env.twilio_http_basic_auth_username\n ) & ActiveSupport::SecurityUtils.secure_compare(\n password, env.twilio_http_basic_auth_password\n )\n end\n end",
"def check_authorization\n return head :unauthorized if request.env['HTTP_CAPKEY'].nil?\n\n head :forbidden unless request.env['HTTP_CAPKEY'] == Settings.API_KEY\n end",
"def authenticate_with(identity, next_service, username, key_manager)\n debug { \"trying hostbased (#{identity.fingerprint})\" }\n client_username = ENV['USER'] || username\n\n req = build_request(identity, next_service, username, \"#{hostname}.\", client_username)\n sig_data = Buffer.from(:string, session_id, :raw, req)\n\n sig = key_manager.sign(identity, sig_data.to_s)\n\n message = Buffer.from(:raw, req, :string, sig)\n\n send_message(message)\n message = session.next_message\n\n case message.type\n when USERAUTH_SUCCESS\n info { \"hostbased succeeded (#{identity.fingerprint})\" }\n return true\n when USERAUTH_FAILURE\n info { \"hostbased failed (#{identity.fingerprint})\" }\n\n raise Net::SSH::Authentication::DisallowedMethod unless\n message[:authentications].split(/,/).include? 'hostbased'\n\n return false\n else\n raise Net::SSH::Exception, \"unexpected server response to USERAUTH_REQUEST: #{message.type} (#{message.inspect})\"\n end\n end",
"def authenticate_with(identity, next_service, username, key_manager); end",
"def auth(options = {})\n # Create new Mechanize instance to drop any old credentials.\n \n if options[:cert]\n key = options[:cert][:key]\n if key.respond_to?(:to_str) && !File.exist?(key)\n key = OpenSSL::PKey::RSA.new key\n end\n cert = options[:cert][:cert]\n if cert.respond_to?(:to_str) && !File.exist?(cert)\n cert = OpenSSL::X509::Certificate.new cert\n end\n \n @mech = mech do |m|\n m.key = key\n m.cert = cert\n end\n else\n @mech = mech\n end\n \n # Go to a page that is guaranteed to redirect to shitoleth.\n step1_page = get '/atstellar'\n # Fill in the form.\n step1_form = step1_page.form_with :action => /WAYF/\n step1_form.checkbox_with(:name => /perm/).checked = :checked\n step2_page = step1_form.submit step1_form.buttons.first\n # Click through the stupid confirmation form.\n step2_form = step2_page.form_with :action => /WAYF/\n cred_page = step2_form.submit step2_form.button_with(:name => /select/i)\n \n # Fill in the credentials form.\n if options[:cert]\n cred_form = cred_page.form_with :action => /certificate/i\n cred_form.checkbox_with(:name => /pref/).checked = :checked\n elsif options[:kerberos]\n cred_form = cred_page.form_with :action => /username/i\n cred_form.field_with(:name => /user/).value = options[:kerberos][:user]\n cred_form.field_with(:name => /pass/).value = options[:kerberos][:pass]\n else\n raise ArgumentError, 'Unsupported credentials'\n end\n \n # Click through the SAML response form.\n saml_page = cred_form.submit cred_form.buttons.first\n unless saml_form = saml_page.form_with(:action => /SAML/)\n raise ArgumentError, 'Authentication failed due to invalid credentials'\n end\n saml_form.submit\n \n self\n end",
"def parse(www_authenticate); end",
"def authenticate_with_basic_auth\n name, token = ActionController::HttpAuthentication::Basic.user_name_and_password(request)\n @api_client = ApiClient.find_by(name: name)\n\n render(json: { errors: [{ detail: \"Access Denied\" }] }, status: 401) unless valid_key(token)\n end",
"def authenticate_on_production\n return if Rails.env.development? || Rails.env.test?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"crowdscore\" && password == \"denver\"\n end\n end",
"def authenticate(next_service, username, password = T.unsafe(nil)); end",
"def send_auth(res, opts, t, persist)\n if opts['username'].nil? or opts['username'] == ''\n if self.username and not (self.username == '')\n opts['username'] = self.username\n opts['password'] = self.password\n else\n opts['username'] = nil\n opts['password'] = nil\n end\n end\n\n return res if opts['username'].nil? or opts['username'] == ''\n supported_auths = res.headers['WWW-Authenticate']\n\n # if several providers are available, the client may want one in particular\n preferred_auth = opts['preferred_auth']\n\n if supported_auths.include?('Basic') && (preferred_auth.nil? || preferred_auth == 'Basic')\n opts['headers'] ||= {}\n opts['headers']['Authorization'] = basic_auth_header(opts['username'],opts['password'] )\n req = request_cgi(opts)\n res = _send_recv(req,t,persist)\n return res\n elsif supported_auths.include?('Digest') && (preferred_auth.nil? || preferred_auth == 'Digest')\n temp_response = digest_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('NTLM') && (preferred_auth.nil? || preferred_auth == 'NTLM')\n opts['provider'] = 'NTLM'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n elsif supported_auths.include?('Negotiate') && (preferred_auth.nil? || preferred_auth == 'Negotiate')\n opts['provider'] = 'Negotiate'\n temp_response = negotiate_auth(opts)\n if temp_response.kind_of? Rex::Proto::Http::Response\n res = temp_response\n end\n return res\n end\n return res\n end",
"def authenticate(response)\n headers = response.headers\n begin\n if headers.has_key?('www-authenticate')\n auth_description = headers['www-authenticate']\n if auth_description.match('Bearer realm=')\n auth_service = TokenAuthService.new(self)\n auth_service.tokenAuth(response)\n else\n throw \"Auth method not supported #{auth_description}\"\n end\n end\n rescue Exception => e\n puts \"Authentication failed #{e.message}\".colorize(:red)\n end\n end",
"def call(env)\r\n\r\n ## check for existance of Cookie\r\n if /(MSIE|Internet Explorer)/ =~ env['HTTP_USER_AGENT']\r\n ## USER_AGENT is a IE-based browser\r\n require 'net/ntlm'\r\n require 'kconv'\r\n\r\n ## See if it is possible to use NTLM to autenticate\r\n if env['HTTP_AUTHORIZATION'].blank?\r\n return [401, {'WWW-Authenticate' => \"NTLM\"}, []]\r\n end\r\n if /^(NTLM|Negotiate) (.+)/ =~ env[\"HTTP_AUTHORIZATION\"]\r\n\r\n message = Net::NTLM::Message.decode64($2)\r\n\r\n if message.type == 1\r\n type2 = Net::NTLM::Message::Type2.new\r\n return [401, {\"WWW-Authenticate\" => \"NTLM \" + type2.encode64}, []]\r\n end\r\n\r\n if message.type == 3\r\n user = Net::NTLM::decode_utf16le(message.user)\r\n require \"base64\"\r\n env['AUTH_USER'] = user\r\n env['AUTH_USER_AUTH'] = Base64.encode64(user)\r\n env['AUTH_DATETIME'] = Time.now.utc\r\n else\r\n return [401, {}, [\"You are not authorized to see this page\"]]\r\n end\r\n end\r\n @app.call(env)\r\n else\r\n ##############################################################\r\n # USER_AGENT is a NON-IE-based browser (Firefox, Safari, etc.)\r\n #\r\n # Process these agents using session based cookies which\r\n # are authenticated via kerberos. Once the agent quits their\r\n # browser session or clears their cookies during an open\r\n # browser session, the agent must re-authenticate via their\r\n # kerberos username and password. Authenticated user agents\r\n # have the correct AUTH_USER (network login name) inserted\r\n # as an environmental variable prior to their being sent on\r\n # any followon Rails application. The login is completely\r\n # customizable and does not use the browser's login capability.\r\n #\r\n ##############################################################\r\n\r\n auth_user = get_cookie(env,'AUTH_USER')\r\n auth_user_auth = get_cookie(env,'AUTH_USER_AUTH')\r\n require \"base64\"\r\n auth_user_auth_v = (auth_user_auth.nil?) ? nil : Base64.decode64(auth_user_auth)\r\n\r\n if auth_user.nil? || auth_user_auth.nil? || auth_user != auth_user_auth_v\r\n ## Not yet Authenticated\r\n lgin = \"<form action=\\\"#{env['rack.url_scheme']}://\"\r\n lgin += \"#{env['SERVER_NAME']}#{env['REQUEST_URI']}\\\" method=\\\"post\\\">\\n\"\r\n lgin += \"Username:<br><input type=\\\"text\\\" name=\\\"kun\\\" id=\\\"kun\\\" />\\n<p>\"\r\n lgin += \"Password:<br><input type=\\\"password\\\" name=\\\"kpw\\\" id=\\\"kpw\\\" />\\n<p>\"\r\n lgin += \"<input type=\\\"submit\\\" value=\\\"Login\\\"/>\\n</form>\\n</body>\\n</html>\\n\"\r\n\r\n if env['REQUEST_METHOD'] == 'POST'\r\n ## Authenticate un/pw sent via POST\r\n require 'rkerberos'\r\n kerberos = Kerberos::Krb5.new\r\n realm ||= kerberos.get_default_realm\r\n user = env['rack.request.form_hash']['kun']\r\n user_with_realm = user.dup\r\n user_with_realm += \"@#{realm}\" unless user.include?('@')\r\n password = env['rack.request.form_hash']['kpw']\r\n\r\n begin\r\n kerberos.get_init_creds_password(user_with_realm, password)\r\n rescue Kerberos::Krb5::Exception => err\r\n ## Authentication was UNSUCCESSFUL - username/password typo\r\n env.delete('AUTH_USER')\r\n env['AUTH_MSG'] = \"Error attempting to validate userid and password\"\r\n env['AUTH_FAIL'] = err.message\r\n\r\n rescue => err\r\n env.delete('AUTH_USER')\r\n env['AUTH_FAIL'] = \"Unexpected failure during Kerberos authentication\"\r\n\r\n else\r\n ## Authentication was Successful - Update AUTH_USER\r\n env.delete('AUTH_FAIL')\r\n env['AUTH_USER'] = user\r\n env['AUTH_USER_AUTH'] = Base64.encode64(user)\r\n env['AUTH_DATETIME'] = Time.now.utc\r\n\r\n ensure\r\n ## Clean up any outstanding calls from above operations\r\n kerberos.close\r\n\r\n end\r\n\r\n if env.has_key?('AUTH_USER')\r\n ## Authentication was successful, set cookies and pass on to Rails\r\n ## SET COOKIES\r\n status,headers,response = @app.call(clean_params(env))\r\n Rack::Utils.set_cookie_header!(headers, \"AUTH_USER\",\r\n {:value => env['AUTH_USER'], :path => \"/\"})\r\n Rack::Utils.set_cookie_header!(headers, \"AUTH_USER_AUTH\",\r\n {:value => env['AUTH_USER_AUTH'], :path => \"/\"})\r\n [status,headers,response]\r\n else\r\n ## Authentication was UNsuccessful, flash login and indicate error\r\n status,headers,ignore = @app.call(env)\r\n response = \"<!DOCTYPE html>\\n<!-- #{env['AUTH_FAIL']} -->\\n<!-- #{env.inspect} -->\\n\"\r\n response << \"<html>\\n<body>\\n<font color=#ff0000>#{env['AUTH_MSG']}</font><p>\\n\"\r\n response << lgin\r\n response = [response]\r\n headers[\"Content-Length\"] = response.size.to_s\r\n [status,headers,response]\r\n end\r\n else\r\n ## Show RACK login\r\n status,headers,ignore = @app.call(env)\r\n response = \"<!DOCTYPE html>\\n<!-- #{env['AUTH_FAIL']} -->\\n<!-- #{env.inspect} -->\\n\"\r\n response << lgin\r\n response = [response]\r\n headers[\"Content-Length\"] = response.size.to_s\r\n [status,headers,response]\r\n end\r\n else\r\n ## Assume user is authenticated and pass correct AUTH_USER to Rails application\r\n env['AUTH_USER'] = auth_user\r\n env['AUTH_USER_AUTH'] = auth_user_auth\r\n env['AUTH_DATETIME'] = Time.now.utc\r\n @app.call(env)\r\n end\r\n end\r\n end",
"def authenticate\n RestClient.post @apiurl + \"authenticate\", \n :username => @username, \n :password => @password\n rescue RestClient::RequestFailed\n handle_error($!)\n return false\n end",
"def basic_authenticate(req, url, param_string = \"\")\n params = parse_quoted_wwwauth(param_string)\n\n user, pass = username_and_password_for_realm(url, params[:realm])\n\n req.basic_auth user, pass\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def basic_auth(*args, &block); end",
"def authenticate(username, password)\n perform_request({:action => 'client-authenticate', :username => username, :password => password})\n end",
"def process_no_auth(request, response)\n response.start(401, true) do |head,out|\n head['WWW-Authenticate'] = 'NTLM'\n end\n end",
"def basic_auth(user, password, domain = T.unsafe(nil)); end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == \"123\"\n end\n end",
"def authenticate\n begin \n # TODO No data required to authenticate, send a nil string? hacky\n # TODO should retry if a http connection failed\n return @authenticated if @authenticated\n authenticated = call_remote(:authenticate, \"\")\n @authenticated = authenticated =~ /true/\n rescue \n @authenticated = false\n ensure\n return @authenticated\n end\n end",
"def authenticate(request)\n return unless request['Authorization'].nil?\n\n confkey = credential_config_key\n\n token = config(\"#{confkey}.token\")\n user = config(\"#{confkey}.user\")\n pass = config(\"#{confkey}.password\")\n\n if token\n request['Authorization'] = \"token #{token}\"\n elsif user\n begin\n if $stdin.tty?\n pass = ask(\"Enter your password for #{api_url}: \") { |q| q.echo = '*' } if !pass\n else\n $stderr.puts \"STDIN not a TTY - cannot query for missing password.\"\n $stderr.puts \"Please add #{confkey}.password or #{confkey}.token to your gitconfig\"\n exit 1\n end\n rescue Interrupt\n warn \"attempting connection without authorization..\"\n return\n end\n request.basic_auth(user, pass)\n else\n $stderr.puts \"No currently configured username/password or token set for this API Provider.\"\n exit 1 unless $stdin.tty? && setup_credentials\n authenticate(request)\n end\n end",
"def authenticate_manual \n api_key = request.headers['X-Api-Key']\n @app = App.where(api_key: api_key).first if api_key\n\n unless @app\n head status: :unauthorized\n return false\n end\n end",
"def check_authentication( req )\n\t\tusername = req.params[:username]\n\t\tpassword = req.params[:password]\n\n\t\tunless hmac = self.class.users[ username ]\n\t\t\tself.log.error \"Auth failure: no such user %p\" % [ username ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\tpw_hmac = OpenSSL::HMAC.hexdigest( 'sha1', self.class.key, password )\n\t\tself.log.debug \" hash of 'demo' is: %p\" % [ OpenSSL::HMAC.hexdigest('sha1', self.class.key, 'demo') ]\n\n\t\tunless hmac == pw_hmac\n\t\t\tself.log.error \"Auth failure: password digests don't match: expected %p, got %p\" %\n\t\t\t\t[ hmac, pw_hmac ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\t# Tell the auth provider that the user provided valid credentials\n\t\tself.auth_provider.auth_succeeded( req, username )\n\n\t\treturn username\n\tend",
"def authenticate\n # logger.debug(\"APP: authorization: #{temp_debug(request)}\")\n set_last_uri\n return true unless application_user.nil?\n # logger.info(\"Header NOT-SET = #{request.headers['NOT-SET'].inspect}\")\n if request.env.has_key? \"REMOTE_USER\"\n logger.info(\"REMOTE_USER = #{request.env[\"REMOTE_USER\"]}\")\n apache_authenticate\n elsif request.headers.has_key?('HTTP_X_FORWARDED_USER')\n logger.info(\"Header HTTP_X_FORWARDED_USER = #{request.headers['HTTP_X_FORWARDED_USER']}\")\n proxy_apache_authenticate\n elsif Rails.env == \"test\"\n logger.info(\"Authenticate via test\")\n testing_authenticate\n elsif NONE_AUTHENTICATE\n logger.info(\"Authenticate via none\")\n none_authenticate\n else\n ldap_authenticate\n end\n end",
"def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_add :unauthorized, 'unauthorized' and return\n end\n else\n render_error_add :unauthorized, 'unauthorized' and return\n end\n end",
"def login_using_basic_auth\n @request.env['HTTP_AUTHENTICATION'] = ActionController::HttpAuthentication::Basic.encode_credntials(\"\", \"\")\nend",
"def allow_client_to_handle_unauthorized_status\n headers.delete('WWW-Authenticate')\n end",
"def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datastore['HttpUsername'],\r\n 'os_password' => datastore['HttpPassword'],\r\n 'os_destination' => '',\r\n 'user_role' => '',\r\n 'atl_token' => '',\r\n 'login' => 'Log+In'\r\n }\r\n })\r\n end",
"def authenticate_with_http_basic\n nil\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def authenticate\n # :x_amee_source = \"X-AMEE-Source\".to_sym\n request = Typhoeus::Request.new(\"#{protocol}#{@server}/auth/signIn\", \n :method => \"post\",\n :verbose => DEBUG,\n :headers => {\n :Accept => content_type(:xml),\n },\n :body => form_encode(:username=>@username, :password=>@password)\n )\n\n hydra.queue(request)\n hydra.run\n response = request.response\n\n @auth_token = response.headers_hash['AuthToken']\n d {request.url}\n d {response.code}\n d {@auth_token}\n\n connection_failed if response.code == 0\n\n unless authenticated?\n raise AMEE::AuthFailed.new(\"Authentication failed. Please check your username and password. (tried #{@username},#{@password})\")\n end\n # Detect API version\n if response.body.is_json?\n @version = JSON.parse(response.body)[\"user\"][\"apiVersion\"].to_f\n elsif response.body.is_xml?\n @version = REXML::Document.new(response.body).elements['Resources'].elements['SignInResource'].elements['User'].elements['ApiVersion'].text.to_f\n else\n @version = 1.0\n end\n end",
"def basic_auth(opts); end",
"def login_required\n return if authorized?\n unauthorized! unless auth.provided?\n bad_request! unless auth.basic?\n unauthorized! unless authorize(*auth.credentials)\n @req.env['REMOTE_USER'] = auth.username\n end",
"def authenticate( req )\n\t\treq.server.log_error \"StageLogger {%d}>> in RubyAuthenHandler authenticate(%p)\" % \n\t\t\t[ Process.pid, req ]\n\n\t\treq.auth_type = 'Basic'\n\t\treq.auth_name = 'StageLogger'\n\t\treq.user = 'stagelogger'\n\n\t\treturn Apache::OK\n\tend",
"def protect_sidekiq_with_password\n return unless prod?\n\n sidekiq_username = cred(:sidekiq, :username)\n sidekiq_password = cred(:sidekiq, :password)\n\n Sidekiq::Web.use Rack::Auth::Basic do |username, password|\n ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(sidekiq_username)) &\n ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(sidekiq_password))\n end\nend",
"def valid_for_http_auth?; end",
"def protected!\n return if from_bitbooks?\n headers['WWW-Authenticate'] = 'Basic realm=\"Restricted Area\"'\n halt 401, \"Not authorized\\n\"\nend",
"def login\r\n cf_cookies = {}\r\n\r\n ways = {\r\n 'RDS bypass' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], true) },\r\n 'RDS login' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], false) },\r\n 'Administrator login' => Proc.new { |foo| administrator_login(datastore['USERNAME'], datastore['PASSWORD']) },\r\n }\r\n ways.each do |what, how|\r\n these_cookies = how.call\r\n if got_auth? these_cookies\r\n print_status \"Authenticated using '#{what}' technique\"\r\n cf_cookies = these_cookies\r\n break\r\n end\r\n end\r\n\r\n fail_with(Exploit::Failure::NoAccess, \"Unable to authenticate\") if cf_cookies.empty?\r\n cf_cookies\r\n end",
"def authenticate\n config = YAML.load_file(\"#{Rails.root}/config/vcloudair.yml\")[Rails.env]\n\n if config[\"api-shared-secret\"] != request.headers[\"X-Api-Shared-Secret\"]\n render text: \"api-shared-secret/X-Api-Shared-Secret mismatch error\", status: 403\n end\n end",
"def exploit\n begin\n # attempt a login. In this case we show basic auth, and a POST to a fake username/password\n # simply to show how both are done\n vprint_status('Attempting login')\n # since we will check res to see if auth was a success, make sure to capture the return\n res = send_request_cgi(\n 'uri' => '/login.html',\n 'method' => 'POST',\n 'authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD']),\n 'vars_post' => {\n 'username' => datastore['USERNAME'],\n 'password' => datastore['PASSWORD']\n }\n )\n\n # a valid login will give us a 301 redirect to /home.html so check that.\n # ALWAYS assume res could be nil and check it first!!!!!\n if res && res.code != 301\n fail_with(Failure::UnexpectedReply, \"#{peer} - Invalid credentials (response code: #{res.code})\")\n end\n\n # grab our valid cookie\n cookie = res.get_cookies\n # we don't care what the response is, so don't bother saving it from send_request_cgi\n vprint_status('Attempting exploit')\n send_request_cgi(\n 'uri' => normalize_uri(target_uri.path, 'command.html'),\n 'method' => 'POST',\n 'cookie' => cookie,\n 'vars_post' =>\n {\n 'cmd_str' => payload.encoded\n }\n )\n\n rescue ::Rex::ConnectionError\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n end\n\n end",
"def authenticate_with(identity, next_service, username); end",
"def authenticate(username, password)\n end",
"def authorize(username, password)\np username\np password\n username == settings.username && password == settings.password\n end",
"def auth_bypass\r\n username = datastore['HttpUsername'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n password = datastore['HttpPassword'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n @auth = basic_auth(username, password)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_users/org.couchdb.user:#{username}\"),\r\n 'method' => 'PUT',\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"type\": \"user\",\"name\": \"#{username}\",\"roles\": [\"_admin\"],\"roles\": [],\"password\": \"#{password}\"})\r\n )\r\n\r\n if res && (res.code == 200 || res.code == 201) && res.get_json_document['ok']\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def authenticate_knox_api_key!\n authenticate_for ApiKey\n end",
"def correct_credentials?\n correct_username = 'admin'\n correct_password = 'admin'\n input_username = @request.params['username']\n input_password = @request.params['password']\n correct_username == input_username && correct_password == input_password\n end",
"def send_credentials\n dputs __method__.to_s\n login_req = setup_http_request($ident, @cookie, {:arg => [$CONF['user'], CGI.escape($CONF['pass'])]})\n res = @http.request(login_req)\n get_cookie(res)\n end",
"def basic_auth_required(realm = 'Web Password', error_message = \"Could not authenticate you\")\n return true if self.current_user\n username, passwd = get_auth_data\n\n # Check if authorized\n # Try to get user\n #unless session[:user] = User.authenticate(username, passwd)\n \n self.current_user = User.authenticate(username, passwd)\n unless current_user && current_user.account_active?\n # The user does not exist or the password was wrong\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = \"Basic realm=\\\"#{realm}\\\"\"\n render :text => error_message, :status => '401 Unauthorized'\n end\n end",
"def basic_auth(username:, password:, realm: 'Instrumentation')\n authenticate_or_request_with_http_basic(realm) \\\n do |given_name, given_password|\n ActiveSupport::SecurityUtils.secure_compare(given_name, username) &\n ActiveSupport::SecurityUtils.secure_compare(\n given_password, password\n )\n end\n end",
"def login_with_proper_credentials\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, VALID_PASSWORD)\r\n\r\n click_on_button(SUBMIT_BUTTON_ID)\r\n\r\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |name, password|\n name == \"blogmaster\" && password == \"senha\"\n end\n end",
"def credentials(authorization, request); end",
"def host_authorization; end",
"def host_authorization; end",
"def proxy_apache_authenticate\n logger.info(\"proxy_apache_authenticate as #{request.env[\"HTTP_X_FORWARDED_USER\"]}\")\n common_authenticate(request.headers[\"HTTP_X_FORWARDED_USER\"])\n return true\n end",
"def authenticate_user!\n redirect_to '/auth/sweetsuite' unless access_token && current_user\n end",
"def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end",
"def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n request.halt(401)\n end\n end",
"def check_credentials(username, password)\n return false\n end",
"def http_auth?; end"
] | [
"0.6616653",
"0.6610217",
"0.6591077",
"0.6467743",
"0.64342606",
"0.6394454",
"0.63747376",
"0.6332156",
"0.63221663",
"0.63221663",
"0.6290899",
"0.6213805",
"0.62025535",
"0.6185606",
"0.61678123",
"0.6153708",
"0.6149189",
"0.61356413",
"0.60988295",
"0.6094547",
"0.6085031",
"0.6082779",
"0.6074193",
"0.6062176",
"0.605867",
"0.60555506",
"0.60507417",
"0.6046117",
"0.60360336",
"0.6032669",
"0.6029129",
"0.6020625",
"0.60183316",
"0.601759",
"0.6015438",
"0.6006083",
"0.6002809",
"0.5966162",
"0.59439194",
"0.59396017",
"0.59353834",
"0.5928256",
"0.5911567",
"0.59088355",
"0.5880076",
"0.5873793",
"0.5872947",
"0.58631927",
"0.5858244",
"0.5838054",
"0.5837464",
"0.5836898",
"0.58262265",
"0.58209455",
"0.5803709",
"0.58018005",
"0.58002424",
"0.57956207",
"0.57865953",
"0.5771202",
"0.57589424",
"0.57500064",
"0.57486653",
"0.57415295",
"0.5738307",
"0.5724719",
"0.57202727",
"0.57084006",
"0.57077384",
"0.57049006",
"0.5703686",
"0.5696578",
"0.569484",
"0.56921256",
"0.5682835",
"0.5681409",
"0.568076",
"0.56640697",
"0.56636417",
"0.5655827",
"0.5649259",
"0.56393355",
"0.563083",
"0.5627173",
"0.5623457",
"0.5606081",
"0.5601496",
"0.5590254",
"0.5585419",
"0.5581822",
"0.5579416",
"0.5575879",
"0.5560054",
"0.5560054",
"0.55558735",
"0.5555728",
"0.555478",
"0.5553224",
"0.555222",
"0.55501485"
] | 0.6344343 | 7 |
Retrieves available os_tpls from the model. | def get_os_templates
@model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'os_tpl' }.any? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @otps = Otp.all\n end",
"def index\n @os_types = OsType.all\n end",
"def list_os_tpl\n filters = []\n filters << { name: 'image-type', values: ['machine'] }\n filters << { name: 'image-id', values: @image_filtering_image_list } if IMAGE_FILTERING_POLICIES_LISTED.include?(@image_filtering_policy)\n owners = IMAGE_FILTERING_POLICIES_OWNED.include?(@image_filtering_policy) ? [ 'self' ] : nil\n\n ec2_images_ary = Backends::Helpers::CachingHelper.load(@dalli_cache, DALLI_OS_TPL_KEY)\n unless ec2_images_ary\n ec2_images_ary = []\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n ec2_images = if owners\n @ec2_client.describe_images(filters: filters, owners: owners).images\n else\n @ec2_client.describe_images(filters: filters).images\n end\n\n ec2_images.each { |ec2_image| ec2_images_ary << { image_id: ec2_image[:image_id], name: ec2_image[:name] } } if ec2_images\n end\n\n Backends::Helpers::CachingHelper.save(@dalli_cache, DALLI_OS_TPL_KEY, ec2_images_ary)\n end\n\n os_tpls = ::Occi::Core::Mixins.new\n ec2_images_ary.each { |ec2_image| os_tpls << mixin_from_image(ec2_image) }\n\n os_tpls\n end",
"def owt_list\n @client.make_request :get, templates_path('owt')\n end",
"def index\n @tps = Tps.all\n end",
"def get_os_templates(authInfo, options)\n\n @logger.debug(\"Getting OS templates ...\")\n \n os_templates = nil\n\n # If the authentication information is not specified in the Vagrantfile return a failure status\n if(authInfo.nil? || authInfo.url.nil? || authInfo.applicationKey.nil? || authInfo.sharedSecret.nil?)\n @env.ui.error(I18n.t('secured_cloud_vagrant.errors.unspecified_auth', :resource_type => \"OS templates\"))\n return os_templates\n end\n\n begin\n\n # Create a Secured Cloud Connection instance to connect to the SecuredCloud API\n sc_connection = SecuredCloudConnection.new(authInfo.url, authInfo.applicationKey, authInfo.sharedSecret)\n\n # Get the OS templates for the specified details\n os_templates_urls = SecuredCloudRestClient.getOsTemplatesAvailable(sc_connection, options[:orgResource], options[:nodeResource])\n\n if !os_templates_urls.nil?\n\n # Create an array to hold the os templates details\n os_templates = Hash.new\n\n # Get the details for each retrieved os template resource URL and add it to the list\n os_templates_urls.each do |os_template_url|\n os_templates[os_template_url] = SecuredCloudRestClient.getOsTemplateDetails(sc_connection, os_template_url)\n end\n\n @logger.debug(\"Found #{os_templates.length} OS templates for organization '#{options[:orgResource]}' on node '#{options[:nodeResource]}'\")\n\n else\n\n @logger.debug(\"No OS templates available for organization '#{options[:orgResource]}' on node '#{options[:nodeResource]}'\")\n\n end\n\n rescue Errno::ETIMEDOUT\n @env.ui.error(I18n.t(\"secured_cloud_vagrant.errors.request_timed_out\", :request => \"get the OS templates details\"))\n rescue Exception => e\n @env.ui.error(I18n.t(\"secured_cloud_vagrant.errors.generic_error\", :error_message => e.message))\n end\n\n return os_templates\n\n end",
"def index\n @os_products = OsProduct.all\n end",
"def index\n @toodoo_items = ToodooItem.all\n end",
"def list\n FileOperations.find_all(self)\n end",
"def locomotives_all\n @locomotives = Locomotive.all\n respond_with(@locomotives)\n end",
"def index\n @topping_lists = ToppingList.all\n end",
"def index\n @tarots = Tarot.all\n end",
"def index\n @operation_items = OperationItem.all\n end",
"def index\n @time_off_instances = TimeOffInstance.all\n end",
"def index\n @system_models = SystemModel.all\n end",
"def index\n @troops = Troop.all\n end",
"def index\n @troops = Troop.all\n end",
"def index\n @ios = Io.all\n end",
"def index\n @controltltkts = Controltltkt.all\n end",
"def index\n @tms = Tm.all\n end",
"def index\n @toyota = Toyotum.all\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def index\n @os_types = OsType.find(:all, :order => 'position')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @os_types }\n end\n end",
"def list_of_tmms\n super\n end",
"def index\n @operacts = Operact.all\n end",
"def index\n @tocs = Toc.all\n end",
"def index\n @tnpscs = Tnpsc.all\n end",
"def index\n @sftps = Sftp.all\n @chld = Sftp.orders\n end",
"def index\n @storage_types = StorageType.all\n end",
"def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end",
"def index\n @potos = Poto.all\n end",
"def index\n @tvs = Tv.all\n end",
"def tbu_list\n @client.make_request :get, templates_path('tbu')\n end",
"def index\n @toppings = Topping.all\n end",
"def list_operations()\n\t\treturn @service.operations\n\tend",
"def index\n @uptimes = Uptime.all\n end",
"def get_all_parallels_vms(options)\n message = \"Information:\\tListing Parallels VMs\"\n command = \"prlctl list --all |grep -v UUID |awk '{print $4}'\"\n vm_list = execute_command(options,message,command)\n vm_list = vm_list.split(\"\\n\")\n return vm_list\nend",
"def utxos(keys)\n best_of('utxos') do |api|\n api.utxos(keys)\n end\n end",
"def index\n @templates = Spree::Template.all\n end",
"def read_vms_info\n vms_arr = json([]) do\n execute_prlctl('list', '--all','--info', '--json')\n end\n templates_arr = json([]) do\n execute_prlctl('list', '--all','--info', '--json', '--template')\n end\n vms_arr | templates_arr\n end",
"def index\n @tels = Tel.all\n end",
"def index\n @system_platform_accounts = System::PlatformAccount.all.order(created_at: :desc)\n end",
"def all_book_tickers\n request :public, :get, :bookTicker\n end",
"def index\n @troop_details = TroopDetail.all\n end",
"def index\n @os_families = OsFamily.all\n end",
"def index\n @toread_lists = ToreadList.all\n end",
"def tires_list(opts = {})\n data, _status_code, _headers = tires_list_with_http_info(opts)\n data\n end",
"def retrieve_tubes\n show do\n title \"Retrieve tubes and spin down\"\n \n timer initial: { hours: 0, minutes: 15, seconds: 0}\n \n check \"After timer finishes, retrieve all #{operations.length} tubes from 42 C heat block.\"\n check \"Spin the tube down for 20 seconds on a small tabletop centrifuge.\"\n check \"Remove all the supernatant carefully with a 1000 µl pipettor (~400 L total)\"\n end\n end",
"def index\n @unuse_files = UnuseFile.all.order([:active_site_id,:path, :active_device_type])\n end",
"def index\n @operating_hours = OperatingHour.all\n end",
"def platos\n\t\treturn @platos\n\tend",
"def index\n @microfinance_service_provider_typologies = MicrofinanceServiceProviderTypology.all\n end",
"def operating_systems\n collect\n end",
"def show\n @tatoos = Tatoo.all\n end",
"def index\n @terceros = Tercero.all\n end",
"def index\n @loot_types = LootType.all\n end",
"def index\n @tatoos = Tatoo.where(premium: [false, nil])\n @tatoos = @tatoos.paginate(per_page: (bot_request? ? @tatoos.count : 20), page: params[:page])\n end",
"def index\n @os_entregavels = OsEntregavel.all\n\n end",
"def listar()\n @client.get(Route.new([ROTA_DID]))\n end",
"def get_all\n raise UnsupportedOperation\n end",
"def index\n @td_versions = TdVersion.all\n end",
"def index\n @oid_models = OidModel.all\n end",
"def index\n @actual_volumes = ActualVolume.all\n end",
"def items\n Taco.storage.items\n end",
"def index\n @tunes = Tune.all\n end",
"def index\n @tipos_de_impostos = TipoDeImposto.all\n end",
"def index\n @license_tos = LicenseTo.all\n end",
"def index\n @ftp_servers = FtpServer.all\n end",
"def index\n proyecto_activo = Proyecto.find(session[:proyecto_activo]['id'])\n\n @etapas = proyecto_activo.etapas.order(:orden)\n end",
"def get_all\n Rutodo::Database::Todo.map(&:as_entity)\n end",
"def index\n @storage_units = StorageUnit.all\n end",
"def index\n @team_vigo_rise_online_systems = TeamVigoRiseOnlineSystem.all\n end",
"def index\n @train_locomotives = TrainLocomotive.all\n end",
"def index\n @equipment_tires = EquipmentTire.all\n end",
"def index\n @tipotermos = Tipotermo.all\n end",
"def index\n @ptpktps = Ptpktp.order(date: :desc, msg_time: :desc)\n end",
"def index\n @otrosings = Otrosing.all\n end",
"def index\n @controlpltkts = Controlpltkt.all\n end",
"def index\n @housingtypeprices = Housingtypeprice.all\n end",
"def index\n @sunsystems = Sunsystem.all\n end",
"def index\n @solicitacao_tipos = SolicitacaoTipo.all\n end",
"def index\n @how_tos = HowTo.all\n end",
"def index\n @lixotodos = Lixotodo.order(\"data\")\n end",
"def otm_all_target_tables\n [self.otm_table_namer.table_name,self.otm_table_namer.temp,self.otm_table_namer.yesterday]\n end",
"def index\n @todoroutes = Todoroute.all\n end",
"def today_pomodoros\n storage.find_all_by_date(Pomodoro, Time.now)\n end",
"def list_terminals\n Terminal.list_terminals(@user_token, @access_token)\n end",
"def index\n @apple_models = AppleModel.all\n end",
"def index\n ok_request current_user, %w(user, opinion_polls, opinion_polls.time_slots)\n end",
"def index\n @controltgmts = Controltgmt.all\n end",
"def list\n owner.json_api_command('sensor', nil, '-l')&.fetch(:sensors)\n end",
"def index\n @controltnytts = Controltnytt.all\n end",
"def index\n @tiempos = Tiempo.all\n end",
"def opera_action_list\n driver.getOperaActionList.to_a\n end",
"def index\n @os_nivel_servicos = OsNivelServico.all\n end",
"def index\n @selected_times = SelectedTime.all\n end",
"def get_parallels_os(options,vm_name)\n\tmessage = \"Information:\\tDetermining OS for \"+vm_name\n\tcommand = \"prlctl list --info \\\"#{vm_name}\\\" |grep '^OS' |cut -f2 -d:\"\n\tos_info = execute_command(options,message,command)\n\tcase os_info\n\twhen /rhel/\n\t\tos_info = \"RedHat Enterprise Linux\"\n\tend\n\treturn os_info\nend",
"def index\n # @tossups = Tossup.all\n end",
"def index\n # @tossups = Tossup.all\n end",
"def index\n @cephalopods = Cephalopod.all\n end"
] | [
"0.66119236",
"0.61167836",
"0.5930667",
"0.55483913",
"0.55057704",
"0.5491602",
"0.53610384",
"0.53115463",
"0.52023",
"0.51256156",
"0.51229453",
"0.5073297",
"0.5066521",
"0.5062969",
"0.505601",
"0.5055738",
"0.5055738",
"0.5018897",
"0.49838662",
"0.49722463",
"0.4969676",
"0.4966506",
"0.49570715",
"0.49539608",
"0.492738",
"0.49237663",
"0.49205396",
"0.49090418",
"0.49059433",
"0.49010354",
"0.4900012",
"0.4896641",
"0.48959464",
"0.4894399",
"0.48842955",
"0.4875686",
"0.48690516",
"0.48690206",
"0.48355973",
"0.4826923",
"0.48229882",
"0.48228425",
"0.48210445",
"0.4820415",
"0.48154005",
"0.48138958",
"0.4810788",
"0.48098123",
"0.48082447",
"0.47903156",
"0.4788448",
"0.47813165",
"0.4777571",
"0.4777348",
"0.4776176",
"0.47691414",
"0.4764255",
"0.47622287",
"0.47595084",
"0.47518405",
"0.47498778",
"0.47493237",
"0.47485542",
"0.47451037",
"0.47445932",
"0.4739519",
"0.47376353",
"0.47344965",
"0.4734215",
"0.47266608",
"0.47264326",
"0.47233897",
"0.47213674",
"0.4715361",
"0.47135615",
"0.47121847",
"0.4707039",
"0.46984696",
"0.4697621",
"0.46934456",
"0.46932933",
"0.4689724",
"0.46866018",
"0.46865195",
"0.4685996",
"0.4685084",
"0.4682573",
"0.4680609",
"0.46765852",
"0.46697572",
"0.4666966",
"0.46624425",
"0.46607172",
"0.46571797",
"0.46561992",
"0.46552747",
"0.46530777",
"0.46512932",
"0.46512932",
"0.4643094"
] | 0.52801335 | 8 |
Retrieves available resource_tpls from the model. | def get_resource_templates
@model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_resource_tpl\n @resource_tpl\n end",
"def resource_list\n self.resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def index\n @therm_resources = ThermResource.all\n end",
"def resource_templates_by_name\n @resource_templates_by_name ||= resource_templates.all_by_name\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def resources\n @task[:resources]\n end",
"def resource_requests\n return @resource_requests\n end",
"def index\n @temp_resources = TempResource.all\n end",
"def get_nested_resource_objects\n end",
"def resources\n @resources.values\n end",
"def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\n end",
"def resources\n @resources\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def list_resource\n resource_class.all_but_other\n end",
"def tires_list(opts = {})\n data, _status_code, _headers = tires_list_with_http_info(opts)\n data\n end",
"def type\n Resource::ALL\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def resources\n @resources ||= []\n end",
"def resources\n @data.keys\n end",
"def collection\n resource_class.all\n end",
"def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end",
"def resource_roles\n return @resource_roles\n end",
"def form_templates\n FormTemplate.where(lecturer_id: @id)\n end",
"def resources\n Typus::Configuration.roles.keys.map do |key|\n Typus::Configuration.roles[key].keys\n end.flatten.sort.uniq.delete_if { |x| models.include?(x) }\n end",
"def resource_scope\n resource_class.all\n end",
"def tbu_list\n @client.make_request :get, templates_path('tbu')\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def resources\n Typus::Configuration.roles[self.roles].compact\n end",
"def available_settings\n return @@settings_by_type[self.resource_type]\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def index\n @chef_resources = ChefResource.all\n end",
"def find_all_resources options\n policy_scope(resource_class)\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def resource_actions\n return @resource_actions\n end",
"def resource_actions\n return @resource_actions\n end",
"def query_resources\n powershell_exec(\"get-dscresource\").result\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 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 assigned_resources( resource_class, page_layout )\n resource_key = get_resource_class_key(resource_class)\n if assigned_resource_ids.try(:[],page_layout.id).try(:[],resource_key).present?\n resource_ids = assigned_resource_ids[page_layout.id][resource_key]\n #in prepare_import, we want to know assigned resources\n #current shop is not designshop, we need use unscope here.\n if resource_ids.include? 0\n resources = resource_ids.collect{|resource_id|\n if resource_id > 0\n resource_class.unscoped.find resource_id\n else\n nil \n end\n }\n else\n resources = resource_class.unscoped.find resource_ids \n end\n end\n resources||[]\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def permissions\n @resource_permissions\n end",
"def test_list_available_resources\n puts \"## list_available_resources (retrieveable SF objects) ##\"\n resp = Salesforce::Rest::AsfRest.xlist_available_resources()\n\n resp.each {|key, val| pp key + ' => ' + val.to_s}\n assert !resp.nil?\n end",
"def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend",
"def roles\n @resource_roles\n end",
"def index\n @timetable_templates = TimetableTemplate.all\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def index\n @survey_item_templates = SurveyItemTemplate.all\n end",
"def related_resources(resource)\n if resource.respond_to?(:related_resources_recursive)\n return resource.related_resources_recursive\n else\n return []\n end\n end",
"def index\n @item_templates = ItemTemplate.all\n end",
"def resource_attributes\n resource_class.attribute_names\n end",
"def resources\n instance_variable_get(\"@#{mapping.plural}\")\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def get_related_resources(resource, limit=nil)\n name = resource.class.name.split(\"::\")[0]\n\n related = collect_related_items(resource)\n\n #Authorize\n authorize_related_items(related)\n\n order_related_items(related)\n\n #Limit items viewable, and put the excess count in extra_count\n related.each_key do |key|\n if limit && related[key][:items].size > limit && [\"Project\", \"Investigation\", \"Study\", \"Assay\", \"Person\", \"Specimen\", \"Sample\", \"Run\", \"Workflow\", \"Sweep\", \"Network\"].include?(resource.class.name)\n related[key][:extra_count] = related[key][:items].size - limit\n related[key][:items] = related[key][:items][0...limit]\n end\n end\n\n return related\n end",
"def index\n @tps = Tps.all\n end",
"def resource_operations\n attributes.fetch(:resourceOperations)\n end",
"def index\n @controltltkts = Controltltkt.all\n end",
"def index\n @resource_items = ResourceItem.page(params[:page]).order(\"updated_at DESC\")\n end",
"def resource_all(stack)\n all_result_pages(nil, :body,\n \"ListStackResourcesResponse\", \"ListStackResourcesResult\",\n \"StackResourceSummaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListStackResources\",\n \"StackName\" => stack.id,\n )\n ),\n )\n end.map do |res|\n Stack::Resource.new(\n stack,\n :id => res[\"PhysicalResourceId\"],\n :name => res[\"LogicalResourceId\"],\n :logical_id => res[\"LogicalResourceId\"],\n :type => res[\"ResourceType\"],\n :state => res[\"ResourceStatus\"].downcase.to_sym,\n :status => res[\"ResourceStatus\"],\n :updated => res[\"LastUpdatedTimestamp\"],\n ).valid_state\n end\n end",
"def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end",
"def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def list(resource_type_identifier=nil)\n if resource_type_identifier\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\" unless @model.get_by_id resource_type_identifier\n\n # split the type identifier and get the most important part\n uri_part = resource_type_identifier.split('#').last\n\n # request uri-list from the server\n path = uri_part + '/'\n else\n path = '/'\n end\n\n headers = self.class.headers.clone\n headers['Accept'] = 'text/uri-list'\n\n # TODO: remove the gsub OCCI-OS hack\n response = self.class.get(\n @endpoint + path,\n :headers => headers\n ).body.gsub(/\\# uri:\\/(compute|storage|network)\\/[\\n]?/, '').split(\"\\n\").compact\n end",
"def index\n @lcb_templates = LcbTemplate.all\n end",
"def index\n @product_templates = ProductTemplate.all\n end",
"def resources\n @resources ||= {}\n end",
"def index\n @request_templates = RequestTemplate.all\n end",
"def index\n @item_tiers = ItemTier.all\n end",
"def submitted_resources\n return @submitted_resources\n end",
"def index\n @attr_templates = AttrTemplate.all\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def resource_template\n @resource_template ||= Array.wrap(super).map(&:deep_symbolize_keys)\n end",
"def all(options = {})\n data = service.list_monitored_resource_descriptors(options).body[\"resourceDescriptors\"] || []\n load(data)\n end",
"def linked_resources\n return @linked_resources\n end",
"def index\n @question_templates = QuestionTemplate.all\n end",
"def resource_actions\n @resource_actions ||= []\n end",
"def get_resource_descriptions(resource)\n available_versions.map do |version|\n get_resource_description(resource, version)\n end.compact\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @templates = Spree::Template.all\n end",
"def templates\n @conn.templates\n end",
"def getResourceType() \n @obj.getResourceType() \n end",
"def resource_per_page\n 10\n end",
"def resources_content\n resources_query = model_class.all\n\n instance_variable_set(\"@#{instances_name}\", resources_query)\n end",
"def resource_list\n list = []\n resources.each { |rss| list << rss.name }\n list.to_sentence\n end",
"def selecttemplate\n\t@templates = JobTemplate.all\n end",
"def allowed_resource_actions\n return @allowed_resource_actions\n end",
"def resources\n Loader.resources.keys\n end",
"def all\n describe(resource_uri)\n end",
"def index\n @resources_customs = ResourcesCustom.all\n end"
] | [
"0.6471842",
"0.6261758",
"0.5737077",
"0.5737077",
"0.5737077",
"0.57069266",
"0.56951815",
"0.56611663",
"0.56594324",
"0.5631535",
"0.5616914",
"0.5565891",
"0.5564209",
"0.5559923",
"0.555733",
"0.5487962",
"0.54526114",
"0.5382644",
"0.537395",
"0.53714687",
"0.53413194",
"0.5300583",
"0.529987",
"0.52889323",
"0.52739984",
"0.5257351",
"0.5254063",
"0.5210894",
"0.52027935",
"0.51984936",
"0.51832473",
"0.51821613",
"0.51687205",
"0.5161858",
"0.5161755",
"0.51569456",
"0.5150727",
"0.5147001",
"0.5147001",
"0.51389015",
"0.51199365",
"0.5076763",
"0.5069268",
"0.50652015",
"0.5049571",
"0.5043633",
"0.50391096",
"0.5038183",
"0.503534",
"0.50332934",
"0.50290376",
"0.50264734",
"0.5021842",
"0.5007932",
"0.5006378",
"0.49962652",
"0.49929106",
"0.49805292",
"0.49721888",
"0.49694073",
"0.49694073",
"0.49694073",
"0.4965883",
"0.49648237",
"0.4964433",
"0.49594852",
"0.49555737",
"0.4955147",
"0.4954874",
"0.49424505",
"0.49405137",
"0.493451",
"0.4925108",
"0.4924383",
"0.4922579",
"0.49219644",
"0.49197164",
"0.49150455",
"0.49100798",
"0.49095207",
"0.4893372",
"0.4891409",
"0.48905316",
"0.48860475",
"0.48799753",
"0.48735076",
"0.48706287",
"0.48701397",
"0.48688424",
"0.48646656",
"0.48645788",
"0.48613498",
"0.48607847",
"0.48582846",
"0.4858126",
"0.485679",
"0.48561004",
"0.48495755",
"0.48446792",
"0.4844394"
] | 0.6003903 | 2 |
Sets media type. Will choose either application/occi+json or text/plain based on the formats supported by the server. | def set_media_type
media_types = self.class.head(@endpoint).headers['accept']
Occi::Log.debug("Available media types: #{media_types}")
@media_type = case media_types
when /application\/occi\+json/
'application/occi+json'
else
'text/plain'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end",
"def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
"def set_content_type\n case params['format']\n when 'xml'\n response.headers['Content-Type'] = \"application/xml; charset=utf-8\"\n when 'json', 'csv'\n response.headers['Content-Type'] = \"application/json; charset=utf-8\"\n else\n raise \"Unexpected format!\"\n end\n end",
"def content_type=(ctype)\n @response_headers[\"Content-Type\"] = ctype\n end",
"def content_type(type, params={})\n type = Rack::File::MIME_TYPES[type.to_s] if type.kind_of?(Symbol)\n fail \"Invalid or undefined media_type: #{type}\" if type.nil?\n if params.any?\n params = params.collect { |kv| \"%s=%s\" % kv }.join(', ')\n type = [ type, params ].join(\";\")\n end\n response.header['Content-Type'] = type\n end",
"def set_default_media_type\n self.media_type = ::MIME::Types[self.content_type].first.try(:media_type) || 'file'\n end",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=(content_type); end",
"def content_type type=nil, params={}\n return @response[CNT_TYPE] unless type\n\n default = params.delete(:default)\n mime_type = mime_type(type) || default\n raise \"Unknown media type: %p\" % type if mime_type.nil?\n\n mime_type = mime_type.dup\n unless params.include? :charset\n params[:charset] = params.delete('charset') || 'UTF-8'\n end\n\n params.delete :charset if mime_type.include? 'charset'\n unless params.empty?\n mime_type << (mime_type.include?(';') ? ', ' : ';')\n mime_type << params.map do |key, val|\n val = val.inspect if val =~ /[\";,]/\n \"#{key}=#{val}\"\n end.join(', ')\n end\n\n @response[CNT_TYPE] = mime_type\n end",
"def content_type=( type )\n\t\treturn self.headers[ :content_type ] = type\n\tend",
"def set_media_type\n @media_type = MediaType.find(params[:id])\n end",
"def content_type=(identifier)\n @content_type = nil\n headers['Content-Type'] = MediaTypeIdentifier.load(identifier).to_s\n end",
"def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend",
"def set_content_type raw_type\n response_object.mime_raw raw_type\n end",
"def content_type=(value)\n @content_type = value\n end",
"def content_type=(value)\n raise ArgumentError, \"content_type must be set to :data or :header, was: #{value.inspect}\" unless [:data, :header].include?(value)\n @content_type = value\n end",
"def content_type(type = nil || (return @headers[RodaResponseHeaders::CONTENT_TYPE]), opts = OPTS)\n unless (mime_type = mime_type(type) || opts[:default])\n raise RodaError, \"Unknown media type: #{type}\"\n end\n\n unless opts.empty?\n opts.each do |key, val|\n next if key == :default || (key == :charset && mime_type.include?('charset'))\n val = val.inspect if val =~ /[\";,]/\n mime_type += \"#{mime_type.include?(';') ? ', ' : ';'}#{key}=#{val}\"\n end\n end\n\n @headers[RodaResponseHeaders::CONTENT_TYPE] = mime_type\n end",
"def content_type(type)\n @headers << \"Content-Type: #{type}\\r\\n\"\n @content_type = true\n end",
"def set_content_type(content_type)\n set_header 'Content-Type', content_type\n end",
"def format=(format)\n self[\"Content-Type\"] = Rack::Mime.mime_type(\".#{format}\")\n end",
"def set_content_type(extension)\n content_type Rack::Mime.mime_type(extension, \"application/json\")\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def content_type=(type)\n @content_type = type\n end",
"def content_type=(mime_type)\n self.headers[\"Content-Type\"] =\n if mime_type =~ /charset/ || (c = charset).nil?\n mime_type.to_s\n else\n \"#{mime_type}; charset=#{c}\"\n end\n end",
"def set_content_type(override=false)\n if override || file.content_type.blank? || generic_content_type?\n new_content_type = ::MIME::Types.type_for(current_path).first.to_s\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n rescue ::MIME::InvalidContentType => e\n raise CarrierWave::ProcessingError, I18n.translate(:\"errors.messages.mime_types_processing_error\", :e => e)\n end",
"def set_content_type(ctype)\n headers[\"Content-Type\"] = \"#{ctype};charset=#{Response.charset}\"\n end",
"def content_type! type = nil, charset = nil\n __e__.explicit_charset = charset if charset\n charset ||= (content_type = response['Content-Type']) &&\n content_type.scan(%r[.*;\\s?charset=(.*)]i).flatten.first\n type && (Symbol === type) && (type = '.' << type.to_s)\n content_type = type ?\n (type =~ /\\A\\./ ? '' << mime_type(type) : type.split(';').first) : 'text/html'\n content_type << '; charset=' << charset if charset\n response['Content-Type'] = content_type\n end",
"def add_content_type\n header[:content_type] = 'text/plain'\n end",
"def mime_type=(value)\n @mime_type = value\n end",
"def default_mime_type=(value); end",
"def set_content_type\n response.headers[\"Content-Type\"] = \"text/html; charset=#{Comatose.config.content_type}\" unless Comatose.config.content_type.nil?\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end",
"def set_media(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def content_type(value = nil)\n value ? @content_type = value : @content_type\n end",
"def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end",
"def media_type_sym media\n case\n when (media =~ %r{^application/xml}) then :xml\n when (media =~ %r{^application/json}) then :json\n when (media =~ %r{^application/json-p}) then :json\n when (media =~ %r{^(application|text)/(x-)?javascript}) then :json\n when (media =~ %r{^(application|text)/(x-)?ecmascript}) then :json\n when (media =~ %r{^text/yaml}) then :yaml\n # when (media =~ %r{^text/tab-separated-values}) then :tsv\n # when (media =~ %r{^text/(comma-separated-values|csv)}) then :csv\n # when (media =~ %r{^text/html}) then :html\n else :json\n end\n end",
"def media_type; end",
"def media_type; end",
"def apply_content_type_header(options)\n if !options.has_key?(:headers) || !options[:headers].has_key?(\"Content-Type\")\n apply_header options, \"Content-Type\", \"application/json\"\n end\n end",
"def media_type(name)\n name = normalize(name)\n raise Restfulie::UnsupportedContentType.new(\"unsupported content type '#{name}'\") if media_types[name].nil?\n media_types[name].type\n end",
"def header(type = nil, params = {})\n return response['Content-Type'] unless type || params[:default]\n default = params.delete :default\n mime = mime_type(type) || default\n raise \"Unknown media type: #{type}\" unless mime\n params = charset mime, params\n build mime.dup, params\n end",
"def set_content_type\n response.headers[\"Content-Type\"] = \"text/html; charset=#{Comatose.config.content_type}\" unless Comatose.config.content_type.nil? or response.headers['Status'] == '404 Not Found'\n end",
"def content_mime_type\n fetch_header(\"action_dispatch.request.content_type\") do |k|\n v = if get_header(\"CONTENT_TYPE\") =~ /^([^,;]*)/\n Mime::Type.lookup($1.strip.downcase)\n else\n nil\n end\n set_header k, v\n rescue ::Mime::Type::InvalidMimeType => e\n raise InvalidType, e.message\n end\n end",
"def content_type\n @content_type ||= request.content_type\n end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def attachment_content_type=(value)\n self.content_type=value\n end",
"def content_type=(content_type); @message_impl.setContentType content_type; end",
"def mime_type\n \"application/json\".freeze\n end",
"def content_type(type=nil, params={})\n return @_content_type unless type\n super(type, params)\n @_content_type = type\n end",
"def mime_type\n super || Mime::Type.lookup(DEFAULT_CONTENT_TYPE)\n end",
"def SetMediaType(new_media_type)\n Builtins.y2warning(\n \"PackageSlideShow::SetMediaType() is obsoled, do not use!\"\n )\n\n nil\n end",
"def media_type(default = nil)\n if value = content_type\n value.split('/')[0]\n else\n if block_given?\n yield\n else\n default\n end\n end\n end",
"def select_type\n case @options[\"format\"]\n when \"rdfxml\" then 'application/rdf+xml'\n when \"ntriples\" then 'text/plain'\n when \"turtle\" then 'application/x-turtle'\n when \"n3\" then 'text/rdf+n3'\n when \"trix\" then 'application/trix'\n when \"trig\" then 'application/x-trig'\n else 'Unknown'\n end\n end",
"def media_type\n @media_type || parse_and_return(:@media_type)\n end",
"def content_type!(ext)\n case ext.downcase\n when 'haml'; t = 'text/html'\n when 'erb'; t = 'text/html'\n# I believe all the rest are determined accurately by the Rack::Mime.mime_type call in the else clause below.\n# when 'html'; t = 'text/html'\n# when 'js'; t = 'text/javascript'\n# when 'css'; t = 'text/css'\n# when 'png'; t = 'image/png'\n# when 'gif'; t = 'image/gif'\n# when 'jpg'; t = 'image/jpeg'\n# when 'jpeg'; t = 'image/jpeg'\n else t = Rack::Mime.mime_type('.' + ext, 'text/plain')\n end\n #puts(\"----#{ext}:\" + t.inspect) # dbg\n (self.response[:headers]['Content-Type'] = t) if t\n end",
"def media_types\n Restfulie::MediaType.default_types + MediaType.medias_for(self)\n end",
"def response_media_type(options={})\n options = {:halt_if_unacceptable => false}.merge(options)\n accept = env['HTTP_ACCEPT']\n if accept =~ /\\S/\n begin\n best_media_type = env['rack-accept.request'].best_media_type(supported_media_types)\n rescue RuntimeError => e\n # TODO: this is a crappy way to recognize this exception \n raise unless e.message =~ /Invalid header value/\n end\n if best_media_type\n best_media_type\n else\n if options[:halt_if_unacceptable]\n logger.error \"received Accept header of #{accept.inspect}; halting with 406\"\n message = I18n.t('app.errors.request.accept',\n :default => \"The request indicated that no supported media type is acceptable. Supported media types are: %{supported_media_types}. The request specified Accept: %{accept}\",\n :accept => accept,\n :supported_media_types => supported_media_types.join(', ')\n )\n halt_error(406, {'Accept' => [message]})\n else\n supported_media_types.first\n end\n end\n else\n supported_media_types.first\n end\n end",
"def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end",
"def type=(val)\n @type = val.to_sym if %w(UNSPECIFIED MEDIA MASTER).include? val.to_s\n end",
"def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end",
"def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end",
"def media_types=(value)\n @media_types = value\n end",
"def mime_type type\n Rack::Mime.mime_type type\n end",
"def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end",
"def mime_type(value = nil)\n value ? @mime_type = value : @mime_type\n end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def mime_type=(_); end",
"def set_default_format\n if request.format.symbol.nil? || request.format.to_s == '*/*'\n logger.debug \"[ApplicationController] Request format set to #{request.format.to_s.inspect}, forcing 'text/plain'\"\n request.format = :text\n end\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def to_media_type(options)\n as_media_type(options).to_json\n end",
"def mime_type(type, value)\n type = \".#{type}\" unless type.to_s[0] == '.'\n ::Rack::Mime::MIME_TYPES[type] = value\n end",
"def content_type\n @mime_type\n end",
"def as(content_type)\n headers['Content-Type'] = content_type\n accepts(content_type)\n end",
"def content_type\n end",
"def mime_type\n _mime_type ? _mime_type.to_s : 'text/plain'\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def status_unsupported_media_type\n respond_to do |format|\n format.any { head :unsupported_media_type }\n end\n end",
"def content_types(*content_types)\n Sinatra::RPC::Serializer.register self, content_types\n @response_content_type = content_types.compact.first\n end",
"def content_type\n mime = MIME_TYPES.fetch(format, DEFAULT_MIME_TYPE)\n headers.fetch(\"Content-Type\", mime)\n end",
"def content_type=(new_content_type)\n @content_type = new_content_type\n end",
"def content_type\n self[\"Content-Type\"]\n end",
"def content_type\n type, *parameters = content_type_parse\n type || 'application/octet-stream'\n end",
"def unsupported_media_type\n msg = \"Image format #{file_type} is not supported.\"\\\n \" Supported formats are: #{roda_class.supported_media_types}.\"\n halt [333, { 'Content-Type' => 'text/html' }, [msg]]\n end"
] | [
"0.7306967",
"0.7081636",
"0.6980447",
"0.69575226",
"0.69351524",
"0.6924226",
"0.68415236",
"0.68415236",
"0.68244916",
"0.6807563",
"0.6763445",
"0.6716374",
"0.66997755",
"0.6679754",
"0.66793036",
"0.6673945",
"0.66519827",
"0.66429466",
"0.6641115",
"0.66336405",
"0.6623446",
"0.65640706",
"0.6550936",
"0.6550936",
"0.6513704",
"0.65031296",
"0.64689016",
"0.6414632",
"0.64085495",
"0.63982046",
"0.6372334",
"0.6353479",
"0.6318502",
"0.6270331",
"0.6270331",
"0.6270331",
"0.6270331",
"0.62586135",
"0.6243593",
"0.6218925",
"0.6218925",
"0.6218371",
"0.6208281",
"0.6188849",
"0.6166481",
"0.6166481",
"0.615579",
"0.6150951",
"0.6128148",
"0.61052614",
"0.6094026",
"0.6092871",
"0.6084957",
"0.6082976",
"0.6074794",
"0.60711956",
"0.60685384",
"0.60637623",
"0.60627216",
"0.6061053",
"0.6048669",
"0.6037414",
"0.6036807",
"0.60367274",
"0.60237664",
"0.60207623",
"0.60136604",
"0.5993744",
"0.5993744",
"0.5986794",
"0.59527385",
"0.59467775",
"0.5941834",
"0.59377605",
"0.59377605",
"0.59377605",
"0.59377605",
"0.59377605",
"0.59377605",
"0.59377605",
"0.59377605",
"0.5937529",
"0.5932902",
"0.59297127",
"0.59297127",
"0.59232175",
"0.59232175",
"0.59211516",
"0.59028924",
"0.5887389",
"0.5874615",
"0.58739024",
"0.58718085",
"0.587124",
"0.58667374",
"0.58631784",
"0.5861341",
"0.58397603",
"0.5839499",
"0.5833175"
] | 0.88380545 | 0 |
Generates a humanreadable response message based on the HTTP response code. | def response_message(response)
@last_response = response
'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_code_message(response_code)\n case response_code\n when 1\n \"Success\"\n when 2\n \"Error\"\n when 3\n \"Server Too Busy\"\n when 4\n \"Protocol Error\"\n when 5\n \"Operation Not Supported\"\n when 6\n \"Recursion Count Too High\"\n when 7\n \"Server Read-only\"\n when 100\n \"Handle Not Found\"\n when 101\n \"Handle Already Exists\"\n when 102\n \"Invalid Handle\"\n when 200\n \"Values Not Found\"\n when 201\n \"Value Already Exists\"\n when 202\n \"Invalid Value\"\n when 300\n \"Out of Date Site Info\"\n when 301\n \"Server Not Responsible\"\n when 302\n \"Service Referral\"\n when 303\n \"Prefix Referral\"\n when 400\n \"Invalid Admin\"\n when 401\n \"Insufficient Permissions\"\n when 402\n \"Authentication Needed\"\n when 403\n \"Authentication Failed\"\n when 404\n \"Invalid Credential\"\n when 405\n \"Authentication Timed Out\"\n when 406\n \"Authentication Error\"\n when 500\n \"Session Timeout\"\n when 501\n \"Session Failed\"\n when 502\n \"Invalid Session Key\"\n when 504\n \"Invalid Session Setup Request\"\n when 505\n \"Session Duplicate Msg Rejected\"\n else\n \"Response Code Message Missing!\"\n end\n end",
"def generate_response(code = 503, text)\n \"HTTP/1.1 #{code} #{CODES[code]}\\r\\nContent-type: text/plain\\r\\nContent-length: #{text.length}\\r\\n\\r\\n#{text}\"\n end",
"def generate_response(code, format)\n @message = \"Returning code #{code} in #{format} format\"\n response_data = case format\n when \"txt\"\n content_type 'text/plain'\n @message\n when \"json\"\n content_type 'application/json'\n { message: @message }.to_json\n when \"xml\"\n content_type 'application/xml'\n erb :'status.xml', layout: false\n else\n erb :status\n end\n [code.to_i, response_data]\nend",
"def response_code\n if @response.code.to_i != 404 && is_fake_404?\n return \"#{@response.code.to_s} Possible fake 404\"\n else\n return @response.code.to_s\n end\n end",
"def response_message message, code\n render json: {message: message, code: code}\n end",
"def http_status_line(code = 200)\n \"#{HTTP_VERSION} #{code} #{Shelf::Utils::HTTP_STATUS_CODES[code]}\"\n end",
"def response_message(response)\n @last_response = response\n \"HTTP Response status: [#{response.code.to_s}] #{reason_phrase(response.code)}\"\n end",
"def http_error(code, message = nil, headers = {})\n [code, {'Content-Type' => 'text/plain; charset=utf-8'}.merge(headers),\n [http_status(code) + (message.nil? ? \"\\n\" : \" (#{message})\\n\")]]\n end",
"def code\n self.response_code # .to_s\n end",
"def http_status(code)\n [code, Rack::Utils::HTTP_STATUS_CODES[code]].join(' ')\n end",
"def http_status(code)\n [code, Rack::Utils::HTTP_STATUS_CODES[code]].join(' ')\n end",
"def http_status(code)\n [code, Rack::Utils::HTTP_STATUS_CODES[code]].join(' ')\n end",
"def generic_Generate_Initial(httpcode)\n\tinitial=''\n\tcase httpcode\n\twhen 200 then initial = 'HTTP/1.1 200 OK'\n\twhen 404 then initial = 'HTTP/1.1 404 Not Found' # this server only support these 2 code\n\tend\n\treturn initial\nend",
"def status_code_meaning(number)\r\n if number == 200\r\n return \"OK\"\r\n elsif number == 301\r\n return \"Moved Permanently\"\r\n elsif number == 401\r\n return \"Unauthorized\"\r\n elsif number == 404\r\n return \"Not Found\"\r\n elsif number == 500\r\n return \"Internal Server Error\"\r\n end\r\nend",
"def response_message response\n \"%s %s: %s %s (%f)\\n%s\" % [\n *response[:_response_meta].slice(\n :request_method, :request_url, :status_code, :status_message, :total_time\n ).values,\n Yajl::Encoder.encode(response.except(:_response_meta))\n ]\n end",
"def set_message(code)\n\t\tif(code == 200)\n\t\t\t@message = 'ok'\n\t\telsif(code == 404)\n\t\t\t@message = 'The resource wasn\\'t found.'\n\t\telsif(code == 500)\n\t\t\t@message = 'An error occured.'\n\t\telse\n\t\t\t@message = 'Unknown error.'\n\t\tend\n\tend",
"def http_code\n '000'\n end",
"def response_line\n \"#{Protocol::NAME}/#{@version} #{@code} #{@message}#{Protocol::CRLF}\"\n end",
"def message_from(response)\n case response[:response_code]\n when 0\n return \"OK\"\n when 2000\n return \"ERROR 2000: Invalid Connection Ticket\"\n when 10303\n return \"ERROR 10303: TransRequestID is empty\"\n when 10305\n return \"ERROR 10305: An error occurred when validating the supplied payment data\"\n when 10309\n return \"ERROR 10309: The credit card number is formatted incorrectly\"\n when 10312\n return \"ERROR 10312: The credit card Transaction ID was not found\"\n when 10409\n return CVVResult.messages[ response[:card_code] ] if CARD_CODE_ERRORS.include?(response[:card_code])\n end\n end",
"def build_response(response)\n \"HTTP/1.1 #{response[:status_code]} #{response[:status_message]}\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{response[:bytesize]}\\r\\n\" +\n \"Connection: close\\r\\n\"\n end",
"def code\n @raw_response.code\n end",
"def type\n case code\n when 100..199 then :informational_response\n when 200..299 then :success\n when 300..399 then :redirection\n when 400..499 then :client_error\n when 500..599 then :server_error\n else :unknown\n end\n end",
"def code\n @response.code\n end",
"def prepare_status_response( txn, status_code, message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\ttxn.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it.\n\t\tunless BODILESS_HTTP_RESPONSE_CODES.include?( status_code )\n\t\t\ttxn.content_type = 'text/plain'\n\t\t\treturn message.to_s\n\t\tend\n\n\t\t# For bodiless responses, just tell the dispatcher that we've handled \n\t\t# everything.\n\t\treturn true\n\tend",
"def code\n @response.code.to_i\n end",
"def code\n @response.code.to_i\n end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def return_msg\n case return_code\n when 0x00\n 'Connection Accepted'\n when 0x01\n 'Connection refused: unacceptable protocol version'\n when 0x02\n 'Connection refused: client identifier rejected'\n when 0x03\n 'Connection refused: server unavailable'\n when 0x04\n 'Connection refused: bad user name or password'\n when 0x05\n 'Connection refused: not authorised'\n else\n \"Connection refused: error code #{return_code}\"\n end\n end",
"def create_message(response)\n return if response.nil?\n\n message = \"#{response[:method].to_s.upcase} \"\n message << \"#{response[:url]}: \"\n message << \"#{@status} - #{format_response}\"\n message\n end",
"def code\n @http_response.code.to_i\n end",
"def message_from(response)\n if not response.has_key?(:ErrInfo)\n return 'Success'\n end\n\n # The ErrInfo key can contain a | separated string of multiple error\n # codes. By default we start at the end and work our way backwards to\n # try and find the highest-level one we can.\n if response[:ErrInfo].index('|')\n error_codes = response[:ErrInfo].split('|')\n else\n error_codes = [response[:ErrInfo]]\n end\n\n error_codes.reverse.each do |code|\n if ERROR_CODES.has_key?(code)\n return ERROR_CODES[code]\n end\n end\n\n \"Error #{error_codes[-1]}\"\n end",
"def challenge_response(challenge_code)\n {\n :body => challenge_code,\n :status => 200\n }\n end",
"def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end",
"def response_reason_code\n unescape params['x_response_reason_code']\n end",
"def response_reason_code\n unescape params['x_response_reason_code']\n end",
"def response code=nil, body=nil, headers=nil\n args = [code, body, headers].compact\n\n headers = {'Content-Type' => DEFAULT_CONTENT_TYPE}\n code = 200\n body = \"\"\n\n args.each do |arg|\n case arg\n when Hash then headers.merge!(arg)\n when String then body = arg\n when Integer then code = arg\n end\n end\n\n [code, headers, body]\n end",
"def reply_code\n return \"No response.\" if response.nil?\n return (not response.first.last.kind_of?(Hash) or response.first.last[\"reply_code\"].nil?) ? \"Unexpected response hash.\" : response.first.last[\"reply_code\"] if response.instance_of?(Hash)\n response_match = response.match(/\\<reply-code\\>(.+)\\<\\/reply-code\\>/) if response.instance_of?(String)\n return (response_match.nil?) ? \"Unexpected response string.\" : response_match[1] if response.instance_of?(String)\n return \"Unexpected response type.\"\n end",
"def respond(message, code: :ok)\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code] || code\n [code, { 'Content-Type' => 'application/json' }, [Oj.dump('result' => message)]]\n end",
"def error_msg(code=ErrorCodes::INTERNAL_SERVER_ERROR, detail=\"Unspecified error\", errors = nil, data = nil)\n @response[:errors] = {\n code: code[:code],\n detail: detail,\n errors: errors,\n data: data\n }\n end",
"def response_code\n @response.code\n end",
"def respond_with(status_code)\n response.status = status_code\n response.write ''\n nil\n end",
"def render_exception_response(exception, response_code)\n case response_code\n when :unauthorized\n logged_in? ? access_denied : must_be_logged_in\n when :forbidden\n access_denied\n when :not_implemented\n not_yet_implemented\n else\n status = interpret_status(response_code) # defaults to \"500 Unknown Status\" if response_code is not recognized\n status_code = status[0,3]\n respond_to do |format|\n format.html do\n @error_page_title = I18n.t(\"error_#{status_code}_page_title\", :default => [:error_default_page_title, \"Error.\"])\n @status_code = status_code\n render :layout => 'v2/errors', :template => 'content/error', :status => status_code\n end\n format.js do\n render :layout => false, :template => 'content/error', :status => status_code\n end\n format.all { render :text => status, :status => status_code }\n end\n end\n end",
"def raise_api_error_msg(res)\n \"HTTP status code: #{res.status}, \" \\\n \"Error message: #{res.body['message']}, \" \\\n \"Reference: #{res.body['reference']}\"\n end",
"def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end",
"def status_code\n response_value(:code)\n end",
"def render_error(msg, code=500)\n respond_with(nil, :status => {:msg => msg, :code => code})\n end",
"def inspect\n \"<Response(#{status})>\"\n end",
"def status(code)\n response.status = code\n end",
"def check_response(code = :success, expected_msg = nil, line = nil)\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n assert_response code, \"expected \" + code.to_s + \", server response: \" + response.body.to_s + line\n if (code.class == Symbol)\n # Not sure why this list isn't the right one: (has :ok instead). Should fix once...\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:success] = 200\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:redirect] = 302\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code]\n end\n return if (code == 302) # redirect, html body\n\n body = JSON.parse(response.body)\n #Success payloads should contain one of these.\n assert (body[0] && body[0][\"server_time\"]) ||\n body[\"status\"] == code ||\n body[\"status\"] == \"destroyed\" ||\n body[\"server_time\"] ||\n body[\"device_id\"] ||\n body[\"key_data\"] ||\n body[\"authtoken\"], \"success payload not one of the usual patterns\" + line\n return if ! expected_msg\n\n if expected_msg.class == Symbol\n expected_msg = ApplicationController.MESSAGES[expected_msg]\n assert expected_msg != nil, \"oops, your check_response passed a non-existant expected message symbol!\" + line\n end\n\n if (code == 200)\n return assert body[\"message\"] = expected_msg, \"wrong message\" + line\n end\n\n # Simple generic check against message template to see that we got\n # the right one - there will be at least 12 chars without a\n # substitution at either start or end in all our MESSAGES strings.\n # Or a whole string without formatting anywhere (when array of validation errors is stringified).\n len = 12\n ret_msg = body[\"error\"]\n # Handle short expected strings (INVALID_PARAM)\n assert ret_msg.start_with?(expected_msg.first(len)) ||\n ret_msg.end_with?(expected_msg.last(len)) ||\n ret_msg.include?(expected_msg),\n \"reply error message doesn't match:\\\"\" + ret_msg + \"\\\"!=\\\"\"+ expected_msg + \"\\\"\" + line\n end",
"def http_response(response)\n status_code, headers, body = response\n http_response = status_line(status_code)\n DefaultResponseHeaders.merge(headers).each do |k,v|\n http_response << \"#{k}: #{v}\\r\\n\"\n end\n http_response << \"\\r\\n\"\n body.each do |s|\n http_response << s\n end\n http_response\n end",
"def error_message\n @response.reason_phrase\n end",
"def send_by_code request, response, code, headers = {}\n\t\t\t\tbegin\n\t\t\t\t\tresponse.status = code\n\t\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\t\treturn ErrorCtrl.new(request, response).index\n\t\t\t\trescue => e\n\t\t\t\t\tPlezi.error e\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def guess_status(response)\n result = {}\n # response status code returned by php-simple-proxy and php-json-proxy\n if response =~ /\"status\":{\"http_code\":([\\d]+)}/\n result['code'] = $1\n result['message'] = ''\n # generic page titles containing HTTP status\n elsif response =~ />301 Moved</ || response =~ />Document Moved</ || response =~ />Object Moved</ || response =~ />301 Moved Permanently</\n result['code'] = 301\n result['message'] = 'Document Moved'\n elsif response =~ />302 Found</ || response =~ />302 Moved Temporarily</\n result['code'] = 302\n result['message'] = 'Found'\n elsif response =~ />400 Bad Request</\n result['code'] = 400\n result['message'] = 'Bad Request'\n elsif response =~ />401 Unauthorized</\n result['code'] = 401\n result['message'] = 'Unauthorized'\n elsif response =~ />403 Forbidden</\n result['code'] = 403\n result['message'] = 'Forbidden'\n elsif response =~ />404 Not Found</\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ />The page is not found</\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ />413 Request Entity Too Large</\n result['code'] = 413\n result['message'] = 'Request Entity Too Large'\n elsif response =~ />500 Internal Server Error</\n result['code'] = 500\n result['message'] = 'Internal Server Error'\n elsif response =~ />503 Service Unavailable</\n result['code'] = 503\n result['message'] = 'Service Unavailable'\n # getaddrinfo() errors\n elsif response =~ /getaddrinfo: /\n if response =~ /getaddrinfo: nodename nor servname provided/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /getaddrinfo: Name or service not known/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # getnameinfo() errors\n elsif response =~ /getnameinfo failed: /\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # PHP 'failed to open stream' errors\n elsif response =~ /failed to open stream: /\n # HTTP request failed! HTTP/[version] [code] [message]\n if response =~ %r{failed to open stream: HTTP request failed! HTTP\\/(0\\.9|1\\.0|1\\.1) ([\\d]+) }\n result['code'] = $2.to_s\n result['message'] = ''\n if response =~ %r{failed to open stream: HTTP request failed! HTTP/(0\\.9|1\\.0|1\\.1) [\\d]+ ([a-zA-Z ]+)}\n result['message'] = $2.to_s\n end\n # No route to host\n elsif response =~ /failed to open stream: No route to host in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection refused\n elsif response =~ /failed to open stream: Connection refused in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /failed to open stream: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n # Success - This likely indicates an SSL/TLS connection failure\n elsif response =~ /failed to open stream: Success in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # Java 'java.net' exceptions\n elsif response =~ /java\\.net\\.[^\\s]*Exception: /\n if response =~ /java\\.net\\.ConnectException: No route to host/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.ConnectException: Connection refused/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.ConnectException: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n elsif response =~ /java\\.net\\.UnknownHostException: Invalid hostname/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketException: Network is unreachable/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketException: Connection reset/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketTimeoutException: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # C errno\n elsif response =~ /\\[Errno -?[\\d]{1,5}\\]/\n if response =~ /\\[Errno -2\\] Name or service not known/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 101\\] Network is unreachable/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 104\\] Connection reset by peer/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 110\\] Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n elsif response =~ /\\[Errno 111\\] Connection refused/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 113\\] No route to host/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 11004\\] getaddrinfo failed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10053\\] An established connection was aborted/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10054\\] An existing connection was forcibly closed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10055\\] An operation on a socket could not be performed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10060\\] A connection attempt failed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10061\\] No connection could be made/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # Python urllib errors\n elsif response =~ /HTTPError: HTTP Error \\d+/\n if response =~ /HTTPError: HTTP Error 400: Bad Request/\n result['code'] = 400\n result['message'] = 'Bad Request'\n elsif response =~ /HTTPError: HTTP Error 401: Unauthorized/\n result['code'] = 401\n result['message'] = 'Unauthorized'\n elsif response =~ /HTTPError: HTTP Error 402: Payment Required/\n result['code'] = 402\n result['message'] = 'Payment Required'\n elsif response =~ /HTTPError: HTTP Error 403: Forbidden/\n result['code'] = 403\n result['message'] = 'Forbidden'\n elsif response =~ /HTTPError: HTTP Error 404: Not Found/\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ /HTTPError: HTTP Error 405: Method Not Allowed/\n result['code'] = 405\n result['message'] = 'Method Not Allowed'\n elsif response =~ /HTTPError: HTTP Error 410: Gone/\n result['code'] = 410\n result['message'] = 'Gone'\n elsif response =~ /HTTPError: HTTP Error 500: Internal Server Error/\n result['code'] = 500\n result['message'] = 'Internal Server Error'\n elsif response =~ /HTTPError: HTTP Error 502: Bad Gateway/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /HTTPError: HTTP Error 503: Service Unavailable/\n result['code'] = 503\n result['message'] = 'Service Unavailable'\n elsif response =~ /HTTPError: HTTP Error 504: Gateway Time-?out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # Ruby exceptions\n elsif response =~ /Errno::[A-Z]+/\n # Connection refused\n if response =~ /Errno::ECONNREFUSED/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # No route to host\n elsif response =~ /Errno::EHOSTUNREACH/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /Errno::ETIMEDOUT/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # ASP.NET System.Net.WebClient errors\n elsif response =~ /System\\.Net\\.WebClient/\n # The remote server returned an error: ([code]) [message].\n if response =~ /WebException: The remote server returned an error: \\(([\\d+])\\) /\n result['code'] = $1.to_s\n result['message'] = ''\n if response =~ /WebException: The remote server returned an error: \\(([\\d+])\\) ([a-zA-Z ]+)\\./\n result['message'] = $2.to_s\n end\n # Could not resolve hostname\n elsif response =~ /WebException: The remote name could not be resolved/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Remote server denied connection (port closed)\n elsif response =~ /WebException: Unable to connect to the remote server/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # This likely indicates a plain-text connection to a HTTPS or non-HTTP service\n elsif response =~ /WebException: The underlying connection was closed: An unexpected error occurred on a receive/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # This likely indicates a HTTPS connection to a plain-text HTTP or non-HTTP service\n elsif response =~ /WebException: The underlying connection was closed: An unexpected error occurred on a send/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # The operation has timed out\n elsif response =~ /WebException: The operation has timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # Generic error messages\n elsif response =~ /(Connection refused|No route to host|Connection timed out) - connect\\(\\d\\)/\n # Connection refused\n if response =~ /Connection refused - connect\\(\\d\\)/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # No route to host\n elsif response =~ /No route to host - connect\\(\\d\\)/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /Connection timed out - connect\\(\\d\\)/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n end\n result\n end",
"def translate_status_code(code)\n {\n '00' => :success,\n '40' => :neutral,\n '59' => :waiting_bank,\n '60' => :rejected_bank,\n '64' => :waiting_risk,\n '65' => :rejected_risk,\n '70' => :rejected_validation,\n '80' => :waiting,\n '90' => :new\n }[code]\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 code\n response&.code\n end",
"def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end",
"def get_http_response_code\n raise 'To be implemented in child classes'\n end",
"def process_response(response)\n case response.code.to_i\n when 200, 404\n parse_message response.body\n when 401, 500\n error_message = parse_message response.body\n raise \"Unauthorized: #{error_message['error']['message']}\"\n else\n raise \"Response code #{response.code} not recognized\"\n end\n end",
"def purchase_response(code = '00000')\n \"NUMTRANS=0720248861&NUMAPPEL=0713790302&NUMQUESTION=0000790217&SITE=1999888&RANG=99&AUTORISATION=XXXXXX&CODEREPONSE=#{code}&COMMENTAIRE=Demande trait?e avec succ?s ✔漢\"\n end",
"def stringify_statuscode!(error_pages)\n return if error_pages.nil?\n\terror_pages.each { |error_page| error_page['statusCode'] = error_page['statusCode'].to_s }\n end",
"def response_error(args = {})\n opts = { code: 418 }\n opts[:message] ||= args\n render status: opts[:code], json: {\n message: opts[:message]\n }\n end",
"def to_s\n message_prefix_part = if message_prefix\n \"#{message_prefix} - \"\n else\n ''\n end\n \"#{message_prefix_part}#{Rdkafka::Bindings.rd_kafka_err2str(@rdkafka_response)} (#{code})\"\n end",
"def structureResponse(code, codeMessage, file, contentType)\n # grab file contents\n data = getFileContents(file);\n\n # Return response\n \"HTTP/1.1 #{code}\\r\\n\" +\n \"Content-Length: #{data.size}\\r\\n\" +\n \"\\r\\n\" +\n \"#{data}\\r\\n\";\nend",
"def error_response(status_code, message=nil)\n message ||= \"Your request has been denied as a #{status_code} error\"\n raise select_error(status_code), message\n end",
"def analyse_http_code(response_code)\n case response_code\n when 1 then\n # Failure to use the proxy\n return false\n when 400 .. 403 then\n # Proxy asks for authentication\n return false\n when 407 then\n # Proxy asks for authentication\n return false\n when 444 then\n return response_code\n else\n # If we get a valid return code, we add it to the final list\n return response_code\n end\n end",
"def status_code; end",
"def response code, desc, media_type = nil, hash = { }\n (self[:responses] ||= { })[code] = ResponseObj.new(desc, media_type, hash)\n end",
"def _create_http_response(mock_response, code, message)\n mock_response.stub!(:code).and_return(code)\n mock_response.stub!(:message).and_return(message)\n mock_response.stub!(:is_a?).and_return(true) if [\"200\", \"201\"].member?(code)\nend",
"def handleHTTPStatus(code)\n case code\n when 200 # Ok\n puts \"HTTP request successful\"\n return true\n when 204\n puts \"HTTP Error: No Content\"\n return false\n when 401\n puts \"HTTP Error: Server rejected authentication.\"\n return false\n else\n puts \"Unhandled HTTP status: #{code}\"\n return false\n end # case code\n end",
"def status_code\n @response.status\n end",
"def formatted_message\n \"#{@message} (#{@code})\"\n end",
"def elb_response_code(elb_expected_code)\n test_http_response(elb_expected_code, elb_href, ELB_PORT)\n end",
"def status(code)\n @response.status = code\n end",
"def status_code\n params[:code] || 500\n end",
"def status_code\n params[:code] || 500\n end",
"def response_code\n @log.debug \"Retreiving HTTP Code for website '#{@url}'\"\n\n begin\n result = Net::HTTP.get_response(@fqdn, @path).code\n @log.debug \"Received HTTP Code #{result} for website '#{@url}'\"\n rescue SocketError\n @log.error \"Communication problem with '#{@fqdn}'--possibly a DNS error. Cannot check status!\"\n result = \"200\"\n end\n\n return result\n end",
"def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end",
"def response_status_message(http_response)\n return false unless http_response.is_a?(Net::HTTPRedirection)\n query = URI.parse(http_response['location']).query\n return false if query.nil?\n return Base64.decode64(query.decode_query_string['msg'])\n end",
"def code_symbol\n HTTP_STATUS_CODES[status]\n end",
"def to_s\n response = \"#{@status_line}\\n#{@header_fields}\\n#{@body}\"\n end",
"def evaluate_error_message(error_code)\n case error_code\n when '0' then\n return 'We did not find a candidate profile matching your account. Please fill out your candidate profile first.'\n when '1' then\n return 'We did not find a faculty profile matching your account. Please fill out your faculty profile first.'\n when '2' then\n return 'We did not find the application form you are creating an appointment for.'\n else\n return 'Sorry. This page has encountered an error.'\n end\n else\n end",
"def service_status(code, response_time = nil, status)\n case\n when code == \"200\" && response_time <= 0.4\n status = \"GREEN\"\n puts \"#{status}\"\n when code == \"200\" && response_time > 0.4\n status = \"ORANGE\"\n puts \"#{status}\"\n when code != \"200\"\n status = \"RED\"\n puts \"#{status}\"\n else\n status = \"CHECK SERVICE URL\"\n puts \"#{status}\"\n end\n end",
"def message\n \"Telphin returned an error #{@error_code}: '#{@error_msg}'\"\n end",
"def hello_hello_app(code = 200)\n ->(*) { [code, { 'Content-Length' => 11, 'Content-Type' => 'text/html; charset=utf-8' }, ['Hello Hello']] }\nend",
"def make_response(type = \"text/html\", compressed = false, code = 200, msg = \"OK\", &block)\n response = [ \"HTTP/1.1 #{code} #{msg}\" ]\n result = (block_given?) ? yield : nil\n if result then \n size = (result) ? result.bytesize : 0\n response += [ \"Content-Type: #{type}\",\n \"Content-Length: #{size}\" ]\n end\n response += [ \"Content-Encoding: gzip\" ] if compressed\n response += [ \"Connection: close\", \"\" ]\n response.push(result) if result\n return response.join(\"\\r\\n\")\n end",
"def msg_code\n return @critical, 2 if @critical\n return @warning, 1 if @warning\n return @unknown, 3 if @unknown\n [@ok, 0]\n end",
"def render_error(code, message)\n respond_with Utils::RenderableError.new(code, message), status: code\n end",
"def render_reply (status, message)\n\n format, type = determine_out_format\n\n response.status = status\n\n if format == 'xml'\n\n \"<message>#{message}</message>\"\n\n elsif format == 'json'\n\n OpenWFE::Json.encode( message )\n\n else\n\n _erb(:reply, :layout => :html, :locals => { :message => message })\n end\n end",
"def render_error(error_code_and_message)\n LogWrapper.log('ERROR', {\n 'message' => error_code_and_message[1],\n 'method' => \"#{controller_name}##{action_name}\",\n 'status' => error_code_and_message[0]\n })\n return api_response_builder(error_code_and_message[0], {message: error_code_and_message[1]}.to_json)\n end",
"def error(message, code)\n error_response = {\n message: message\n }\n render :json => error_response, :status => code\n end",
"def http_err_code\n http_codes[@http_err]\n end",
"def code\n if !@values.has_key? 'RESPONSE'\n if has_errors? \n raise PayTrace::Exceptions::ValidationError, get_error_response\n else\n raise PayTrace::Exceptions::ValidationError, \"missing response field\"\n end\n end\n code = parse_code(@values[\"RESPONSE\"])\n code.first\n end",
"def debug_header_status(status)\n status = status.to_i\n # Make this actually useful by explaining why each header appears.\n if $_1xx.include? status\n Logger.log(\"Response code: #{status}. Response type: Informational.\")\n elsif $_2xx.include? status\n Logger.log(\"Response code: #{status}. Response type: Success.\")\n elsif $_3xx.include? status\n Logger.log(\"Response code: #{status}. Response type: Redirection.\")\n elsif $_4xx.include? status\n Logger.log(\"Response code: #{status}. Response type: Client error.\")\n else\n Logger.log(\"Response code: #{status} does not have a valid response type.\")\n end\nend",
"def error_message(response)\n \"#{response.body['error']}: #{response.body['error_description']}\"\n end",
"def unknown_response(code)\n fail(Rapid::Common::Exceptions::InvalidPlayoutResponse, code.to_s(16))\n end"
] | [
"0.8226038",
"0.7770849",
"0.7633927",
"0.7080703",
"0.70004135",
"0.69469523",
"0.6858639",
"0.68527424",
"0.67523706",
"0.66270095",
"0.66270095",
"0.66270095",
"0.6576122",
"0.6544994",
"0.6522589",
"0.6458999",
"0.6457684",
"0.644042",
"0.64309216",
"0.64275944",
"0.64014083",
"0.6378363",
"0.6369575",
"0.63667417",
"0.63482445",
"0.63482445",
"0.633183",
"0.633183",
"0.633183",
"0.633183",
"0.6316102",
"0.6305541",
"0.63044536",
"0.62581354",
"0.62451434",
"0.6235186",
"0.6227451",
"0.6221417",
"0.61894816",
"0.616859",
"0.6163495",
"0.61613476",
"0.61276513",
"0.612574",
"0.60994",
"0.6095748",
"0.60641766",
"0.6059032",
"0.6043617",
"0.60027283",
"0.5998875",
"0.5997605",
"0.5997451",
"0.59917504",
"0.5955786",
"0.59498197",
"0.59467685",
"0.59446615",
"0.5941433",
"0.5928751",
"0.5927985",
"0.5919965",
"0.5919666",
"0.5917178",
"0.5916398",
"0.59033144",
"0.59024936",
"0.58973604",
"0.5874099",
"0.5859151",
"0.5858724",
"0.5857924",
"0.58569944",
"0.58487606",
"0.5845103",
"0.58316624",
"0.5829512",
"0.58266115",
"0.58266115",
"0.5820778",
"0.57970005",
"0.57868266",
"0.5784231",
"0.57768404",
"0.5772632",
"0.5772601",
"0.57710505",
"0.5762825",
"0.5759773",
"0.575616",
"0.5754889",
"0.5752662",
"0.5751709",
"0.57491875",
"0.5721235",
"0.5718795",
"0.57064116",
"0.57047284",
"0.57004064"
] | 0.7045315 | 5 |
Fields Values tpArma : 0 Uso permitido; 1 Uso restrito; | def initialize(attrs = {})
# Tipo de Arma
@kind = attrs[:tpArma]
# Serie
@serie = attrs[:nSerie]
# Cano
@barrel = attrs[:nCano]
# Descricao
@description = attrs[:descr]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def campoord_inicial\n 'fecharec'\n end",
"def formata_valor_abatimento(tamanho = 13)\n format_value(:valor_abatimento, tamanho)\n end",
"def mc_cop_aae_alt_aae(row)\n #se copertura:arboreo,arbustivo ed erbaceo == 0, le altezze rispettive devono essere null [Presi singolarmente]\n #a meno che i parametri su cui fare il check siano nulli\n unless row.copertura_arboreo.nil? || row.copertura_arbustivo.nil? || row.copertura_erbaceo.nil?\n if row.copertura_arboreo == 0\n unless row.altezza_arboreo.nil?\n multiple_parameter_error(row,\"Copertura Arboreo = 0, Altezza Arboreo not null\")\n end\n end\n if row.copertura_arbustivo == 0\n unless row.altezza_arbustivo.nil?\n multiple_parameter_error(row,\"Copertura Arbustivo = 0, Altezza Arbustivo not null\")\n end\n end\n if row.copertura_erbaceo == 0\n unless row.altezza_erbaceo.nil?\n multiple_parameter_error(row,\"Copertura Erbaceo = 0, Altezza Erbaceo not null\")\n end\n end\n end\n end",
"def campoord_inicial\n 'ubicacion'\n end",
"def cambiar_tema_params\r\n params.require(:cambiar_tema).permit(:anterior, :actual, :valida_consejero, :valida_coordinador, :estado, :user_id, :revisado)\r\n end",
"def trabajo_params\n params.require(:trabajo).permit(:planta, :ito, :descripcion, :total, :fecha_termino, :avance, :op, :factura, :observaciones, :i1, :i2, :i3, :i4, :i5, :i6, :i7, :i8, :i9, :i10, :i11, :i12, :v1, :v2, :v3, :v4, :v5, :v6, :v7, :v8, :v9, :v10, :v11, :v12, :centro_costo, :supervisor)\n end",
"def titulo_guia\n titulo = []\n\n t = Especie.find(params[:especie_id])\n a = t.adicional\n\n tipo_region = params[:tipo_region] == \"anp\" ? \"ANP \" : \"Municipio de \"\n \n if a.nombre_comun_principal.present?\n titulo[0] = \"Guía de #{a.nombre_comun_principal}\"\n else\n titulo[0] = \"Guía de #{t.nombre_cientifico}\"\n end\n\n titulo[1] = tipo_region + params[:nombre_region]\n titulo\n end",
"def trabajador_params\n params.require(:trabajador).permit(:rut, :apellido1, :apellido2, :nombres, :sexo, :fecha_nac, :edad, :region, :comuna, :prevision, :nacionalidad, :division, :tipo_trabajador, :empresa)\n end",
"def acabamento_params\r\n params.require(:acabamento).permit(:tipo)\r\n end",
"def restricao_params\n params.require(:restricao).permit(:palavra)\n end",
"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 trabajo_params\n params.require(:trabajo).permit(:nombre, :precio)\n end",
"def atributos\n p \"El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}\"\n end",
"def tarefa_params\n params.require(:tarefa).permit(:missao_id, :usuario_curso_id, :nome, :descricao)\n end",
"def almacene_params\n params.require(:almacene).permit(:IdAlmacen, :Nombre, :TipoAlmacen)#DO NO DELETE THIS COMMENT\n end",
"def orden_trabajo_params\n params.require(:orden_trabajo).permit(:pantonera, :cliente, :orden_de_compra, :producto, :grano, :formula_kilos, :tinetas, :fecha, :muestra_color, :colorista_a_cargo)\n end",
"def rotina_params\n params.require(:rotina).permit(:descricao, :data_vencimento, :data_pagamento, :categoria_id, :tipo_lancamento_id, :user_id, :valor, :data_inicial, :data_final, :ativo, :sub_categoria_id)\n end",
"def abastecimento_params\n params.require(:abastecimento).permit(:abastecimento_dt, :odometro, :precolitro, :precototal, :obs, :veiculo_id, :completou_flag, :combustivel_id, :formaspagamento_id)\n end",
"def monta_header\n # CAMPO TAMANHO VALOR\n # tipo do registro [1] 0\n # operacao [1] 1\n # literal remessa [7] REMESSA\n # brancos [16]\n # info. conta [20]\n # empresa mae [30]\n # cod. banco [3]\n # nome banco [15]\n # data geracao [6] formato DDMMAA\n # complemento registro [294]\n # num. sequencial [6] 000001\n \"01REMESSA #{info_conta}#{empresa_mae.format_size(30)}#{cod_banco}#{nome_banco}#{data_geracao}#{complemento}000001\"\n end",
"def agregar_asignatura\n @titulo = \"Agregar asignatura\"\n @seccion = \"Asignaturas\"\n @carreras = [\"Biología\", \"Computación\", \"Geoquímica\", \"Física\", \"Matemática\", \"Química\", \"Complementaria\"]\n @clasificaciones = [\"Semestre I\", \"Semestre II\", \"Semestre III\", \"Semestre IV\", \"Semestre V\", \n \"Semestre VI\", \"Semestre VII\", \"Semestre VIII\", \"Semestre IX\", \"Semestre X\"]\n @menciones = []\n\n @tipos = [\"Obligatoria\",\"Electiva\", \"Obligatoria optativa\", \"Complementaria\", \"Otra\"]\n @a = __es_codigo_de_asignatura?(\"17744144\")\n end",
"def reserva_aceitum_params\n params.require(:reserva_aceitum).permit(:dono, :esporte, :naipe, :inicio, :fim)\n end",
"def armazena_params\n params.require(:armazena).permit(:codbarras, :cnpj, :quantidade)\n end",
"def getListaTabla\n return ['form_cultivos','baciloscopia_forms','biopsias_forms','form_liquidos','form_chagas','form_malaria','form_leishmaniases','Tuberculosis','form_cancer_uterinos','form_anat_citologicas','Tuberculosis']\n end",
"def acreedor_params\n params.require(:acreedor).permit(:Nombres, :Appaterno, :Apmaterno, :Apcasada, :Di, :Telefono, :Correo, :Oficina_id, :Cargo_id, :Dociden_id, :fechaingreso, :fechanacimiento, :genero, :estadocivil, :tiposociedad_id, :tipoentidad_id, :esjuridica, libauxdet_attributes: [:id, :name] )\n end",
"def formata_valor(tamanho = 13)\n format_value(valor, tamanho)\n end",
"def tarima_params\n params.require(:tarima).permit(:idTarima, :CodigoTarima, :Fecha, :Activa)#DO NO DELETE THIS COMMENT\n end",
"def acertaLema(palavra)\n if palavra.match(/^(d[ií])$/)\n palavra = \"dir\"\n elsif palavra.match(/^(tr[aá]|tr[aá]r)$/)\n palavra = \"trazer\"\n elsif match = palavra.match(/^(.*?)(p[oô]|p[oô]r)$/)\n s1, s2 = match.captures\n palavra = s1+\"por\"\n elsif match = palavra.match(/^(.*?)(f[aá]|far)$/)\n s1, s2 = match.captures\n palavra = s1+\"fazer\"\n elsif match = palavra.match(/^(.*?)(qu[ií]|quir)$/)\n s1, s2 = match.captures\n palavra = s1+\"querer\"\n elsif palavra.match(/[aá]$/)\n palavra.gsub!(/[aá]$/, \"\")\n palavra = palavra << \"ar\"\n elsif palavra.match(/[eê]$/)\n palavra.gsub!(/[eê]$/, \"\")\n palavra = palavra << \"er\"\n elsif palavra.match(/[ií]$/)\n palavra.gsub!(/[ií]$/, \"\")\n palavra = palavra << \"ir\"\n elsif palavra.match(/[oô]$/)\n palavra.gsub!(/[oô]$/, \"\")\n palavra = palavra << \"or\"\n end\n return palavra\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def antropo_params\n params.require(:antropo).permit(:estatura, :pescoco, :ombro, :torax, :cintura, :abdomen, \n :quadril, :braco_esq, :antebraco_esq, :coxa_esq, :panturrilha_esq, :braco_dir, \n :antebraco_dir, :panturrilha_dir, :coxa_dir, :aluno_id, :alunos_attributes => [:id, :nome])\n end",
"def inspect\n\n \"Tetronimo: type: #{@type}, value: #{@value}, rotation: #{@rotation}, grid_row: #{@grid_row}, grid_col: #{@grid_col}\"\n\n end",
"def tabla_pasos(contador,array_anterior)\n aux=0\n tabla = Terminal::Table.new do |a|\n a.title= \"ELEMENTOS A ORDENAR: #{array_anterior}\"\n a.headings = [{value:'DATO', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n for i in 0..contador-1\n a.add_row([\n aux+=1,\n @pasoL[i]\n ])\nend\n end\n return tabla\n end",
"def azienda_params\n params.require(:azienda).permit(:denominazione, :piva, :codfisc, :indirizzo, :cap, :citta, :tel, :fax, :cell, :email, :web, :pec, :referente, :note, :logo, :active)\n end",
"def tarifa_params\n params.require(:tarifa).permit(:parqueadero_id, :tipo_de_cupo_id, :valor_minuto, :descripcion)\n end",
"def imc_tabla\n\t\tx = self.indice_masa_corporal\n\n\n\t\tif x < 18.5\n\t\t\treturn \"#{x} < 18.5 -- Bajo peso -- Delgado\"\n\t\telsif x >= 18.5 && x <= 24.9\n\t\t\treturn \"18.5 < #{x} < 24.9 -- Adecuado -- Aceptable\"\n\t\telsif x > 24.9 && x <= 29.9\n\t\t\treturn \"25.0 < #{x} < 29.9 -- Sobrepeso -- Sobrepeso\"\n\t\telsif x > 29.9 && x <= 39.9\n\t\t\treturn \"30.0 < #{x} < 39.9 -- Obesidad grado 1 -- Obesidad\"\n\t\telsif x > 39.9\n\t\t\treturn \" #{x} > 40 -- Obesidad grado 2 -- Obesidad\"\n\t\tend\n\n\tend",
"def monta_header\n # CAMPO TAMANHO VALOR\n # tipo do registro [1] 0\n # operacao [1] 1\n # literal remessa [7] REMESSA\n # Código do serviço [2] 01\n # cod. servico [15] COBRANCA\n # info. conta [20]\n # empresa mae [30]\n # cod. banco [3]\n # nome banco [15]\n # data geracao [6] formato DDMMAA\n # complemento registro [294]\n # num. sequencial [6] 000001\n \"01REMESSA01COBRANCA #{info_conta}#{empresa_mae.format_size(30).remove_accents}#{cod_banco}#{nome_banco}#{data_geracao}#{versao_layout}#{complemento}000001\"\n end",
"def acuse\r\n return false unless acuse?\r\n row = @acuse.shift\r\n return {\r\n id: row[0],\r\n destino: row[1],\r\n timestamp_acuse: row[2],\r\n estado: row[3].to_sym,\r\n timestamp_envio: row[4],\r\n texto: row[5] || ''\r\n }\r\n end",
"def etapa_params\n params.require(:etapa).permit(:nombre, :descripcion, :etapaAnterior)\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def anuncio_params\n params.permit(:id,\n :tipo,\n :enlace,\n :fecha_inicio,\n :fecha_fin,\n :descripcion,\n :tablon_id,\n :autor_name\n )\n end",
"def nota_trab_params\n params.require(:nota_trab).permit(:nota, :aluno_id, :professor_id, :disciplina_id)\n end",
"def texto_palabra_params\n params.require(:texto_palabra).permit(:id_tp, :id_texto, :id_palabrab)\n end",
"def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end",
"def os_tarefa_params\n params.require(:os_tarefa).permit(:os_id,:catl_id, :prod_id, :pess_abertura_tarefa_id, :pess_tarefa_atribuida_id, :entregavel_id, :id_tarefa_redmine, :ust_tarefa, :horastarefa, :situacao, :justificativa, :id_os_pagamento)\n end",
"def imprimir \n\t\taux = String.new()\n \treservada = /TkProgram|TkEnd|TkRead|TkWrite|TkWriteln|TkWith|TkDo|TkIf|TkThen|TkElse|\"TkWhile|TkFor|TkFrom|TkTo|TkBy|TkRepeat|TkTimes|TkFunc|TkBegin|TkReturn|\"TkTrue|TkFalse/\n \tsigno = /TkNot|TkAnd|TkNot|TkEquivalente|TkDesigual|TkMayorIgual|TkMenorIgual|TkMayor|TkMenor|TkMas|TkResta|TkMult|TkDiv|TkResto|TkDivEntera|TkMod|TkAsignacion|TkPuntoComa|TkComa|TkTipoReturn|TkParentesisA|TkParentesisC/\n \n \tif reservada.match(@tipo) # palabra reservada\n \t\taux = \"palabra reservada\"\n \telsif signo.match(@tipo) # signo\n \t\taux = \"signo\"\n \telsif @tipo == \"TkTipoBoolean\" || @tipo == \"TkTipoNumber\" then # tipo de dato\n \t\taux = \"tipo de dato\"\n \telsif @tipo == \"TkNum\" # literal numerico\n \t\taux = \"literal numerico\"\n \telsif @tipo == \"TkId\" # Identificador\n \t\taux = \"identificador\"\n \telsif @tipo == \"TkError\" # caracter inesperado\n \t\taux = \"caracter inesperado\"\n \telsif @tipo == \"TkString\"\n \t\taux = \"cadena de caracteres\"\n \tend\n\n \tputs \"linea \" + @fila.to_s + \", columna \" + @columna.to_s + \": \" + aux.to_s + \" '#{@token}'\"\n \tend",
"def tablero_params\n params.require(:tablero).permit(:nombre, :descripcion, :horainicio, :horafin, :puntos, :abierto, :e1, :e2, :e3, :cronometro)\n \n end",
"def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end",
"def asignaturas\n @seccion = \"Asignaturas\"\n @titulo = \"Asignaturas\"\n if params[:orden]\n case params[:orden]\n when \"Código\"\n @orden = \"codigo\"\n when \"Nombre\"\n @orden = \"nombre\"\n when \"Créditos\"\n @orden = \"unidades_credito\"\n when \"Tipo\"\n @orden = \"tipo\"\n else\n @orden = \"codigo\"\n end\n else\n @orden = \"codigo\"\n end\n \n @carreras = [\"Biología\", \"Computación\", \"Geoquímica\", \"Física\", \"Matemática\", \"Química\", \"Complementaria\"]\n @categorias = ['Código', 'Nombre', 'Créditos','Tipo'] #Este es el orden que se mostrará en el select de la vista\n @categoria_seleccionada = params[:orden]\n\n @asignatura_datos = [] #En este arreglo se guardan los pares \"Codigo - Nombre\" de cada asignatura para mostrar en el campo de busqueda\n Asignatura.order('nombre').all.each do |asignatura|\n #En este foro se agregan uno a uno los valores de cada asignatura al arreglo de la manera indicada arriba\n @asignatura_datos << asignatura.codigo.to_s + \" - \" + asignatura.nombre.to_s\n end\n end",
"def atributos_presenta\n return [ \n :id, \n :fecha, \n :oficina, \n :responsable,\n :nombre, \n :actividadtipos, \n :proyectos,\n :actividadareas, \n :proyectosfinancieros, \n :objetivo\n ]\n end",
"def get_tipo_formated\n case tipo\n when 'A' then 'A (Impar)'\n when 'B' then 'B (Par)'\n when 'V' then 'V (Verano)'\n end\n end",
"def to_tabla\n\t\t\t\"#{@nombre}#{' ' * (15-@nombre.size)} #{@proteinas.round(1)} #{@glucidos.round(1)} #{@lipidos.round(1)} #{valor_energetico.round(2)}\"\n\t\tend",
"def formata_valor_desconto(tamanho = 13)\n format_value(:valor_desconto, tamanho)\n end",
"def get_txt_panneau\n\t\treturn [mdl_par.panneaux[0].to_s,mdl_par.panneaux[1].to_s]\n\tend",
"def turma_params\n params.require(:turma).permit(:nome, :codigo, :ativo)\n end",
"def neutovr_alrm; catdet.form(:name, 'rpcControlApsSettingForm').text_field(:name, 'ecNeutralThrshldOverAlarm'); end",
"def formata_valor_terceiro_desconto(tamanho = 13)\n format_value(:valor_terceiro_desconto, tamanho)\n end",
"def formata_valor(tamanho = 13)\n format_value(:valor, tamanho)\n end",
"def palavraSecreta(info = @info)\n\n sorteio = info[rand(info.size)]\n @plvSorteada = sorteio['Palavra'].upcase\n @plvDica = sorteio['Dica']\n @plvAjudas = sorteio['Ajuda']\n @plvSecreta = @plvSorteada.chars\n @qtdLetras = @plvSorteada.size\n end",
"def trabajo_params\n params.require(:trabajo).permit(:cliente_id, :descripcion, :tipo_trabajo_id, :fecha, :valor)\n end",
"def asama_tanim_params\n params.require(:asama_tanim).permit(:asama_adi)\n end",
"def setar_data\n if params[\"laudo\"]\n unless params[\"laudo\"][\"data_formatada\"].blank?\n $data_formatada = params[\"laudo\"][\"data_formatada\"]\n end\n else\n if params['voluntario'] and params['voluntario']['criterios'] and params['voluntario']['criterios']['data_formatada']\n $data_formatada = params['voluntario']['criterios']['data_formatada']\n end\n end\n end",
"def orden_anulada_params\n params.require(:orden_anulada).permit(:fecha_orden, :orden_reemplazada, :unidad, :costo_unidad, :presupuesto, :cantidad, :iva, :total)\n end",
"def arriendo_params\n params.require(:arriendo).permit(:talla, :talla_parka, :talla_pantalon, :document, :altura, :nac, :peso, :nombre, :apellidop, :apellidom, :nropedido, :cantidad, :user_id, :equipo_id, :email, :fecha, :dias, :experience)\n end",
"def tipoapreensao_params\n params.require(:tipoapreensao).permit(:ttpcodigo, :ttpatualiza)\n end",
"def devolver_azucar \n\t\treturn @azucares\n\tend",
"def turistum_params\n params.require(:turistum).permit(:nombre, :mail, :contraseĮņa)\n end",
"def tarifa_params\n params.require(:tarifa).permit(:trf_concepto, :trf_conceptoCodigo, :trf_conceptoAplicacion, :trf_detalleAplicacion, :trf_naturaleza, :trf_tipoProducto, :trf_producto, :trf_promo, :trf_econo, :trf_base, :trf_flexi, :trf_deluxe, :trf_unidadCobro, :trf_fechaInicio, :trf_fechaFin, :trf_estadoRegistro)\n end",
"def vegetaria\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend",
"def daw_trabajo_params\n params.require(:daw_trabajo).permit(:trab_nombre, :trab_tipo, :trab_telefono, :trab_direccion, :trab_fecha, :trab_estado, :daw_representante_id)\n end",
"def cautelaarmamento_params\n params.require(:cautelaarmamento).permit(:cautela_id, :reservaarmamento_id, :qtd_armamento, :qtd_armamento_baixa, :data_baixa, :baixa)\n end",
"def resource_params\n params.require(:tratamiento).permit(:tipo)\n end",
"def fields\n form = @stamper.getAcroFields\n form.getFields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = form.getField(name)\n end\n end",
"def otros_tributos\n '000000000000000'\n end",
"def obra_params\n params.require(:obra).permit(:descricao, :local)\n end",
"def tasa= valor\n @tasa = valor.to_f\n end",
"def arealizar_params\n params.require(:arealizar).permit(:descripcion, :fecha, :tiempo)\n end",
"def create\n @grua = Grua.new(grua_params)\n @grua.dicc_mantenciones = @grua.set_dicc_mantenciones(@grua.tipo, @grua.horometro)\n\n if @grua.tipo == \"Eléctrica\"\n @grua.mantenciones = [6000, 2000, 1000, 250]\n elsif @grua.tipo == \"Gas\"\n @grua.mantenciones = [2800, 1400, 700, 350]\n elsif @grua.tipo == \"Apilador\"\n @grua.mantenciones = [2000, 1000, 500]\n else @grua.mantenciones = []\n end\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to @grua, notice: 'Grua creada exitosamente.' }\n format.json { render :show, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def valor_arriendo_params\n params.require(:valor_arriendo).permit(:TipoArriendo_id, :Propiedad_id, :ValorDefinido, :Temporada, :ValorActivo, :FechaInicioTemp, :FechaTerminoTemp)\n end",
"def anamnese_params\n params.require(:anamnese).permit(:atividade_trabalho, :desc_atividade_trabalho, :data_exame_clinico, :descricao_exame_clinico, :cardiopatia, :cirurgia, :descricao_cirurgia, :problema_saude, :dor_corporal, :desc_dor_corporal, :lesao, :desc_lesao, :alergia, :desc_alergia, :fumante, :alcolotra, :atividade_fisica, :desc_atividade_fisica, :objetivo, :usuario_id)\n end",
"def get_azucares\n @_100=((@azucares*100)/@peso)\n @ir_100=(@_100/90)*100\n @porcion=((@azucares*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/90)*100\n [ @azucares , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end",
"def m_tabla_fields(objeto)\n\t\tobjeto.class::TABLA_FIELDS\n\tend",
"def mapear(nombreMaquina)\n r = case nombreMaquina\n when \"Silos de Cebada\" then (\"producto_silos_cebada\")\n when \"Molino\" then (\"producto_molino\")\n when \"Paila de Mezcla\" then (\"producto_paila_mezcla\")\n when \"Cuba de Filtracion\" then (\"producto_cuba_filtracion\")\n when \"Paila de Coccion\" then (\"producto_paila_coccion\")\n when \"Tanque preclarificador\" then (\"producto_tanque_preclarificador\")\n when \"Enfriador\" then (\"producto_enfriador\")\n when \"TCC\" then (\"producto_tcc\")\n when \"Filtro de Cerveza\" then (\"producto_filtro_cerveza\")\n when \"Tanques para Cerveza Filtrada\" then (\"producto_tanque_cerveza\")\n when \"Llenadora y Tapadora\" then (\"cerveza\")\n end\n return r\n end",
"def artesano_params\n params.require(:artesano).permit(:tipo, :nombre, :exp, :region, :t_taller, :t_artesania, :desc, :logo, :foto, :banner1, :banner2, :banner3, :banner4)\n end",
"def recaudacion_params\n params.require(:recaudacion).permit(:fechar, :horar, :nromaquinar, :rellenoini, :valorr, :monedafr, :rellenofin, :totalr, :totalfr)\n end",
"def pagamento_aceito_params\n params.require(:pagamento_aceito).permit(:cheque, :credito-amer-expre, :credito-diners, :credito-goodcard, :credito-hipercard, :credito-mastercard, :credito-verdecard, :credito-visa, :credito-banricompras, :dinheiro, :debito-banricompras, :debito-bo, :debito-mastercard, :debito-visa, :vale-alelo, :vale-sodexo, :vale-ticket, :vale-valecard, :vale-verocard, :vale-srsmart, :references)\n end",
"def tipo_trabajador_params\n params.require(:tipo_trabajador).permit(:tpt_descripcion)\n end",
"def setup_aftinfo\n @afrate = @acts[1] || 3\n @afopac = @acts[2] || 20\n end",
"def setup_aftinfo\n @afrate = @acts[1] || 3\n @afopac = @acts[2] || 20\n end",
"def renomear_params\n params.require(:renomear).permit(:tipo, :assunto, :data, :cprod, :sem_cprod, :mais_de_um_processo, :arquivo)\n end",
"def tarea_params\n params.require(:tarea).permit(:Nombre, :descripcion, :importancia, :fecha)\n end",
"def mostrar_opciones_tutoria\n acciones = ['Peticiones pendientes de aceptar', 'Cola alumnos', 'Borrar tutoría', 'Volver']\n menu = MenuInlineTelegram.crear(acciones)\n texto = \"Tutoría elegida #{@tutoria.fecha}. Elija que desea hacer:\"\n @@bot.api.edit_message_text(chat_id: @ultimo_mensaje.id_chat, message_id: @ultimo_mensaje.id_mensaje, text: texto, reply_markup: menu, parse_mode: 'Markdown')\n end",
"def asignatura_params\n params.require(:asignatura).permit(:name, :lectiva, :orden)\n end",
"def gaceta\n %Q(gaceta #{publicacion} del #{I18n.l publicacion_fecha})\n end",
"def traslado_params\n params.require(:traslado).permit(:carroza_de_instalacion, :carroza_funeral, :carroza_para_flores, :vehiculo_acompanamiento, :capacidad_pasajeros)\n end",
"def assinatura_params\n params.require(:assinatura).permit(:imei, :preco_anual, :num_parcelas, :modelo_id, :cliente_id,\n :data_emisao, :data_vencimento, :status)\n end",
"def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def acces_nome\r\n @nome\r\n end",
"def terreno\n\t\treturn @terreno*@cantidad\n\tend",
"def reuniao_params\n params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)\n end",
"def save_atributos\n\n unless @pre.nil?\n @pre[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@pre[:valor][key],campo:'precio')\n end\n end\n\n unless @compraAtributo.nil?\n @compraAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@compraAtributo[:valor][key],campo:'compra')\n end\n end\n\n unless @polizaAtributo.nil?\n @polizaAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@polizaAtributo[:valor][key],campo:'poliza')\n end\n end\n\n unless @tipovehiculoAtributo.nil?\n @tipovehiculoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@tipovehiculoAtributo[:valor][key],campo:'tipovehiculo')\n end\n end\n\n unless @tipoproductoAtributo.nil?\n @tipoproductoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@tipoproductoAtributo[:valor][key],campo:'tipoproducto')\n end \n end\n \n unless @aseguradoraAtributo.nil?\n @aseguradoraAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@aseguradoraAtributo[:valor][key],campo:'aseguradora')\n end\n end\n \n unless @destacadoAtributo.nil?\n @destacadoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@destacadoAtributo[:valor][key],campo:'destacado')\n end\n end\n\n unless @vigenciaAtributo.nil?\n @vigenciaAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@vigenciaAtributo[:valor][key],campo:'vigencia')\n end\n end\n\n end",
"def tb_avaliacao_params\n params.require(:tb_avaliacao).permit(:id,\n tb_respostas_attributes: %i(id tb_pergunta_id nota obs))\n end",
"def ativo_params\n params.require(type.underscore.to_sym).permit(:name, :curto_prazo, :type, :account_id, :longo_prazo, :investimento, :imobilizado, :intangivel, :natureza_conta)\n end"
] | [
"0.5674164",
"0.55173147",
"0.5446915",
"0.5426774",
"0.540927",
"0.53601927",
"0.5344993",
"0.5312879",
"0.52759033",
"0.52449137",
"0.5227873",
"0.5226284",
"0.51891553",
"0.5179375",
"0.516617",
"0.51629794",
"0.51572335",
"0.51319295",
"0.5114985",
"0.5087379",
"0.5071145",
"0.5070499",
"0.50697273",
"0.5067363",
"0.50642896",
"0.50573575",
"0.5055809",
"0.5048247",
"0.50419694",
"0.503812",
"0.5025411",
"0.5021057",
"0.50204104",
"0.50203526",
"0.501867",
"0.5017783",
"0.5014232",
"0.5008326",
"0.50039494",
"0.4995084",
"0.49912593",
"0.4985271",
"0.49832436",
"0.49703714",
"0.49697042",
"0.49696302",
"0.49679402",
"0.49645203",
"0.49609518",
"0.49507976",
"0.49502924",
"0.49471673",
"0.49461785",
"0.4941944",
"0.49400523",
"0.49369496",
"0.49292228",
"0.4926279",
"0.49250612",
"0.49148962",
"0.49147275",
"0.49139893",
"0.49110374",
"0.49042422",
"0.49019107",
"0.48971415",
"0.48828205",
"0.48784804",
"0.48759145",
"0.48652294",
"0.48572293",
"0.48549518",
"0.48500448",
"0.48416406",
"0.48397243",
"0.48383534",
"0.4836492",
"0.48362762",
"0.48286983",
"0.4825896",
"0.48244372",
"0.48232886",
"0.48218223",
"0.48180965",
"0.48171288",
"0.4805844",
"0.4805844",
"0.48052412",
"0.48040247",
"0.4799389",
"0.47948894",
"0.47930288",
"0.47869986",
"0.47863156",
"0.4786025",
"0.47853142",
"0.478449",
"0.47820774",
"0.4780854",
"0.47805518",
"0.47789955"
] | 0.0 | -1 |
GET /employees_courses GET /employees_courses.json | def index
@employees_courses = EmployeesCourse.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def index\n\t\t@courses = @teacher.courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def get_course_of_instructor\n instructor_id = params[:instructor_id]\n\n course_ids = if instructor_id.blank?\n []\n else\n Course.where(:user_id => instructor_id).map(&:id).map(&:to_s)\n end\n\n render json: {:course_ids => course_ids}\n end",
"def index\n @courses = Course.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses}\n end\n end",
"def get_courses\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_courses'\n\tend",
"def courses\n request(COURSES_URL, {}, 'GET').map do |course|\n Course.new(self, course)\n end\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def courses\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = nil\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end",
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def get_courses(opts = {})\n data, _status_code, _headers = get_courses_with_http_info(opts)\n data\n end",
"def get_course_enrollments(course_id)\n open_canvas_http\n\n request = Net::HTTP::Get.new(\n \"/api/v1/courses/#{course_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = @canvas_http.request(request)\n info = JSON.parse response.body\n\n info\n end",
"def all_courses\n [\n {\n id: 1,\n title: 'The Complete Node.js Developer Course',\n author: 'Andrew Mead, Rob Percival',\n description: 'Learn Node.js by building real-world applications with Node, Express, MongoDB, Mocha, and more!',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs/'\n },\n {\n id: 2,\n title: 'Node.js, Express & MongoDB Dev to Deployment',\n author: 'Brad Traversy',\n description: 'Learn by example building & deploying real-world Node.js applications from absolute scratch',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs-express-mongodb/'\n },\n {\n id: 3,\n title: 'JavaScript: Understanding The Weird Parts',\n author: 'Anthony Alicea',\n description: 'An advanced JavaScript course for everyone! Scope, closures, prototypes, this, build your own framework, and more.',\n topic: 'JavaScript',\n url: 'https://codingthesmartway.com/courses/understand-javascript/'\n }\n ]\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def index\n @assessment_courses = AssessmentCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessment_courses }\n end\n end",
"def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def index\n @enrolleds = Enrolled.all\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolleds }\n end\n end",
"def index\n @courses = Courses.all\n end",
"def list_courses(courses_collection)\n courses_collection.each do |course|\n\n end\n end",
"def index\n @given_courses = GivenCourse.all\n end",
"def index\n # Check for filters\n @courses = Course.getCourseInformation(params[:dept],params[:course])\n @page_title = \"Browse Courses\"\n respond_to do |format|\n format.html\n format.json {render json: @courses }\n end\n end",
"def index\n @enrolled_courses = EnrolledCourse.all\n end",
"def index\n\t\t@courses = Course.all\n\tend",
"def course\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = Course.where({id: params[:id]}).first\n\n @course_projects = $selected_course.projects.collect{ |project|\n {\n project_name: project.name,\n team_names: project.teams.reduce(''){|names, team| names + team.name + ', '}[0..-3],\n due: project.due.in_time_zone('Eastern Time (US & Canada)').strftime('%Y-%m-%d %I:%M:%S %p')\n }\n }\n\n render :template => \"home/index\"\n end",
"def index\n begin\n case\n when params[:semester_id]\n @courses = Semester.find(params[:semester_id]).courses\n when params[:teacher_id]\n check_token(params[:teacher_id], params[:token], true)\n @courses = User.find(params[:teacher_id]).real_teaching_courses\n when params[:student_id]\n check_token(params[:student_id])\n @courses = Course.none\n User.find(params[:student_id]).participations.each do |participation|\n @courses <<= participation.course if ROLE_STUDENT == participation.role\n end\n when params[:assistant_id]\n check_token(params[:assistant_id])\n @courses = Course.none\n User.find(params[:assistant_id]).participations.each do |participation|\n @courses <<= participation.course if ROLE_ASSISTANT == participation.role\n end\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n end",
"def index\n @courses = Course.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => Course.all }\n end\n end",
"def get_course_enrollments(course_id)\n request = Net::HTTP::Get.new(\n \"/api/v1/courses/#{course_id}/enrollments?per_page=100&access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n info = nil\n if response.code == '200'\n info = get_all_from_pagination(response)\n else\n raise \"Course #{course_id} does not exist. #{response.body}\"\n end\n\n info\n end",
"def index\n @people_courses = PeopleCourse.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end",
"def course\n if validateurl({\"name\": params[:name], \"semester\": params[:semester], \"coursename\": params[:course]})\n @semester = params[:semester]\n @coursename = params[:course]\n courseid = Course.select(\"id\").where(\"name = '\" + @coursename + \"' AND semester = '\" + @semester + \"'\" ).ids[0].to_s\n @students = ActiveRecord::Base.connection.execute(\"SELECT grades.grade, students.name FROM grades, students WHERE '\" + courseid.to_s + \"' = grades.course_id AND '\" + @semester.to_s + \"' = grades.semester AND students.id = grades.student_id\")\n end\n end",
"def employees_course_params\n params[:employees_course]\n end",
"def index\r\n @courses = Course.all\r\n end",
"def courses\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @courses = Course.all\n\n end",
"def find_courses collection, course_ids\n course_ids = [course_ids] if course_ids.is_a?(String)\n\n validate_course_ids course_ids\n\n # query db\n if course_ids.length > 1\n courses = collection.find(\n { course_id: { '$in' => course_ids } },\n { fields: { _id:0, 'sections._id' => 0 } }\n )\n else\n courses = collection.find(\n { course_id: course_ids[0] },\n { fields: { _id:0, 'sections._id' => 0 } }\n )\n end\n\n # to_a, map is more memory efficient\n courses = courses.map { |e| e }\n\n # check if found\n if courses.empty?\n s = course_ids.length > 1 ? 's' : ''\n halt 404, {\n error_code: 404,\n message: \"Course#{s} with course_id#{s} #{course_ids.join(',')} not found!\",\n available_courses: \"http://api.umd.io/v0/courses\",\n docs: \"http://umd.io/courses/\"\n }.to_json\n end\n\n courses\n end",
"def courses_all\n call_path = \"courses/all\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def index\n @person_courses = PersonCourse.all\n end",
"def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def index\n if current_user.is_a? Teacher\n @courses = Course.for_semester(@semester).includes(:semester, :teaching_assignments).page(params[:page]).order('name ASC')\n else\n @courses = Course.for_semester(@semester).includes(:semester).page(params[:page]).order('name ASC')\n end\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def set_employees_course\n @employees_course = EmployeesCourse.find(params[:id])\n end",
"def show_course\n\t\t@course = Course.find(params[:course_id])\n\t\trender json: @course\n\tend",
"def courses_json\n raise Exceptions::EducatorNotAuthorized unless current_educator.districtwide_access\n courses = Course.all\n .where(school_id: @school.id)\n .includes(sections: :students)\n\n courses_json = courses.as_json({\n :only => [:id, :course_number, :course_description],\n :include => {\n :sections => {\n :only => [:id, :section_number, :term_local_id, :schedule, :room_number],\n :include => {\n :students => {\n :only => [:id, :grade, :date_of_birth],\n :include => {\n :school => {\n :only => [:id, :name]\n }\n }\n }\n }\n }\n }\n })\n\n render json: {\n courses: courses_json,\n school: @school.as_json(only: [:id, :name])\n }\n end",
"def show\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n @student = User.find(session[:user_id])\n @courses_enrolled = @student.courses\n end",
"def index\n @courses = Course.all.includes(:translations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def set_employee_course\n @employee_course = EmployeeCourse.includes(:employee_chapters, course: [:employee_courses, chapters: [:lessons, :exam]]).find(params[:id])\n end",
"def index\n @study_courses = StudyCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_courses }\n end\n end",
"def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @course_roles }\n end\n end",
"def index\n\t\t@course = Course.find(params[:course_id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"def index\n @path_courses = PathCourse.all\n end",
"def courses(institution, pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institution/#{institution}/Courses.json\", options)\n end",
"def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end",
"def assignments\n\t\t@course = Course.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def index\n @user_courses = UserCourse.all\n end",
"def show\n render json: @course\n end",
"def get_courses (subdomain,subaccount_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/accounts/#{subaccount_id}/courses\"\n #needs to change for pageviews include[]=teachers&include[]=total_students&state[]=available&state[]=completed\"\n )\n end",
"def index\n \tif current_user && current_user.username.eql?(\"admin\")\n @courses = Course.all\n elsif current_user\n\t @lista = Profesor.joins(:course).where(:user_id => session[:user_id])\t\n\t list = Array.new\n\t @lista.each do |l|\n\t \tlist << l.course_id\n end\n\t @courses = Course.find(list)\n\tend\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> @courses }\n end\n end",
"def employees\n @course_class = CourseClass.find(params[:id])\n render '_form_add_employees'\n end",
"def index\n @curriculum_courses = CurriculumCourse.all\n end",
"def show\n @lab_course = LabCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_course }\n end\n end",
"def list_courses \r\n courses = Subject.find(params[:s]).courses rescue render_return\r\n render_return if courses.empty? or !logged_in_user.see_course?(courses.first)\r\n render_p 'course_display/list_courses',{'courses'=>courses,'caller'=>params[:caller]}\r\n end",
"def index \n @courses = Course.all\n puts 'Courses-Index -mashal is super helpful'\n end",
"def index\n @first_aid_courses = FirstAidCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @first_aid_courses }\n end\n end",
"def show_enrolled_courses\n EnrolledCourse.where(student: self).order(:course_id).map(&:course)\n end",
"def index\n @current_user = User.find_by_id(session[:user_id])\n @courses = @current_user.courses.paginate page: params[:page], order: 'created_at asc', per_page: 25\n if @current_user.courses.empty?\n redirect_to new_course_url, notice: \"You Have No Courses Yet\"\n return\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n #@courses = @curriculum.courses\n\n @courses = ScopedCourse.where(:curriculum_id => @curriculum.id)\n .joins(:course_descriptions)\n .where([\"course_descriptions.locale = ?\", I18n.locale]).includes(:strict_prereqs)\n# .joins(<<-SQL\n# INNER JOIN course_descriptions\n# ON competence_nodes.abstract_course_id = course_descriptions.abstract_course_id\n# SQL\n# )\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n render :json => @courses.select(<<-SQL\n competence_nodes.id,\n competence_nodes.course_code,\n course_descriptions.name AS translated_name\n SQL\n ).to_json(:methods => :strict_prereq_ids, :root => true)\n end\n end\n end",
"def courses\n @learn_courses\n end",
"def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end",
"def course(institution, course, kismode, recursive=true, options={})\n response = self.class.get(\"/Institution/#{institution}/Course/#{course}/#{kismode}.json\", options)\n if recursive\n response.merge!({:accreditations => course_accreditations(institution, course, kismode)})\n response.merge!({:stages => course_stages(institution, course, kismode)})\n response.merge!({:statistics => course_statistics(institution, course, kismode)})\n end\n response.parsed_response\n end"
] | [
"0.7282056",
"0.7093469",
"0.6999676",
"0.6976667",
"0.68742204",
"0.68742204",
"0.6874116",
"0.6848213",
"0.68420035",
"0.68248683",
"0.68147564",
"0.68008804",
"0.6742614",
"0.6714613",
"0.66907656",
"0.66861355",
"0.66812384",
"0.66668737",
"0.66541517",
"0.6651596",
"0.66453946",
"0.6569583",
"0.6553084",
"0.6539076",
"0.6527655",
"0.65212613",
"0.65193623",
"0.6514335",
"0.6488843",
"0.64722455",
"0.64622706",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64560103",
"0.64533645",
"0.6449526",
"0.6431417",
"0.6429435",
"0.64292634",
"0.6404462",
"0.63988155",
"0.6398015",
"0.63973844",
"0.6397296",
"0.6389423",
"0.63755846",
"0.6374391",
"0.6373511",
"0.6371439",
"0.636322",
"0.635232",
"0.632235",
"0.63216275",
"0.6320984",
"0.63198555",
"0.6296751",
"0.62870073",
"0.6257718",
"0.625457",
"0.6251192",
"0.6250615",
"0.622367",
"0.62231827",
"0.6219519",
"0.6216879",
"0.6213954",
"0.6208119",
"0.6207557",
"0.61945504",
"0.61936104",
"0.6163559",
"0.615659",
"0.6153004",
"0.61451775",
"0.6144204",
"0.6142916",
"0.6129348",
"0.6128553"
] | 0.73660785 | 0 |
GET /employees_courses/1 GET /employees_courses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def index\n @employees_courses = EmployeesCourse.all\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def index\n\t\t@courses = @teacher.courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end",
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses}\n end\n end",
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def get_course_of_instructor\n instructor_id = params[:instructor_id]\n\n course_ids = if instructor_id.blank?\n []\n else\n Course.where(:user_id => instructor_id).map(&:id).map(&:to_s)\n end\n\n render json: {:course_ids => course_ids}\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def index\n @assessment_courses = AssessmentCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessment_courses }\n end\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def get_courses\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_courses'\n\tend",
"def show_course\n\t\t@course = Course.find(params[:course_id])\n\t\trender json: @course\n\tend",
"def index\n @enrolleds = Enrolled.all\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolleds }\n end\n end",
"def show\n @lab_course = LabCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_course }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n # Check for filters\n @courses = Course.getCourseInformation(params[:dept],params[:course])\n @page_title = \"Browse Courses\"\n respond_to do |format|\n format.html\n format.json {render json: @courses }\n end\n end",
"def index\n @courses = Course.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => Course.all }\n end\n end",
"def index\n @courses = Courses.all\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def index\n @study_courses = StudyCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_courses }\n end\n end",
"def show\n render json: @course\n end",
"def show\n render json: @course, status: :found\n end",
"def courses\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = nil\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end",
"def set_employees_course\n @employees_course = EmployeesCourse.find(params[:id])\n end",
"def show\n @course = Course.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end",
"def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def index\n @first_aid_courses = FirstAidCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @first_aid_courses }\n end\n end",
"def course\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = Course.where({id: params[:id]}).first\n\n @course_projects = $selected_course.projects.collect{ |project|\n {\n project_name: project.name,\n team_names: project.teams.reduce(''){|names, team| names + team.name + ', '}[0..-3],\n due: project.due.in_time_zone('Eastern Time (US & Canada)').strftime('%Y-%m-%d %I:%M:%S %p')\n }\n }\n\n render :template => \"home/index\"\n end",
"def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end",
"def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end",
"def course\n if validateurl({\"name\": params[:name], \"semester\": params[:semester], \"coursename\": params[:course]})\n @semester = params[:semester]\n @coursename = params[:course]\n courseid = Course.select(\"id\").where(\"name = '\" + @coursename + \"' AND semester = '\" + @semester + \"'\" ).ids[0].to_s\n @students = ActiveRecord::Base.connection.execute(\"SELECT grades.grade, students.name FROM grades, students WHERE '\" + courseid.to_s + \"' = grades.course_id AND '\" + @semester.to_s + \"' = grades.semester AND students.id = grades.student_id\")\n end\n end",
"def index\n @people_courses = PeopleCourse.all\n end",
"def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end",
"def index\n @person_courses = PersonCourse.all\n end",
"def index\n begin\n case\n when params[:semester_id]\n @courses = Semester.find(params[:semester_id]).courses\n when params[:teacher_id]\n check_token(params[:teacher_id], params[:token], true)\n @courses = User.find(params[:teacher_id]).real_teaching_courses\n when params[:student_id]\n check_token(params[:student_id])\n @courses = Course.none\n User.find(params[:student_id]).participations.each do |participation|\n @courses <<= participation.course if ROLE_STUDENT == participation.role\n end\n when params[:assistant_id]\n check_token(params[:assistant_id])\n @courses = Course.none\n User.find(params[:assistant_id]).participations.each do |participation|\n @courses <<= participation.course if ROLE_ASSISTANT == participation.role\n end\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n end",
"def index\n if current_user.is_a? Teacher\n @courses = Course.for_semester(@semester).includes(:semester, :teaching_assignments).page(params[:page]).order('name ASC')\n else\n @courses = Course.for_semester(@semester).includes(:semester).page(params[:page]).order('name ASC')\n end\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def employees\n @course_class = CourseClass.find(params[:id])\n render '_form_add_employees'\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def assignments\n\t\t@course = Course.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def show\n #@course = Course.find(params[:course_id])\n @course_lesson = CourseLesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_lesson }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @course_roles }\n end\n end",
"def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def set_employee_course\n @employee_course = EmployeeCourse.includes(:employee_chapters, course: [:employee_courses, chapters: [:lessons, :exam]]).find(params[:id])\n end",
"def show\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment_course }\n end\n end",
"def index\n @given_courses = GivenCourse.all\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def show\n @lab = Lab.find(params[:id])\n @lab_student = Student.where(\"cname = ?\",@lab.course.name)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab }\n end\n end",
"def show\n render json: course\n end",
"def index\n # puts \"params[:course][:id] is: #{params[:course][:id]}\"\n # @course = Course.find_by_id(params[:course][:id])\n# @students = @course.students\n end",
"def index\n\t\t@courses = Course.all\n\tend",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def show\r\n @course = Course.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @course }\r\n\r\n end\r\n end",
"def employees_course_params\n params[:employees_course]\n end",
"def index\n\t\t@course = Course.find(params[:course_id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"def get_course_enrollments(course_id)\n open_canvas_http\n\n request = Net::HTTP::Get.new(\n \"/api/v1/courses/#{course_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = @canvas_http.request(request)\n info = JSON.parse response.body\n\n info\n end",
"def show\n @course_programme = CourseProgramme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_programme }\n end\n end",
"def index\n @courses = Course.all.includes(:translations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\r\n @courses = Course.all\r\n end",
"def all_courses\n [\n {\n id: 1,\n title: 'The Complete Node.js Developer Course',\n author: 'Andrew Mead, Rob Percival',\n description: 'Learn Node.js by building real-world applications with Node, Express, MongoDB, Mocha, and more!',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs/'\n },\n {\n id: 2,\n title: 'Node.js, Express & MongoDB Dev to Deployment',\n author: 'Brad Traversy',\n description: 'Learn by example building & deploying real-world Node.js applications from absolute scratch',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs-express-mongodb/'\n },\n {\n id: 3,\n title: 'JavaScript: Understanding The Weird Parts',\n author: 'Anthony Alicea',\n description: 'An advanced JavaScript course for everyone! Scope, closures, prototypes, this, build your own framework, and more.',\n topic: 'JavaScript',\n url: 'https://codingthesmartway.com/courses/understand-javascript/'\n }\n ]\n end",
"def index\n @enrolled_courses = EnrolledCourse.all\n end",
"def index\n \tif current_user && current_user.username.eql?(\"admin\")\n @courses = Course.all\n elsif current_user\n\t @lista = Profesor.joins(:course).where(:user_id => session[:user_id])\t\n\t list = Array.new\n\t @lista.each do |l|\n\t \tlist << l.course_id\n end\n\t @courses = Course.find(list)\n\tend\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> @courses }\n end\n end",
"def index\n #@courses = @curriculum.courses\n\n @courses = ScopedCourse.where(:curriculum_id => @curriculum.id)\n .joins(:course_descriptions)\n .where([\"course_descriptions.locale = ?\", I18n.locale]).includes(:strict_prereqs)\n# .joins(<<-SQL\n# INNER JOIN course_descriptions\n# ON competence_nodes.abstract_course_id = course_descriptions.abstract_course_id\n# SQL\n# )\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n render :json => @courses.select(<<-SQL\n competence_nodes.id,\n competence_nodes.course_code,\n course_descriptions.name AS translated_name\n SQL\n ).to_json(:methods => :strict_prereq_ids, :root => true)\n end\n end\n end",
"def index\n @courses = Course.all\n\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end",
"def courses\n request(COURSES_URL, {}, 'GET').map do |course|\n Course.new(self, course)\n end\n end"
] | [
"0.7301036",
"0.7217574",
"0.70010316",
"0.6949505",
"0.691728",
"0.69040585",
"0.69040585",
"0.68803537",
"0.68727565",
"0.6860377",
"0.6775294",
"0.67416734",
"0.67115134",
"0.6642404",
"0.66336876",
"0.66256374",
"0.66235274",
"0.66015244",
"0.6587697",
"0.65312487",
"0.6463678",
"0.64531636",
"0.6436482",
"0.64217365",
"0.6416893",
"0.6414984",
"0.64087385",
"0.64025164",
"0.6401319",
"0.6401319",
"0.6401319",
"0.6401319",
"0.6401319",
"0.6401319",
"0.6399857",
"0.6393911",
"0.63925934",
"0.63917613",
"0.6374636",
"0.6373137",
"0.6372203",
"0.636733",
"0.63661224",
"0.6362627",
"0.6359094",
"0.6352199",
"0.63513774",
"0.635097",
"0.63497955",
"0.63461727",
"0.6334417",
"0.6331042",
"0.63300025",
"0.63276225",
"0.63232183",
"0.6315232",
"0.63030565",
"0.6297331",
"0.6294326",
"0.62856454",
"0.62830776",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.628271",
"0.62755054",
"0.62712103",
"0.6268201",
"0.62560016",
"0.6255188",
"0.6252125",
"0.62508017",
"0.6242215",
"0.62421525",
"0.62350535",
"0.6231448",
"0.62292886",
"0.62270254",
"0.622233",
"0.62122476"
] | 0.0 | -1 |
POST /employees_courses POST /employees_courses.json | def create
@employees_course = EmployeesCourse.new(employees_course_params)
respond_to do |format|
if @employees_course.save
format.html { redirect_to @employees_course, notice: 'Employees course was successfully created.' }
format.json { render :show, status: :created, location: @employees_course }
else
format.html { render :new }
format.json { render json: @employees_course.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # render plain: params[:courses].inspect\n @courses = Courses.new(courses_params)\n\n respond_to do |format|\n if @courses.save\n format.html { redirect_to @courses, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @courses }\n else\n format.html { render :new }\n format.json { render json: @courses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :manage, Course\n @course = Course.new(course_params)\n @course.course_sections.each do |course_section|\n course_section.name = \"#{@course.name} #{course_section.grade_section.name}\"\n end\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(courses_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n course = Course.new(course_params)\n\n if course.save\n render json: course, status: :created\n else\n render json: course.errors, status: :unprocessable_entity\n end\n end",
"def create\n \n @course = current_user.courses.build(course_params)\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enrolled = Enrolled.new(:student_id => current_student.student_id, :course_id => params[:course_id])\n\n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully created.' }\n format.json { render json: @enrolled, status: :created, location: @enrolled }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people_course = PeopleCourse.new(people_course_params)\n\n respond_to do |format|\n if @people_course.save\n format.html { redirect_to @people_course, notice: 'People course was successfully created.' }\n format.json { render :show, status: :created, location: @people_course }\n else\n format.html { render :new }\n format.json { render json: @people_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @courses_teacher = CoursesTeacher.new(courses_teacher_params)\n\n respond_to do |format|\n if @courses_teacher.save\n format.html { redirect_to @courses_teacher, notice: 'Courses teacher was successfully created.' }\n format.json { render :show, status: :created, location: @courses_teacher }\n else\n format.html { render :new }\n format.json { render json: @courses_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(params)\n response = self.class.post(\n '/webservice/rest/server.php',\n {\n :query => query_hash('core_course_create_courses', token),\n :body => {\n :courses => {\n '0' => {\n :fullname => params[:full_name],\n :shortname => params[:short_name],\n :categoryid => params[:parent_category],\n :idnumber => params[:idnumber]\n }\n }\n }\n }.merge(query_options)\n )\n check_for_errors(response)\n response.parsed_response.first\n end",
"def employee_course_params\n params.require(:employee_course).permit(:employee_id, :course_id, :end, :status, :attempt_number, :cancel_url, :redirect_url)\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @semester ? semester_course_path(@semester, @course) : @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end",
"def new\n @course = Course.new\n 2.times do\n course=@course.students.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def create\n @course = Course.new(course_params)\n @course.user_id = @current_user.user_id\n respond_to do |format|\n #instructor_exists\n if !course_name_exists? and professor_exist? and @course.save\n current_user.courses << @course\n format.html { redirect_to @course, notice: \"Successfully added course #{@course.course_name}\" }\n format.json { render :show, status: :created, location: @course }\n else\n if @course.errors[:message].empty?\n @course.errors.add(:course_name, \"Course name exists\")\n end\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tcourse = Course.new(course_params)\n\t\tif course.save\n\n\t\t params[:course][\"major_id\"].each do |major_id|\n\t if !major_id.empty?\n\t course.major << Major.find(major_id)\n\t end\n\t end\n\n\t params[:course][\"minor_id\"].each do |minor_id|\n\t if !minor_id.empty?\n\t course.minor << Minor.find(minor_id)\n\t end\n\t end\n\n\t params[:course][\"concentration_id\"].each do |concentration_id|\n\t if !concentration_id.empty?\n\t course.concentration << Concentration.find(concentration_id)\n\t end\n\t end\n\n\t params[:course][\"distribution_id\"].each do |distribution_id|\n\t if !distribution_id.empty?\n\t course.distribution << Distribution.find(distribution_id)\n\t end\n\t end\n\n\t\t\tredirect_to '/courses'\n\t\telse\n\t\t\tflash[:danger] = \"The form you submitted is invalid.\"\n\t\t\tredirect_to '/courses/new'\n\t\tend\n\tend",
"def create\n @enrollment = Enrollment.new(instructor: true)\n @course = Course.new(course_params)\n @course.enrollments << @enrollment\n current_user.enrollments << @enrollment\n\n respond_to do |format|\n if @enrollment.save and @course.save and current_user.save\n format.html { redirect_to root_url, notice: 'Course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n professor = Professor.new(professor_params)\n \n if professor.save\n render json: professor.to_json(include: :courses)\n else\n render :json => { :errors => professor.errors }, :status => 422\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to admin_courses_path, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n @course.save\n render_jsonapi_response(@course)\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n #section_chunks = get_chunks(params)\n sections = JSON.parse(params['sections'])\n\n # The course has been created by the signed-in user.\n @course.user_id = current_user.id\n respond_to do |format|\n if @course.save\n # Save the course's subcomponents to the course.\n update_section_chunks(sections)\n\n format.html { redirect_to @course }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render new_course_path }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employees_course_params\n params[:employees_course]\n end",
"def create\n @enrolled_course = EnrolledCourse.new(enrolled_course_params)\n\n respond_to do |format|\n if @enrolled_course.save\n format.html { redirect_to courses_path, notice: 'Enrolled course was successfully created.' }\n format.json { render :show, status: :created, location: @enrolled_course }\n else\n format.html { redirect_to new_enrolled_course_path, notice: 'Both student and class should be selected.' }\n format.json { render json: @enrolled_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to [:admin, @course], :notice => 'Course was successfully created.' }\n format.json { render :json => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n respond_to do |format|\n if @course.save\n\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n # Add the course just created to this student's courses, better use the drop down list \n if params[:course] != nil then\n @student.courses << Course.find(params[:course][:id])\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course ' + @course.course_id + ' was successfully created!' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @course = Course.new(course_params)\n\n CourseBuilder.build do |builder|\n builder.set_code(course_params['code'])\n builder.set_title(course_params['title'])\n builder.set_instructor(course_params['instructor'])\n builder.set_semester(course_params['semester'])\n builder.set_credit(course_params['credit'])\n builder.set_room(course_params['room'])\n builder.set_evaluation(course_params['midterm'], course_params['final'], course_params['assignment'], course_params['project'])\n\n @course = builder.course\n end\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Course was successfully created.' }\n format.json { render :index, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def courses_all\n call_path = \"courses/all\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_path(), notice: 'El curso fue exitosamente creado.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { redirect_to new_course_path, notice: \"Debe escribir por lo menos el nombre del curso para crearlo.\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @given_course = GivenCourse.new(given_course_params)\n\n respond_to do |format|\n if @given_course.save\n format.html { redirect_to @given_course, notice: 'Given course was successfully created.' }\n format.json { render :show, status: :created, location: @given_course }\n else\n format.html { render :new }\n format.json { render json: @given_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person_course = PersonCourse.new(person_course_params)\n\n respond_to do |format|\n if @person_course.save\n format.html { redirect_to @person_course, notice: 'Person course was successfully created.' }\n format.json { render :show, status: :created, location: @person_course }\n else\n format.html { render :new }\n format.json { render json: @person_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Curso creado satisfactoriamente' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_course_data(course_data)\n # ForceLocale- course override the user’s locale preference\n # Path- root path to use for this course offering’s course content\n # if your back-end service has path enforcement set on for\n # new org units, leave this property as an empty string\n # Define a valid, empty payload and merge! with the user_data. Print it.\n # can be an issue if more than one course template associated with\n # a course and the last course template parent to a course cannot be deleted\n payload = {\n 'Name' => '', # String\n 'Code' => 'off_SEMESTERCODE_STARNUM', # String\n 'Path' => '', # String\n 'CourseTemplateId' => 99_989, # number: D2L_ID\n 'SemesterId' => nil, # number: D2L_ID | nil\n 'StartDate' => nil, # String: UTCDateTime | nil\n 'EndDate' => nil, # String: UTCDateTime | nil\n 'LocaleId' => nil, # number: D2L_ID | nil\n 'ForceLocale' => false, # bool\n 'ShowAddressBook' => false # bool\n }.merge!(course_data)\n check_course_data_validity(payload)\n # ap payload\n # requires: CreateCourseOffering JSON block\n path = \"/d2l/api/lp/#{$lp_ver}/courses/\"\n _post(path, payload)\n # puts '[+] Course creation completed successfully'.green\nend",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course added. Warning no Instructor assigned. Go to the manage user history tab and add instructor' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to admin_course_url(@course), notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to static_pages_admin_url, notice: 'Course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n \n format.html { redirect_to @course, notice: 'course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n ppp @course.errors.full_messages\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def course_selected\n courses = params['courses']\n employee = current_user.role\n courses.each do |course|\n Choice.create(employee_id: employee.id, course_id: course, state: 0)\n end\n redirect_to users_me_path\n end",
"def employees\n @course_class = CourseClass.find(params[:id])\n render '_form_add_employees'\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Curso criado com sucesso.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_course\r\n @course = Course.create(fast_course_params)\r\n respond_to do |format|\r\n if @course.save\r\n format.html { redirect_to courses_path, notice: 'Course was successfully created.' }\r\n format.json { render courses_path, status: :created, location: @course }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @course.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, :notice=> 'Curso creado' }\n format.json { render :json=> @course, :status=> :created, :location=> @course }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json=> @course.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def create\n course_name = params[:text].to_s\n course = Course.create(name: course_name)\n CourseInstructor.create(course: course, instructor: current_user.instructor)\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end",
"def new\n @course = Course.new\n 1.times { @course.lessons.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def create\n @course = Course.find(params[:course_id])\n @enrollment = @course.enrollments.create(params[:enrollment])\n\n respond_to do |format|\n if @enrollment.save\n format.html { render :template => 'enrollments/success', notice: 'ya' }\n format.json { render json: @enrollment, status: :created, location: @enrollment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end",
"def create\n @course = Course.new(course_params)\n @current_semester = Semester.find_by_active(1)\n\n respond_to do |format|\n if Course.where(:name => @course.name).blank?\n puts 'Course doest not exist'\n if @course.save && @current_semester.courses << @course\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n else\n puts @course.name\n puts 'Course exists'\n @existing_course = Course.find_by_name(@course.name)\n if @current_semester.courses << @existing_course\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @employees_courses = EmployeesCourse.all\n end",
"def create\n @user_course = UserCourse.new(user_course_params)\n respond_to do |format|\n if @user_course.save\n format.html { redirect_to @user_course, notice: 'User course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_course }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n @course.user = current_user\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_course = Admin::Course.new(admin_course_params)\n\n respond_to do |format|\n if @admin_course.save\n format.html { redirect_to @admin_course, notice: t('crud.created_successfully!', name: Admin::Course.model_name.human) }\n format.json { render :show, status: :created, location: @admin_course }\n else\n format.html { render :new }\n format.json { render json: @admin_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n # Must be POST request to create course\n return unless request.post?\n\n # Receives parameters from the course creation page\n course_name = get_param(:name)\n course_credits = get_param(:credits, false)\n course_teaching_unit = get_param(:teaching_unit)\n corse_expected_time = get_param(:expected_time)\n\n course_name = course_name.strip\n\n # Retrieves current user and checks if it is a supervisor\n user = get_logged_user()\n\n if !user\n @status_code = 401\n raise 'Not logged in'\n end\n if !user.is? \"supervisor\"\n @status_code = 403\n raise 'User cannot create course'\n end\n\n # Create a course\n course = Course.new({\n :name => course_name,\n :credits => course_credits,\n :teaching_unit => course_teaching_unit,\n :expected_time => course_expected_time\n })\n\n base_group = Group.create!({\n :name => \"Grade\",\n :min_credits => nil,\n :min_subjects => nil\n })\n\n course.group = base_group\n\n if !course.valid?\n @status_code = 400\n base_group.destroy\n raise 'Invalid course data'\n end\n\n # Save new course\n course.save\n rescue Exception => e\n @status_code = 500 if !@status_code\n @response[:status] = 'error'\n @response[:error] = \"#{e}\"\n else\n @status_code = 201\n @response[:status] = 'success'\n end\n\n render :json => @response, :status => @status_code\n end",
"def course_params\n params.require(:course).permit(:name, :number, :description, :grade_level_id, :academic_year_id, :academic_term_id, :employee_id,\n {:academic_term_ids => []},\n {:course_sections_attributes => [:id, :name, :grade_section_id, :instructor_id, :_destroy]},\n {:course_texts_attributes => [:id, :book_title_id, :order_no, :_destroy]})\n end",
"def create\n @course = Course.new(params[:course])\n \n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @course.class.model_name.human) }\n format.json { render :json => @course, :status => :created, :location => @course }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n @courses = Course.all\n @users = User.all\n respond_to do |format|\n if @question.save\n format.html { redirect_to course_path(Course.find(@question.course_id))}\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n if @course.save\n @course.generate_join_token\n if current_user.has_role? :instructor\n current_user.courses << @course\n current_user.add_role :instructor, @course\n current_user.add_role :grader, @course\n end\n\n flash[:notice] = \"Course created successfully.\"\n redirect_to @course\n else\n render :action => :new\n end\n end",
"def create\n @curriculum_course = CurriculumCourse.new(curriculum_course_params)\n\n respond_to do |format|\n if @curriculum_course.save\n format.html { redirect_to @curriculum_course, notice: 'Curriculum course was successfully created.' }\n format.json { render :show, status: :created, location: @curriculum_course }\n else\n format.html { render :new }\n format.json { render json: @curriculum_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_event_course_org\n course = Course.find_or_initialize_by(id: params[:course][:id])\n authorize course unless course.new_record?\n\n organization = Organization.find_or_initialize_by(id: params[:organization][:id])\n authorize organization unless organization.new_record?\n\n setter = EventCourseOrgSetter.new(event: @event, course: course, organization: organization, params: params)\n setter.set_resources\n if setter.status == :ok\n render json: setter.resources.map { |resource| [resource.class.to_s.underscore, resource.to_json] }.to_h, status: setter.status\n else\n render json: {errors: setter.resources.map { |resource| jsonapi_error_object(resource) }}, status: setter.status\n end\n end",
"def create\n begin\n case\n when params[:teacher_id]\n course_create_params = params.require(:course).permit(:name, :description, :semester_id)\n check_token(params[:teacher_id], params[:token], true)\n teacher = User.find(params[:teacher_id])\n course = Course.create(course_create_params)\n if teacher.teaching_courses.create(course_id: course.id)\n json_successful(id: course.id)\n else\n json_failed\n end\n when params[:assistant_id] && params[:id]\n check_token(params[:assistant_id])\n if Participation.create(user_id: params[:assistant_id],\n course_id: params[:id], role: ROLE_ASSISTANT).valid?\n json_successful\n else\n json_failed\n end\n when params[:student_id] && params[:id]\n check_token(params[:student_id])\n if Participation.create(user_id: params[:student_id],\n course_id: params[:id], role: ROLE_STUDENT).valid?\n json_successful\n else\n json_failed\n end\n else\n json_failed(REASON_INVALID_OPERATION)\n end\n rescue\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n end",
"def create\n @course = Course.find(params[:course_id])\n @question = @course.questions.build(params[:question])\n @question.save\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @course, notice: 'Question was successfully created.' }\n format.json { render json: @course, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = User.find_by_id(session[:id])\n @course = Course.new\n @lecture_day = @course.lecture_days.build\n @designated_points = @course.designated_points.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def create\n @university_course = UniversityCourse.new(university_course_params)\n\n respond_to do |format|\n if @university_course.save\n format.html { redirect_to @university_course, notice: 'University course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @university_course }\n else\n format.html { render action: 'new' }\n format.json { render json: @university_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course_evaluation = CourseEvaluation.new(course_evaluation_params)\n\n respond_to do |format|\n if @course_evaluation.save\n format.html { redirect_to @course_evaluation, notice: 'Course evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @course_evaluation }\n else\n format.html { render :new }\n format.json { render json: @course_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n \n respond_to do |format|\n if @course.save\n #format.html { redirect_to course_build_path(:id =>\"courseinfo\", :course_id => @course.id), notice: \"Course Created\" }\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = @student.courses.new(params[:course])\n @course.save\n redirect_to @course.student\n end",
"def create\n @type_of_course = TypeOfCourse.new(type_of_course_params)\n @type_of_courses = TypeOfCourse.all\n respond_to do |format|\n if @type_of_course.save\n format.html { redirect_to @type_of_course, notice: 'Type of course was successfully created.' }\n format.json { render :show, status: :created, location: @type_of_course }\n else\n format.html { render :new }\n format.json { render json: @type_of_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_course = Course.new(admin_course_params)\n\n respond_to do |format|\n if @admin_course.save\n format.html { redirect_to [:admin, @admin_course], notice: 'Course was successfully created.' }\n #format.json { render :show, status: :created, location: @admin_course }\n else\n format.html { render :new }\n #format.json { render json: @admin_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:course][:user_id]=current_user.id\n \n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @course = Course.find(params[:course_id])\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end",
"def create\n if params[:id]\n begin\n check_admin\n course = Course.find(params[:course_id])\n teacher = User.find(params[:id])\n course.teachers << teacher\n if course.save\n json_successful\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n else\n json_failed(REASON_NOT_IMPLEMENTED)\n end\n end",
"def create\n params[:certification][:course_id].each do |i|\n begin\n cert = @person.certifications.build(course_id: i, year_id: params[:certification][:year_id])\n cert.save\n rescue\n end\n end\n @certification = @person.certifications.build(certification_params)\n respond_to do |format|\n format.html { redirect_to @person, notice: 'Certification was successfully created.' }\n end\n end",
"def create\n @course_detail = CourseDetail.new(course_detail_params)\n\n respond_to do |format|\n if @course_detail.save\n format.html { redirect_to @course_detail, notice: 'Course detail was successfully created.' }\n format.json { render :show, status: :created, location: @course_detail }\n else\n format.html { render :new }\n format.json { render json: @course_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@course = Course.new(params[:course])\n # TODO Implement logic for getting course here\n course_code = params[:course][:code]\n # @course = NTNU::API::CourseClient.getCourse(course_code) \n\n respond_to do |format|\n if @course.save\n format.html { redirect_to(@course, :notice => 'Course was successfully created.') }\n format.xml { render :xml => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.6910871",
"0.6702445",
"0.6649024",
"0.65967023",
"0.6588424",
"0.65450495",
"0.6512265",
"0.6501965",
"0.6476073",
"0.647102",
"0.64575523",
"0.64249516",
"0.64211714",
"0.64192003",
"0.64189523",
"0.64103806",
"0.6395128",
"0.6394402",
"0.63934445",
"0.63852435",
"0.6381445",
"0.6378229",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.6365134",
"0.63642836",
"0.63609385",
"0.63580203",
"0.6352059",
"0.6352059",
"0.6352059",
"0.6352059",
"0.6352059",
"0.6352059",
"0.6352059",
"0.6343401",
"0.63427615",
"0.63358134",
"0.6326117",
"0.6325895",
"0.63254255",
"0.63252383",
"0.63204503",
"0.63073653",
"0.6305521",
"0.62920547",
"0.6287437",
"0.6281451",
"0.6271774",
"0.6271467",
"0.626306",
"0.6239374",
"0.62326235",
"0.62302095",
"0.6227683",
"0.6225318",
"0.6224618",
"0.622309",
"0.6211373",
"0.6207336",
"0.62051827",
"0.6190048",
"0.61896867",
"0.61604905",
"0.6152448",
"0.615121",
"0.614781",
"0.61338824",
"0.61281896",
"0.6125412",
"0.61227375",
"0.61159563",
"0.6113169",
"0.61125904",
"0.6100201",
"0.6095942",
"0.60935366",
"0.6072271",
"0.60708994",
"0.60692954",
"0.6060373",
"0.6049184",
"0.60462576",
"0.6038299",
"0.6037963",
"0.60364807",
"0.60326296",
"0.6027349",
"0.60241413",
"0.6022761",
"0.6002808"
] | 0.740562 | 0 |
PATCH/PUT /employees_courses/1 PATCH/PUT /employees_courses/1.json | def update
respond_to do |format|
if @employees_course.update(employees_course_params)
format.html { redirect_to @employees_course, notice: 'Employees course was successfully updated.' }
format.json { render :show, status: :ok, location: @employees_course }
else
format.html { render :edit }
format.json { render json: @employees_course.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @people_course.update(people_course_params)\n format.html { redirect_to @people_course, notice: 'People course was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_course }\n else\n format.html { render :edit }\n format.json { render json: @people_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end",
"def update\n respond_to do |format|\n if @person_course.update(person_course_params)\n format.html { redirect_to @person_course, notice: 'Person course was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_course }\n else\n format.html { render :edit }\n format.json { render json: @person_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n professor = Professor.find(params[:id])\n professor.update!(professor_params)\n\n render json: professor.to_json(include: :courses)\n end",
"def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end",
"def update\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n if @employe.update_attributes(params[:employe])\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_course.update(admin_course_params)\n format.html { redirect_to (params[:ref] || @admin_course), notice: t('crud.updated_successfully!', name: Admin::Course.model_name.human) }\n format.json { render :show, status: :ok, location: @admin_course }\n else\n format.html { render :edit }\n format.json { render json: @admin_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n if @assessment_course.update_attributes(params[:assessment_course])\n format.html { redirect_to @assessment_course, notice: 'Assessment course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.html { redirect_to @courses, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @courses }\n\n\n end\n end",
"def update\n \n #don't need to add user_id here.. already exists.\n \n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update(courses_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_url, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employ = Employ.find(params[:id])\n\n respond_to do |format|\n if @employ.update_attributes(params[:employ])\n format.html { redirect_to @employ, notice: 'Employ was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage, Employee\n if responsibility_changes?\n new_employee = Employee.new_from_old(employee_params['responsibility'], @employee)\n @employee.destroy\n new_employee.save\n @employee = new_employee\n end\n\n respond_to do |format|\n if @employee.update(employee_attrs)\n format.html { redirect_to (@employee.try(:employee) || @employee), notice: t('action.update.succeed', entity: Employee.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @given_course.update(given_course_params)\n format.html { redirect_to @given_course, notice: 'Given course was successfully updated.' }\n format.json { render :show, status: :ok, location: @given_course }\n else\n format.html { render :edit }\n format.json { render json: @given_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:company_id])\n @employee = @company.employees.find(params[:id]) \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to company_employees_url(@company), notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course_request = CourseRequest.find(params[:id])\n\n respond_to do |format|\n if @course_request.update_attributes(params[:course_request])\n format.html { redirect_to @course_request, notice: 'Course request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\tfaculty_course = FacultyCourse.find(params[:id])\n\tcourses = params[:courses]\n\tif ((courses[:course1_id] == courses[:course2_id]) && courses[:course1_id] != \"\") || ((courses[:course1_id] == courses[:course3_id]) && courses[:course1_id] != \"\") || ((courses[:course2_id] == courses[:course3_id]) && courses[:course2_id] != \"\")\n\t\tflash[:error] = \"Please choose a different course in each box\"\n\t\tredirect_to faculty_course_path(faculty_course)\n\telse\n \t\tfaculty_course = FacultyCourse.find(params[:id])\n\t\tfaculty_course.update_attributes!(params[:courses].permit(:course1_id,:course2_id,:course3_id))\n\t\tflash[:success] = \"Courses information updated successfully\"\n\t\tredirect_to faculty_courses_path\n\tend\n end",
"def update\n respond_to do |format|\n if @enrolled_course.update(enrolled_course_params)\n format.html { redirect_to @enrolled_course, notice: 'Enrolled course was successfully updated.' }\n format.json { render :show, status: :ok, location: @enrolled_course }\n else\n format.html { render :edit }\n format.json { render json: @enrolled_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end",
"def update\n\t\t@course = @teacher.courses.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to [:teacher, @course], :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @course = Course.find(params[:id])\n raise if @course.nil?\n \n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to club_course_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empolyee.update(empolyee_params)\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @program_employee.update(program_employee_params)\n format.html { redirect_to @program_employee, notice: 'Program employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_employee.update(contract_employee_params)\n format.html { redirect_to @contract_employee, notice: 'Contract employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_employee }\n else\n format.html { render :edit }\n format.json { render json: @contract_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to course_exams_url(@exam.course_id), notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to user_course_path(current_user,@course), notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type_of_courses = TypeOfCourse.all\n respond_to do |format|\n if @type_of_course.update(type_of_course_params)\n format.html { redirect_to @type_of_course, notice: 'Type of course was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_of_course }\n else\n format.html { render :edit }\n format.json { render json: @type_of_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Admin::Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to [:admin, @course], :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course.update(course_params)\n respond_with(@course, location: course_path)\n end",
"def update\n @course = Course.find(params[:id])\n @course.user_id=current_user.id\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to(@course, :notice => 'Course was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n \n if (!params[:course])\n params[:course] = {:name=>params[:title], \n :f_day=>params[:description], \n :l_day=>params[:price]\n } \n end\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course_staff = CourseStaff.find(params[:id])\n\n respond_to do |format|\n if @course_staff.update_attributes(params[:course_staff])\n format.html { redirect_to @course_staff, notice: 'Course staff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_staff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_course.update(user_course_params)\n format.html { redirect_to @user_course, notice: 'User course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to admin_course_url(@course), notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n render action: 'edit'\n end\n end\n end",
"def update\n @course_offering = CourseOffering.find(params[:id])\n\n respond_to do |format|\n if @course_offering.update_attributes(params[:course_offering])\n format.html { redirect_to @course_offering, :notice => 'Course offering was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course_offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course.update_attributes(parama[:course])\n respond_with(@course)\n end",
"def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assignment_employee.update(assignment_employee_params)\n format.html { redirect_to @assignment_employee, notice: 'Assignment employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @assignment_employee }\n else\n format.html { render :edit }\n format.json { render json: @assignment_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course ' + @course.course_id + ' was successfully updated!' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee = Employee.find(params[:id])\n \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @master_employe.update(master_employe_params)\n format.html { redirect_to @master_employe, notice: 'Employe was successfully updated.' }\n format.json { render :show, status: :ok, location: @master_employe }\n else\n format.html { render :edit }\n format.json { render json: @master_employe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'El contacto a sido actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to admin_courses_path, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_detail.update(course_detail_params)\n format.html { redirect_to @course_detail, notice: 'Course detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_detail }\n else\n format.html { render :edit }\n format.json { render json: @course_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6617335",
"0.65584505",
"0.6534825",
"0.64913106",
"0.6380788",
"0.63575864",
"0.6347183",
"0.63464504",
"0.6316902",
"0.630994",
"0.6300922",
"0.62957674",
"0.6293419",
"0.6285283",
"0.628249",
"0.6281093",
"0.627873",
"0.6277494",
"0.6276635",
"0.6276635",
"0.6276635",
"0.6276635",
"0.6276635",
"0.6276635",
"0.6276635",
"0.6276635",
"0.62722373",
"0.62702894",
"0.6267365",
"0.6267365",
"0.6267365",
"0.6257857",
"0.6251051",
"0.62492424",
"0.6246182",
"0.62454575",
"0.6235667",
"0.6235667",
"0.62330216",
"0.62330216",
"0.62330216",
"0.62330216",
"0.62299573",
"0.6213998",
"0.6197126",
"0.6184519",
"0.6182642",
"0.6181698",
"0.61800885",
"0.61789453",
"0.61604005",
"0.61518747",
"0.6149761",
"0.6147597",
"0.61463255",
"0.61344963",
"0.613381",
"0.61257124",
"0.61215967",
"0.6120828",
"0.6116388",
"0.6108481",
"0.6106634",
"0.61046696",
"0.61025065",
"0.6102096",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.60947067",
"0.609129",
"0.60873",
"0.60831976",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066",
"0.6083066"
] | 0.7268662 | 0 |
DELETE /employees_courses/1 DELETE /employees_courses/1.json | def destroy
@employees_course.destroy
respond_to do |format|
format.html { redirect_to employees_courses_url, notice: 'Employees course was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lab_course = LabCourse.find(params[:id])\n @lab_course.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_course.destroy\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n course_name = @course.course_id\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course ' + course_name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to coursees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @path_course.destroy\n respond_to do |format|\n format.html { redirect_to path_courses_url, notice: 'Path course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @enrolled_course.destroy\n respond_to do |format|\n format.html { redirect_to enrolled_courses_url, notice: 'Enrolled course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Course = Course__c.find(params[:id])\n @Course.destroy\n\n respond_to do |format|\n format.html { redirect_to Courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @people_course.destroy\n respond_to do |format|\n format.html { redirect_to people_courses_url, notice: 'People course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts \"WTF I GOT HERE\"\n @course = Course.find(params[:id])\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_path, notice: 'Course was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to my_created_courses_path, notice: 'Course was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_course.destroy\n respond_to do |format|\n format.html { redirect_to person_courses_url, notice: 'Person course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_course = StudyCourse.find(params[:id])\n @study_course.destroy\n\n respond_to do |format|\n format.html { redirect_to study_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @novanet_course.destroy\n respond_to do |format|\n format.html { redirect_to novanet_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @course = Course.find(params[:id])\r\n @course.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to courses_path }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_url(@exam.course_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_aid_course = FirstAidCourse.find(params[:id])\n @first_aid_course.destroy\n\n respond_to do |format|\n format.html { redirect_to first_aid_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @university_course.destroy\n respond_to do |format|\n format.html { redirect_to university_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_user.enrollments.where(course_id: @course.id).first.destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_url, :flash => { :success => 'Course was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clinical_course = ClinicalCourse.find(params[:id])\n @clinical_course.destroy\n\n respond_to do |format|\n format.html { redirect_to clinical_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Curso destruído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @watercourse.destroy\n respond_to do |format|\n format.html { redirect_to watercourses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Kurs je uspješno izbrisan. ' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_mobile_course = LabMobileCourse.find(params[:id])\n @lab_mobile_course.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_mobile_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.where(:id=>params[:id]).first()\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course.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 @course.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 @admin_course.destroy\n respond_to do |format|\n format.html { redirect_to admin_courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @empolyee.destroy\n respond_to do |format|\n format.html { redirect_to empolyees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kf_course_index = Kf::CourseIndex.find(params[:id])\n @kf_course_index.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/kf/courses/#{@kf_course_index.kf_course_id}?page=#{params[:page]}&tab=#{params[:tab]}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_request = CourseRequest.find(params[:id])\n @course_request.destroy\n\n respond_to do |format|\n format.html { redirect_to course_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_accomplishment.destroy\n respond_to do |format|\n format.html { redirect_to education_accomplishments_url, notice: 'Education accomplishment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.update(deleted: true)\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @given_course.destroy\n respond_to do |format|\n format.html { redirect_to given_courses_url, notice: 'Given course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content, status: :ok }\n end\n end",
"def destroy # simply delete single course\n begin\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end #end do\n rescue Exception => msgErr # interrogate a rescured exception\n puts msgErr #print error message\n end #end rescue\n end",
"def destroy\n @student_sub_course = StudentSubCourse.find(params[:id])\n @student_sub_course.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sub_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_detail.destroy\n respond_to do |format|\n format.html { redirect_to course_details_url, notice: 'Course detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @managecourse.destroy\n respond_to do |format|\n format.html { redirect_to managecourses_url, notice: 'Managecourse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @college = College.find(params[:id])\n @college.destroy\n\n respond_to do |format|\n format.html { redirect_to colleges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_name.destroy\n respond_to do |format|\n format.html { redirect_to course_names_url, notice: 'Course name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n LearningMaterial.destroy_course(@course)\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_path(:option=>2), notice: 'El curso fue exitosamente eliminado!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_course.destroy\n respond_to do |format|\n format.html { redirect_to meal_courses_url, notice: 'Meal course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employe = Employe.find(params[:id])\n @employe.destroy\n\n respond_to do |format|\n format.html { redirect_to employes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n result = Hash.new\n begin # try\n result = RegistCoursesHlp.delete(params[:id])\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def destroy\n @employe.destroy\n respond_to do |format|\n format.html { redirect_to employes_path(api_id: @employe.organisme_id), notice: 'Employe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curriculum_course.destroy\n respond_to do |format|\n format.html { redirect_to curriculum_courses_url, notice: 'Curriculum course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n course = Course.includes(:professors).find(params[:id])\n course.destroy\n \n render :json => course\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"
] | [
"0.7250819",
"0.716362",
"0.7140621",
"0.7129735",
"0.7129735",
"0.7129735",
"0.7129735",
"0.71178794",
"0.71085334",
"0.71012354",
"0.70828307",
"0.70738924",
"0.70675176",
"0.7064452",
"0.706285",
"0.7058525",
"0.7053691",
"0.7052165",
"0.70478106",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7047593",
"0.7032887",
"0.701262",
"0.7005281",
"0.69972605",
"0.6987543",
"0.69827247",
"0.69818044",
"0.69709414",
"0.6969292",
"0.6957644",
"0.6947166",
"0.6944618",
"0.6942477",
"0.6931536",
"0.6903458",
"0.6902245",
"0.6902245",
"0.69007",
"0.68959963",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895696",
"0.6895621",
"0.6894321",
"0.6894321",
"0.68931365",
"0.6891743",
"0.6886938",
"0.68772495",
"0.6874441",
"0.6874411",
"0.6870932",
"0.68698263",
"0.6866897",
"0.6855681",
"0.6851946",
"0.6849756",
"0.6844496",
"0.68391323",
"0.68216276",
"0.68143237",
"0.6808386",
"0.680725",
"0.6804215",
"0.6800325",
"0.6791022"
] | 0.74800825 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_employees_course
@employees_course = EmployeesCourse.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 employees_course_params
params[:employees_course]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
==========Validating book, with unique UUID================================================= | def validate_books
csv_text = open(file.url)
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
book_hash = Book.new
book_hash.title = row["Book title"]
book_hash.author = Author.find_or_create_by(name: row["Book author"])
book_hash.published_at = Date.parse(row["Date published"])
book_hash.uuid = row["Unique identifier for the book"]
book_hash.publisher_name = row["Publisher name"]
book_hash.user_id = user_id
unless book_hash.valid?
self.errors[:base] << "UUID Already exist for #{row["Unique identifier for the book"]}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_uuid_format?(uuid)\n !!(uuid =~ /^[A-Za-z0-9_\\-]{16,}$/)\n end",
"def uuid?(uuid)\n uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/\n uuid_regex.match?(uuid.to_s.downcase)\nend",
"def test_unique_book_isbn\n \n book = Book.new(:title => \"\",\n :isbn => \"978-0811827782\",\n :book_id => 1)\n \n assert !book.save\n assert_equal \"Please fill in!\", book.errors.on(:title)\n assert_equal \"Already in Database!\", book.errors.on(:isbn)\n end",
"def create_uuid\n if self.uuid.nil?\n valid_uid = false\n until valid_uid\n self.uuid = format_uuid(SecureRandom.hex(5))\n valid_uid = Voucher.find_by_uuid(self.uuid).nil?\n self.slug = self.uuid\n end\n end\n end",
"def valid_id?(value)\n value.is_a?(String) && value.match?(UUID_PATTERN)\n end",
"def valid_undashed_uuid?(value)\n value =~ /\\A[[:xdigit:]]{32}\\z/\n end",
"def validate_uuid(uuid)\n unless uuid.is_a?(String)\n @log.error \"UUID is not a string\"\n return false\n end\n\n unless !!/^\\S{8}-\\S{4}-4\\S{3}-[89abAB]\\S{3}-\\S{12}$/.match(uuid.to_s)\n @log.error \"UUID is not a valid V4 UUID\"\n return false\n end\n return true\n end",
"def uuid?(item)\n item.to_s.match?(UUID_FORMAT)\n end",
"def uuid?(str)\n !!(str && str.size == 36 && str.match(/\\A\\h{8}-\\h{4}-\\h{4}-\\h{4}-\\h{12}\\z/))\n end",
"def test_validate_pass_978d0d13d149505d0_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"978-0-13-149505-0\"))\r\n\tend",
"def test_validate_pass_978d0d13d149505d0_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"978-0-13-149505-0\"))\r\n\tend",
"def is_uuid?(uuid)\n uuid =~ /[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}/i\n end",
"def test_validate_pass_0d321d14653d0_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"0-321-14653-0\"))\r\n\tend",
"def test_validate_pass_0d321d14653d0_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"0-321-14653-0\"))\r\n\tend",
"def set_uuid\n self.uuid = SecureRandom.uuid unless uuid =~ REGEX\n true\n end",
"def id_me_user_uuid\n if user_uuid && !user_uuid.length.in?([20, 21, 22, 23, 32])\n errors.add(:user_uuid, \"(#{user_uuid}) is not a proper length\")\n end\n end",
"def uuid\n return serial_no unless (serial_no.nil? or serial_no == '')\n raise Exception.new('no uuid for you')\n end",
"def uuid_format?(str)\n return false unless 36 == str.length\n UUID_REGEX === str\n end",
"def checkEventIdentifier(identifier)\n # Check for nil & empty\n if identifier.to_s.empty?\n return nil\n end\n\n # Check for UUID conformity\n uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\n if !(identifier.to_s.downcase =~ uuid_regex)\n BigBlueButton.logger.info( \"The given identifier <#{identifier}> is not a valid UUID. Will be using generated UUID instead.\")\n return nil\n end\n\n # Check for existence in Opencast\n existsInOpencast = true\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => $oc_server + \"/api/events/\" + identifier,\n :user => $oc_user,\n :password => $oc_password,\n ).execute\n rescue RestClient::Exception => e\n existsInOpencast = false\n end\n if existsInOpencast\n BigBlueButton.logger.info( \"The given identifier <#{identifier}> already exists within Opencast. Will be using generated UUID instead.\")\n return nil\n end\n\n return identifier\nend",
"def test_validate_pass_978s0s471s48648s0_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"978 0 471 48648 0\"))\r\n\tend",
"def test_validate_pass_978s0s471s48648s0_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"978 0 471 48648 0\"))\r\n\tend",
"def allows_unique?\n true\n end",
"def seems_valid?\n return true if nil_uuid?\n return seems_valid_microsoft? if variant_microsoft?\n return false if undefined_version? && variant_rfc_4122?\n if variant_rfc_4122?\n version == 1 ? reasonable_time? : !undefined_version?\n else\n nil\n end\n end",
"def checkEventIdentifier(identifier, oc_server, oc_user, oc_password)\n # Check for nil & empty\n if identifier.to_s.empty? || !oc_server || !oc_user || !oc_password\n return nil\n end\n\n # Check for UUID conformity\n uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\n if !(identifier.to_s.downcase =~ uuid_regex)\n BigBlueButton.logger.info( \"OC_DUBLINCORE: The given identifier <#{identifier}> is not a valid UUID. Will be using generated UUID instead.\")\n return nil\n end\n\n # Check for existence in Opencast\n existsInOpencast = true\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => oc_server + \"/api/events/\" + identifier,\n :user => oc_user,\n :password => oc_password,\n ).execute\n rescue RestClient::Exception => e\n existsInOpencast = false\n end\n if existsInOpencast\n BigBlueButton.logger.info( \"OC_DUBLINCORE: The given identifier <#{identifier}> already exists within Opencast. Will be using generated UUID instead.\")\n return nil\n end\n\n return identifier\n end",
"def test_hid_to_uuid\n url = \"https://vault.heroku.com/apps/1234\"\n uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_URL_NAMESPACE, url).to_s\n assert_equal(uuid, Vault::App.hid_to_uuid('app1234@heroku.com'))\n end",
"def validate_uuids\n unless Material.valid?(param_uuids)\n return render json: { errors: [{ status: '422', title: 'Unprocessable entity', detail: 'Invalid Material UUIDs' }]}, status: :unprocessable_entity\n end\n end",
"def validate_uuids\n unless Material.valid?(param_uuids)\n return render json: { errors: [{ status: '422', title: 'Unprocessable entity', detail: 'Invalid Material UUIDs' }]}, status: :unprocessable_entity\n end\n end",
"def test_id_to_uuid\n url = \"https://vault.heroku.com/apps/1234\"\n uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_URL_NAMESPACE, url).to_s\n assert_equal(uuid, Vault::App.id_to_uuid(1234))\n end",
"def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n end",
"def test_input_string_is_a_valid_isbn_for_10_degit\n assert_equal(false,valid_isbn?(\"0471958698\"))\n assert_equal(true,valid_isbn?(\"0 4 7-1958697\"))\n assert_equal(true,valid_isbn?(\"0471958697\"))\n assert_equal(false,valid_isbn?(\"1471958697\"))\n\n end",
"def valid_id_number; end",
"def test_validate_pass_877195869x_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"877195869x\"))\r\n\tend",
"def test_validate_pass_877195869x_returns_true\r\n\t\tassert_equal(true, validate_isbn?(\"877195869x\"))\r\n\tend",
"def _create_record\n tries ||= 1\n transaction(requires_new: true) { super }\n rescue ActiveRecord::RecordNotUnique => e\n raise e unless /uuid_v2/ === e.cause.error\n logger.info \"type=entourages.uuid_v2.not_unique tries=#{tries}\"\n raise e if tries == 3\n self.uuid_v2 = nil\n set_uuid\n tries += 1\n retry\n end",
"def test_invalid_false\n\t\tresults = check_valid_isbn?(\"97 8047-005g902 9\")\n\t\tassert_equal(false, results)\n\tend",
"def create_unique_uuid(conn)\n loop do\n uuid = SecureRandom.uuid\n break uuid unless uuid_exists?(conn, uuid)\n end\n end",
"def uuid\n SecureRandom.uuid\nend",
"def valid?\n return false if @author_email.nil?\n return false if @repository_url.nil?\n return false if @sha.nil?\n pattern = Regexp.new(\"^[a-fA-F0-9]{40}$\")\n return false if @sha !~ pattern\n true\n end",
"def check_id\n gene_id_format = Regexp.new(/A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/)\n return false if gene_id_format.match(@gene_id).nil?\n end",
"def check_id_uniqueness\n check('object id uniqueness') do |messages|\n list = [\n check_network_id_uniqueness,\n check_node_id_uniqueness,\n check_link_id_uniqueness,\n check_tp_id_uniqueness\n ]\n messages.push(list)\n messages.flatten!\n end\n end",
"def book_safe!(room)\n book! room\n rescue RestClient::Exception\n false\n end",
"def ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\n end",
"def uuid() = @uuid ||= SecureRandom.uuid",
"def test_unique\n assert_equal \".archetype-uid-RANDOM_UID\", evaluate(\"unique(class)\")\n assert_equal \"\\#archetype-uid-RANDOM_UID\", evaluate(\"unique(id)\")\n assert_equal \"my-prefix-archetype-uid-RANDOM_UID\", evaluate(\"unique(my-prefix-)\")\n assert_equal \".testing-archetype-uid-RANDOM_UID\", evaluate(\"unique('.testing-')\")\n end",
"def test_valid_10_digit_isbn767\n assert_equal(true, valid_isbn?(\"0-321 14 6530\")) \n end",
"def validate\n self.code = generate_unique_code\n end",
"def hex_address_unique?(hex_address)\n return false if hex_address == '0000'\n return false if hex_address == 'ffff'\n if Chef::Config[:solo]\n Chef::Log.warn('Running solo, cannot check address uniqueness')\n return true\n else\n return search(:node, \"tinc_hex_address:#{ha}\").empty?\n end\nend",
"def validate_id( uid )\n\t\tself.log.debug \"validating userid (UID) %p\" % [ uid ]\n\t\tfinish_with Apache::BAD_REQUEST, \"missing ID\" if uid.nil?\n\t\tfinish_with Apache::BAD_REQUEST, \"malformed or invalid ID: #{uid}\" unless\n\t\t\tuid =~ /^\\w{3,16}$/\n\n\t\tuid.untaint\n\t\treturn uid\n\tend",
"def check_unique\n bar = Bar.where(:name => self.name, :user_id => self.user_id)\n if bar != nil\n \treturn false\n end\n end",
"def validSerialNumber?(s)\n regex = /^[A-L]([1-9]{8})([A-NP-X]|\\*)/\n return true ? s.match(regex) != nil : false\nend",
"def format_uuid(raw)\n raise \"Uuid must be 10 digits\" unless 10 == raw.length\n \n \"#{raw[0..2]}-#{raw[3..5]}-#{raw[6..9]}\"\n end",
"def valid_orcid_id?(id)\n if id =~ /[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9,X]{4}/\n id = id.delete('-')\n id[15] == orcid_checksum(id)\n else\n false\n end\n end",
"def generate_tc_barcode\n begin\n self.tag_number = SecureRandom.base64(12)\n end while self.class.exists?(tag_number: tag_number)\n end",
"def test_validation\n \n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-')\n pcba_pn = '500-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No - PCB, PCBA part numbers are not unique.\n pcba_pn = '600-123-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert( pn.error_message)\n assert_equal('The PCB part number (600-123-a0 a) and the PCBA part number ' +\n \"(600-123-00 b) must be unique - YOUR PART NUMBER WAS NOT CREATED\",\n pn.error_message)\n \n\n # Valid? - No - Format bad, short prefix\n pcb_pn = '12-123-a0'.split('-')\n pcba_pn = '34-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No - Format bad, illegal characters in the prefix\n pcb_pn = '12e-123-a0'.split('-')\n pcba_pn = 'pcb-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, wrong number of characters in the number\n pcb_pn = '127-3-a0'.split('-')\n pcba_pn = '128-21-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the number\n pcb_pn = '127-###-a0'.split('-')\n pcba_pn = '128-JPA-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the dash number\n pcb_pn = '127-714-*'.split('-')\n pcba_pn = '128-755-!&'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert(!pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes\n pcb_pn = '127-714-01'.split('-')\n pcba_pn = '128-755-a0'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n\n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No, pcb pn exists.\n pcb_pn = '252-700-b0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n \n # Valid? - No, pcb pn duplicates pcba pn \n pcb_pn = '259-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'b'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n # Valid? - No, pcb pn prefix contains the wrong number of characters \n pcb_pn = '12-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No, pcb pn prefix contains illegal characters \n pcb_pn = '12e-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains wrong number of characters \n pcb_pn = '127-3-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n #assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains illegal characters \n pcb_pn = '127-#*@-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn dash number contains wrong number of, and illegal, characters \n pcb_pn = '127-714-@'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes \n pcb_pn = '127-714-01'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n \n assert(!pn.exists?)\n assert_nil(pn.error_message)\n pn.save\n assert(pn.exists?)\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n\n assert(PartNumber.valid_prefix?('100'))\n assert(!PartNumber.valid_prefix?('1'))\n assert(!PartNumber.valid_prefix?('a'))\n assert(!PartNumber.valid_prefix?('10'))\n assert(!PartNumber.valid_prefix?('a7'))\n assert(!PartNumber.valid_prefix?('1aa'))\n assert(!PartNumber.valid_prefix?('a00'))\n assert(!PartNumber.valid_prefix?('1776'))\n assert(!PartNumber.valid_prefix?('a345'))\n \n assert(PartNumber.valid_number?('100'))\n assert(!PartNumber.valid_number?('1'))\n assert(!PartNumber.valid_number?('a'))\n assert(!PartNumber.valid_number?('10'))\n assert(!PartNumber.valid_number?('a7'))\n assert(!PartNumber.valid_number?('1aa'))\n assert(!PartNumber.valid_number?('a00'))\n assert(!PartNumber.valid_number?('1776'))\n assert(!PartNumber.valid_number?('a345'))\n \n assert(PartNumber.valid_dash_number?('a0'))\n assert(PartNumber.valid_dash_number?('0a'))\n assert(!PartNumber.valid_dash_number?('a'))\n assert(!PartNumber.valid_dash_number?('4'))\n assert(!PartNumber.valid_dash_number?('aa33'))\n assert(!PartNumber.valid_dash_number?('333'))\n \n # Create known part numbers for testing.\n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-802-00'.split('-')\n pcba_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-01'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n\n pn = PartNumber.initial_part_number\n pcb_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert(!pn.valid_components?('not'=='new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n pcba_pn = '700-900-90'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n \n pcba_pn = '000-000-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n end",
"def create_uuid\n characters = [*'a'..'f', *'0'..'9']\n \"#{characters.sample(8).join}-#{characters.sample(4).join}-#{characters.sample(4).join}-#{characters.sample(4).join}-#{characters.sample(12).join}\"\nend",
"def unique_id(slug)\n Zlib.crc32 slug\n end",
"def valid_south_african_id_number; end",
"def generate_uuid\n if [nil, \"\"].include?(uuid)\n self.uuid = Vidibus::Uuid.generate\n end\n end",
"def unique_check_key\n @unique_check_key ||= SecureRandom.hex\n end",
"def _before_validation\n set_uuid if new?\n super\n end",
"def not_a_duplicate\n book = Book.find_by(title: title, author: author)\n if !!book && book != self\n errors.add(:book, 'is already in the book index.')\n end\n end",
"def populate_uuid\n self.uuid = SecureRandom.uuid()\n end",
"def verify_book_exists(selected)\n\twhile Book.find_by_id(selected).nil?\n\t\tputs \"\\nNo books identified as entered\\n\"\n\t\tshow_all_books\n\t\tselected = make_selection.to_i\n\tend\n\tselected\nend",
"def create_uuid\n self.uuid = SecureRandom.hex(12)\n end",
"def acceptable_serial( str )\n # no more than two repeating characters\n return true\n end",
"def generate_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit.to_s}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend",
"def valid_isbn\n errors.add(:isbn, \"This is not a valid ISBN.\") unless ISBN_Tools.is_valid?(self.isbn) \n end",
"def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end",
"def initialize(bytes = nil)\n if bytes.nil? then\n @bytes = Keybox::RandomDevice.random_bytes(16)\n elsif bytes.size == 36 and bytes.split(\"-\").size == 5 then\n if bytes =~ REGEX then\n # remove the dashes and make sure that we're all\n # lowercase\n b = bytes.gsub(/-/,'').downcase\n\n # convert to an array of hex strings\n b = b.unpack(\"a2\"*16)\n\n # convert the hex strings to integers\n b.collect! { |x| x.to_i(16) }\n\n # and pack those integers into a string\n @bytes = b.pack(\"C*\")\n\n # of course this could all be done in one line with\n # @bytes = bytes.gsub(/-/,'').downcase.unpack(\"a2\"*16\").collect {|x| x.to_i(16) }.pack(\"C*\")\n else\n raise ArgumentError, \"[#{bytes}] is not a hex encoded UUID\"\n end\n elsif bytes.kind_of?(String) and bytes.length >= 16\n @bytes = bytes[0..16]\n else\n raise ArgumentError, \"[#{bytes}] cannot be converted to a UUID\"\n end\n\n end",
"def create_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n \n uuid\nend",
"def create_uuid\n uuid = ''\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |section|\n section.times { uuid += HEX.sample }\n uuid += '-' unless section == 12\n end\n \n uuid\nend",
"def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n true\n end",
"def include_uuid?(uuid)\n return @uuids.include? uuid\n end",
"def make_uuid\n hex_arr = (0..9).to_a + ('a'..'f').to_a\n hex_arr = hex_arr.map!(&:to_s)\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12] \n sections.each_with_index do |section, index|\n section.times { uuid += hex_arr.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def uuid; end",
"def uuid; end",
"def create_UUID\n characters =[]\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend",
"def test_uuid_as_optional()\n # Parameters for the API call\n body = UuidAsOptional.from_hash(APIHelper.json_deserialize(\n '{\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.uuid_as_optional(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_uuid_as_optional()\n # Parameters for the API call\n body = UuidAsOptional.from_hash(APIHelper.json_deserialize(\n '{\"uuid\":\"123e4567-e89b-12d3-a456-426655440000\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.uuid_as_optional(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def create\n @book = Book.new(params[:book])\n respond_to do |format|\n begin\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n #This will take care of duplicate book entry in the scope of same authors only. \n rescue InvalidBook => e\n @book.errors[:base] << e.to_s\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_uuid_for_string(string)\n ary = Digest::SHA256.hexdigest(string).unpack(\"NnnnnN\")\n ary[2] = (ary[2] & 0x0fff) | 0x4000\n ary[3] = (ary[3] & 0x3fff) | 0x8000\n sprintf \"%08x-%04x-%04x-%04x-%04x%08x\", *ary\n end",
"def generate_UUID\n characters = [] # => []\n (0..9).each { |number| characters << number.to_s } # => 0..9\n ('a'..'f').each { |letter| characters << letter } # => \"a\"..\"f\"\n\n uuid = \"\" # => \"\"\n sections = [8, 4, 4, 4, 12] # => [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index| # => [8, 4, 4, 4, 12]\n section.times { uuid += characters.sample } # => 8, 4, 4, 4, 12\n uuid += '-' unless index >= sections.size - 1 # => \"98a0df48-\", \"98a0df48-5f8a-\", \"98a0df48-5f8a-aa68-\", \"98a0df48-5f8a-aa68-2057-\", nil\n end # => [8, 4, 4, 4, 12]\n\n uuid # => \"98a0df48-5f8a-aa68-2057-7dbc6e43c04e\"\nend",
"def set_unique_uuid\n while (uuid.blank?)\n fresh = fresh_uuid\n if ActiveAggregate::EventBase.where(uuid: fresh).present?\n puts \"Event with uuid = #{fresh} found!\"\n else\n self.uuid = fresh\n end\n end\n end",
"def _uid(uuid = @uuid)\n uuid && uuid[0,6]\n end",
"def valid_id?(value)\n digits_only?(value)\n end",
"def validate_alternate_id(_item)\n nil\n end",
"def unique_id(len = 8)\n @uniq_id_disallowed ||= /[^abcdefhjkmnpqrtvwxyzABCDEFGHJKMNPQRTVWXY2346789]/\n candidate = SecureRandom.urlsafe_base64((len * 2.1).ceil).gsub(@uniq_id_disallowed, '')\n fail RangeError if candidate.size < len\n\n candidate[0...len]\n rescue RangeError\n retry\n end",
"def create_uuid()\n characters = []\n ('a'..'z').each { |let| characters << let}\n ('0'..'9').each { |num| characters << num}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |num, index|\n num.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_guid\n begin\n guid = SecureRandom.urlsafe_base64\n end while Person.where(:guid => guid).exists?\n self.guid = guid\n end",
"def generate_guid\n begin\n guid = SecureRandom.urlsafe_base64\n end while Person.where(:guid => guid).exists?\n self.guid = guid\n end",
"def validate_owner(record, attribute, uris)\n klass = Device\n ids = find_ids(uris)\n\n real = klass.in(id: ids).where(resource_owner_id: record.resource_owner_id)\n expected = klass.in(id: ids)\n\n not_owned_ids = expected.map(&:id) - real.map(&:id)\n record.errors.add(attribute, \"not owned with IDs #{not_owned_ids.join(',')}\") if not real.count == expected.count\n end",
"def valid_id(text)\n\t NinjaGen.id_filter.match(text)\n end",
"def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n return true\n end",
"def uuid_uri_and_term_type_unchanged\n return unless persisted? # skip if object is new or is deleted\n\n errors.add(:uuid, 'Change of uuid not allowed!') if uuid_changed?\n errors.add(:uri, 'Change of uri not allowed!') if uri_changed?\n errors.add(:term_type, 'Change of term_type not allowed!') if term_type_changed?\n end",
"def slug_candidates\n SecureRandom.uuid\n end",
"def clean_guid(guid)\n return nil if guid.nil?\n\n g = guid.to_s.downcase\n return nil if g.strip.empty?\n return g if g.length == 36 && g =~ UUID_REGEX_FORMAT\n\n g.delete!('^0-9a-f')\n g.sub!(/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/, '\\1-\\2-\\3-\\4-\\5')\n end",
"def uuid2\n hexchars = (('0'..'9').to_a).concat(('a'..'f').to_a)\n sections = [8, 4, 4, 4, 12]\n result = ''\n\n sections.each do |section|\n section.times do\n result << hexchars.sample.to_s\n end\n result << '-'\n end\n\n result.chop # to cut off trailing char\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend"
] | [
"0.67580456",
"0.6702425",
"0.6605779",
"0.6515341",
"0.6489125",
"0.6405775",
"0.63885117",
"0.6324985",
"0.62857693",
"0.6285451",
"0.6285451",
"0.62851685",
"0.62572175",
"0.62572175",
"0.6249086",
"0.6175638",
"0.616393",
"0.6134245",
"0.5933415",
"0.5877097",
"0.5877097",
"0.5853669",
"0.5820895",
"0.57990515",
"0.5775383",
"0.57401866",
"0.57401866",
"0.5724669",
"0.5671351",
"0.5670859",
"0.565708",
"0.56230974",
"0.56230974",
"0.5595392",
"0.55837727",
"0.5579795",
"0.5577465",
"0.5568805",
"0.5558157",
"0.55560035",
"0.5550544",
"0.5523916",
"0.5519976",
"0.5506508",
"0.54900336",
"0.54850924",
"0.5483989",
"0.5467842",
"0.5466797",
"0.54660714",
"0.5448365",
"0.544628",
"0.5445096",
"0.5437719",
"0.54341084",
"0.54260933",
"0.542395",
"0.54164743",
"0.54092026",
"0.54046595",
"0.5403162",
"0.5401326",
"0.53989536",
"0.53904665",
"0.5390337",
"0.5390132",
"0.53789294",
"0.5374954",
"0.53665274",
"0.53551346",
"0.535056",
"0.5350374",
"0.53462577",
"0.5339718",
"0.5330427",
"0.5330427",
"0.53287214",
"0.53265995",
"0.53265995",
"0.5325241",
"0.53185713",
"0.5306615",
"0.5304081",
"0.5298615",
"0.52970874",
"0.52962476",
"0.52960116",
"0.5287216",
"0.52842087",
"0.52842087",
"0.5272824",
"0.5268644",
"0.52662635",
"0.52661675",
"0.52659845",
"0.5264107",
"0.5259659",
"0.5254595",
"0.5254595",
"0.5254595"
] | 0.69789755 | 0 |
Write your code here. | def batch_badge_creator (attendees)
attendees.collect do |name| badge_maker (name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def run\n \n end",
"def run\n \n end",
"def method\n\t\t# code code\n\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run\n end",
"def custom; end",
"def custom; end",
"def do()\r\n\tend",
"def run\n end",
"def suivre; end",
"def run\n end",
"def code_point; end",
"def run\n end",
"def run\n end",
"def how_it_works\r\n end",
"def private; end",
"def probers; end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run()\n end",
"def ...\nend",
"def autorun; end",
"def main\n\n end",
"def script; end",
"def script; end",
"def who_we_are\r\n end",
"def refutal()\n end",
"def schubert; end",
"def run() end",
"def jack_handey; end",
"def end\n end",
"def end\n end",
"def code_of_conduct; end",
"def guct\n end",
"def inline_code; end",
"def processor; end",
"def rossini; end",
"def operations; end",
"def operations; end",
"def zuruecksetzen()\n end",
"def usage; end",
"def usage; end",
"def myletter\n \n end",
"def perform\n \n end",
"def main\n end",
"def execute()\n\n end",
"def execute()\n\n end",
"def implementation; end",
"def implementation; end",
"def strain; end",
"def weber; end",
"def cobasysprog\n end",
"def faint; end",
"def faint; end",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def villian; end",
"def event; end",
"def event; end",
"def event; end",
"def terpene; end",
"def whiny; end",
"def functions\n\n end",
"def code\n call_once\n @code\n end",
"def home\n # Insert ruby code...\n end",
"def main_end ; end",
"def execute; end",
"def execute; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def running; end",
"def running; end",
"def src; end",
"def src; end",
"def src; end",
"def before_run; end",
"def view_flow; end",
"def process; end",
"def process; end"
] | [
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.6527089",
"0.6527089",
"0.6524399",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.6418008",
"0.6343933",
"0.6343933",
"0.6338845",
"0.6282123",
"0.62538993",
"0.62501293",
"0.62434614",
"0.6236977",
"0.6236977",
"0.6207382",
"0.6204343",
"0.6200807",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.60960203",
"0.604832",
"0.6043193",
"0.6026803",
"0.6026237",
"0.6026237",
"0.60025203",
"0.59755385",
"0.5963523",
"0.5961639",
"0.5927036",
"0.5920554",
"0.5920554",
"0.59154105",
"0.5888617",
"0.5868856",
"0.58647305",
"0.5860969",
"0.58510077",
"0.58510077",
"0.5835242",
"0.58314204",
"0.58314204",
"0.58019507",
"0.5790267",
"0.57891494",
"0.5777462",
"0.5777462",
"0.57764494",
"0.57764494",
"0.5772342",
"0.57706326",
"0.5763556",
"0.57617295",
"0.57617295",
"0.575999",
"0.57593614",
"0.5746819",
"0.5746819",
"0.5746819",
"0.57457167",
"0.5744335",
"0.5744013",
"0.5742843",
"0.57107383",
"0.5698335",
"0.56904966",
"0.56904966",
"0.5683242",
"0.5683242",
"0.5683242",
"0.5683242",
"0.5683242",
"0.56829256",
"0.56829256",
"0.5681511",
"0.5681511",
"0.5681511",
"0.5680355",
"0.5674257",
"0.5665342",
"0.5665342"
] | 0.0 | -1 |
define mothods ==, greater then >, less then < | def ==(other)
@value = other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator; end",
"def >=(other); end",
"def <=(other); end",
"def define_comparison_method(methods)\n define_method(:cmp?) do |comparator, other|\n methods.all? { |method| send(method).send(comparator, other.send(method)) }\n end\n end",
"def comparison_op\n match(%w(== != > >= < <=).map { |t| Token.new(:symbol, t) })\n end",
"def comparison_op\n @instruction.push(@enum.peek.value)\n match(%w(== != > >= < <=).map { |t| Token.new(:symbol, t) })\n end",
"def true_comparitons\n ['be','is','are','were','=','>','>=','==','<=','<','=<','gt','lt','eq','bigger','greater','equals','identical to',\n 'smaller','less','equal to','more','less','the same as','same as','similar']\n end",
"def comparison\n expr = addition\n\n while match?(:greater, :greater_equal, :less, :less_equal)\n operator = previous\n right = addition\n expr = Ringo::Binary.new(expr, operator, right)\n end\n\n return expr\n end",
"def <(other); end",
"def <= other\n #This is a stub, used for indexing\n end",
"def operators\n [:is]\n end",
"def > other\n #This is a stub, used for indexing\n end",
"def operators\n {\n \"+\" => -> {@num1 + @num2},\n \"-\" => -> {@num1 - @num2}\n }\n end",
"def comparison( operator )\n compiler = compiler_for(:Integer, operator ,{other: :Integer })\n builder = compiler.builder(compiler.source)\n builder.build do\n integer! << message[:receiver]\n integer.reduce_int\n integer_reg! << message[:arguments]\n integer_reg << integer_reg[Parfait::NamedList.type_length + 0] #\"other\" is at index 0\n integer_reg.reduce_int\n swap_names(:integer , :integer_reg) if(operator.to_s.start_with?('<') )\n integer.op :- , integer_reg\n if_minus false_label\n if_zero( false_label ) if operator.to_s.length == 1\n object! << Parfait.object_space.true_object\n branch merge_label\n add_code false_label\n object << Parfait.object_space.false_object\n add_code merge_label\n message[:return_value] << object\n end\n compiler.add_mom( Mom::ReturnSequence.new)\n return compiler\n end",
"def do_compare (opts)\n\tif (params = opts[:parameters]) && params.size(:seq) > 0 &&\n\t params[0].is_a?(Numeric)\n\t diff = params[0]\n\telse diff = 0\n\tend\n\tdiff = @original - diff\n\tcase opts[:method]\n\twhen '<' then diff < 0\n\twhen '<=' then diff <= 0\n\twhen '==' then diff == 0\n\twhen '!=' then diff != 0\n\twhen '>=' then diff >= 0\n\twhen '>' then diff > 0\n\tend\n end",
"def test_compare\r\n assert_equal(-1, @lucas<=>@uwe)\r\n assert_equal(-1, @lucas<=>@person1)\r\n assert_equal(-1, @person1<=>@person2)\r\n assert_equal(1, @person2<=>@person3)\r\n\r\n assert_equal(0, @lucas<=>@lucas2)\r\n\r\n assert_equal(1,@lucas.<=>(@uwe,2))\r\n end",
"def >=(arg0)\n end",
"def >=(arg0)\n end",
"def >= other\n #This is a stub, used for indexing\n end",
"def >(other)\n compare_method(other, 1)\n end",
"def <=>(other)\n end",
"def initialize(operator, less)\n @operator = operator \n @less = less\n end",
"def <=>(an0ther)\n get_val() <=> an0ther.get_val()\nend",
"def method_missing(method, *args, &block)\n if match = /has_less_([#{ROMAN_CHARS}])_than/.match(method.to_s)\n raise ERROR_ILLEGAL_COMPARISON unless args[0].is_a?(RomanNumeral)\n char = match[0]\n self.count(char) < args[0].count(char)\n elsif match = /has_equal_([#{ROMAN_CHARS}])_as/.match(method.to_s)\n raise ERROR_ILLEGAL_COMPARISON unless args[0].is_a?(RomanNumeral)\n char = match[0]\n self.count(char) == args[0].count(char)\n elsif match = /has_more_([#{ROMAN_CHARS}])_than/.match(method.to_s)\n raise ERROR_ILLEGAL_COMPARISON unless args[0].is_a?(RomanNumeral)\n char = match[0]\n self.count(char) > args[0].count(char)\n else\n super\n end\n end",
"def comparators\n @@comparators\n end",
"def <=>(other)\n `if (typeof other != 'string') return nil;\n else if (self > other) return 1;\n else if (self < other) return -1;\n return 0;`\n end",
"def <=>(other)\n `if (typeof other != 'string') return nil;\n else if (self > other) return 1;\n else if (self < other) return -1;\n return 0;`\n end",
"def evaluate_operator(left, right)\n left < right\n end",
"def <=(arg0)\n end",
"def <=(arg0)\n end",
"def assert_less_than(lhs, rhs, message = \"\")\\\n assert_operator(lhs, :<, rhs, message)\n end",
"def <=>(other) = self.precedence <=> other.precedence",
"def >=(p0) end",
"def >=(p0) end",
"def >=(p0) end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=>(other); end",
"def <=( context )\n comparison( :<= )\n end",
"def evaluate_operator(left, right)\n left >= right\n end",
"def comparison( opr )\n case opr\n when \"<\"\n return \"קטן מ-\"; \n when \"=\"\n return \"שווה\";\n when \"!=\"\n return \"שונה\";\n when \">\"\n return \"גדול מ-\";\n else\n throw \"unknown comparison: #{opr}\";\n end \n end",
"def <=>(other)\n self.comparison_criteria <=> other.comparison_criteria\n end",
"def initialize field, operator, value\n @field = field\n @operator = operator\n if @operator == :eq && value.class == String\n value = /^#{value}$/\n else\n value = value\n end\n @value = value\n\n method_string = 'def compare(inval);'\n if value.class == Regexp\n if operator == :eq\n method_string += \" inval.match(@value);\"\n else\n raise ArgumentError, \"operation #{operator} does not work with a regexp\"\n end\n else\n if operator == :eq\n method_string += \" inval == @value;\"\n elsif operator == :lt\n method_string += \" inval < @value;\"\n elsif operator == :gt\n method_string += \" inval > @value;\"\n end\n end\n method_string += 'end;'\n self.instance_eval method_string\n end",
"def assert_less_than_or_equal_to(lhs, rhs, message = \"\")\n assert_operator(lhs, :<=, rhs, message)\n end",
"def evaluate_operator(left, right)\n left <= right\n end",
"def __cmp__(op, other)\n Sequel::SQL::BooleanExpression.new(op, self, binary_operation_arg(other))\n end",
"def <=(p0) end",
"def <=>(other)\n RubyPython::PyMain.cmp(self, other)\n end",
"def <=>(other)\n if other.is_a? SemVerRange\n # print \"\\n\", \"upper compare #{upper_bound.inspect} <=> #{other.upper_bound.inspect} => #{upper_bound <=> other.upper_bound}\", \"\\n\\n\"\n # print \"\\n\", \"lower compare #{lower_bound.inspect} <=> #{other.lower_bound.inspect} => #{lower_bound <=> other.lower_bound}\", \"\\n\\n\"\n cmp = upper_bound_inclusive <=> other.upper_bound_inclusive\n cmp = lower_bound <=> other.lower_bound if cmp == 0\n\n # Always sort wildcards behind comparison operators (when otherwise idential)\n # cmp = -1 if cmp == 0 and has_wildcard? and not other.has_wildcard?\n\n # Always sort `<` behind `~>` (when otherwise idential)\n cmp = -1 if cmp == 0 and comparison_operator == '<' and other.has_approximate_comparison_operator?\n cmp\n\n elsif other.is_a? SemVer\n cmp = upper_bound_inclusive <=> other\n cmp = lower_bound <=> other if cmp == 0\n\n # Always sort ranges behind regular semvers when identical\n cmp = -1 if cmp == 0\n cmp\n\n else\n self <=> SemVerRange.parse(other)\n end\n end",
"def <=(value)\n self < value or self == value\n end",
"def conditions()\n {:+ => :plus, :- => :minus, :/ => :divide, :* => :times}\n end",
"def <(money_live_convertor) \n arithmetic_op('<',self,money_live_convertor)\n end",
"def <=>(other)\n# Return -1, 0, or 1...\n end",
"def >( context )\n comparison( :> )\n end",
"def <=>(other)\nreturn nil unless other.instance_of? Point\n@x**2 + @y**2 <=> other.x**2 + other.y**2\nend",
"def method_missing(meth, *args, &block)\n if OPERATORS.include?(meth)\n __cmp__(meth, args[0])\n elsif extensions.key?(meth)\n extensions[meth].(type, sql_expr, *args, &block)\n elsif sql_expr.respond_to?(meth)\n meta(sql_expr: sql_expr.__send__(meth, *args, &block))\n else\n super\n end\n end",
"def <=> other\n #This is a stub, used for indexing\n end",
"def select_operator\n return '>' if self.class.name.downcase.include?('arm')\n return '==' if self.class.name.downcase.include?('leg')\n end",
"def parse_comparison(parser); end",
"def >(other); end",
"def <=>(other)\n# Define the <=> operator\nreturn nil unless other.instance_of? Point\nself.x**2 + self.y**2 <=> other.x**2 + other.y**2\nend",
"def <( context )\n comparison( :< )\n end",
"def comparer_methods\n super + [\n :three_of_a_kind_rank,\n :pair_rank\n ]\n end",
"def >(other); method_missing(:>, other); end",
"def >=( context )\n comparison( :>= )\n end",
"def >(other)\n age > other.age\n end",
"def <=>(other)\n # Return -1, 0, or 1...\n @x <=> other ##--roman\n end",
"def comparer_methods\n super + [\n :min_rank\n ]\n end",
"def <=>(other)\n # if SUBJECT_POINTS[self.name] > SUBJECT_POINTS[other.name]\n # return 1\n # elsif SUBJECT_POINTS[self.name] < SUBJECT_POINTS[other.name]\n # return -1\n # else\n # return 0\n # end\n # shorter way to do this :O WOW! just tell which\n # things(quantities) to compare, and rubys comparable does it for you\n # so as long as the quantities you want to compare are builtin ones,\n # just call <=> straight instead of doing the if..elsif..else\n SUBJECT_POINTS[self.name] <=> SUBJECT_POINTS[other.name]\n end",
"def >=(left, right)\n raise \"Not applicable to sphinx.\"\n end",
"def <=(left, right)\n raise \"Not applicable to sphinx.\"\n end",
"def < other\n #This is a stub, used for indexing\n end",
"def operator\n self.class.operator\n end",
"def do_greater_than(s); s[:direction] = 'right'; end",
"def <=>(other)\n case other\n when ::Numeric\n to_d <=> other\n when RDF::Literal::Decimal, RDF::Literal::Double\n to_d <=> other.to_d\n else super\n end\n end",
"def ===(method); end",
"def xml_tag\n :comparison\n end",
"def <=>(other)\n self.age <=> other.age\n end",
"def parse_binary_comparison(parser); end",
"def <=> (other) #we will feed the \"type\" instance variable to the method MEDAL_VALUES\n if MEDAL_VALUES[self.type] < MEDAL_VALUES[other.type]\n -1\n elsif MEDAL_VALUES[self.type] == MEDAL_VALUES[other.type]\n 0\n else\n 1\n end\n end",
"def convertCompare(op, jumpLocation, locationEnd)\n case op\n\n when \"eq\"\n cmds = compare(\"JEQ\", jumpLocation, locationEnd)+\"\\n\"\n\n when \"gt\"\n cmds = compare(\"JGT\", jumpLocation, locationEnd)+\"\\n\"\n\n when \"lt\"\n cmds = compare(\"JLT\", jumpLocation, locationEnd)+\"\\n\"\n else\n cmds = \"//not a legal command\"\n end\n\n return cmds\nend",
"def lte(_obj)\n raise NotImplementedError\n end",
"def <=> other\nto_s <=> other.to_s\nend",
"def comparer_methods\n super + [\n :highest_rank,\n :second_highest_rank,\n :third_highest_rank,\n :fourth_highest_rank,\n :fifth_highest_rank\n ]\n end",
"def >(left, right)\n raise \"Not applicable to sphinx.\"\n end",
"def compare(x, y); end",
"def operator?(item)\n return item.eql?(item.match(/[A-Z\\-<>(>=)(<=)(<=>)]+/m).to_s) ? true : false\n end",
"def compare(attr, statable)\r\n a = self.send(attr)\r\n\tb = statable.send(attr)\r\n#\treturn 0 if a.nil? || b.nil?\r\n\t\r\n\torder = StatSummary::STATS[attr][:order]\r\n\tif order == 1\r\n\t return (a || 10000) <=> (b || 10000)\r\n# return a <=> b\r\n\telse\r\n\t return (b || -1) <=> (a || -1)\r\n# return b <=> a\r\n\tend\r\n end",
"def func_gt(args)\n p1 = _eval(car(args))\n p2 = _eval(car(cdr(args)))\n\n if p1.type != LObject::OBJ_INTEGER or p2.type != LObject::OBJ_INTEGER\n if @lint\n Error.warn(\"warning: comparison with a non integer operand\")\n end\n return @o_man.nil\n end\n\n if (p1.value.i > p2.value.i)\n return @o_man.t\n end\n\n return @o_man.nil\n end",
"def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend",
"def basic_op(operator, value1, value2)\nvalue1.send(operator,value2)\nend",
"def arel_methods\n @@arel_method ||= {\n 'user_id' => 'simple_equality_arel',\n 'amount_above' => 'above_number_arel',\n 'amount_below' => 'below_number_arel'\n }\n end",
"def comparer_methods\n super + [\n :four_of_a_kind_rank,\n :kicker_rank\n ]\n end",
"def <=>(other)\n self.class <=> other\n end"
] | [
"0.6768962",
"0.6676357",
"0.65216523",
"0.6515424",
"0.64881575",
"0.63542193",
"0.63537806",
"0.62864095",
"0.6270962",
"0.6234819",
"0.6209086",
"0.62059563",
"0.619499",
"0.61385083",
"0.61215836",
"0.6112204",
"0.6090393",
"0.6090393",
"0.6088981",
"0.60871416",
"0.60675645",
"0.60657114",
"0.60627586",
"0.60611826",
"0.6045089",
"0.6016346",
"0.6016346",
"0.60081327",
"0.59866476",
"0.59866476",
"0.5978401",
"0.5978146",
"0.5975367",
"0.5975367",
"0.5975367",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.59516025",
"0.5949055",
"0.59326935",
"0.5926813",
"0.58881676",
"0.5880042",
"0.5876651",
"0.58646095",
"0.58560723",
"0.58495146",
"0.58411986",
"0.5826917",
"0.58003515",
"0.57752514",
"0.576687",
"0.57541305",
"0.57525337",
"0.57463485",
"0.57442087",
"0.5687791",
"0.5685685",
"0.56808734",
"0.5671882",
"0.5656794",
"0.56551623",
"0.5650702",
"0.56492484",
"0.5643311",
"0.5638985",
"0.56360507",
"0.5627761",
"0.56222415",
"0.56220716",
"0.56216276",
"0.56168324",
"0.5612795",
"0.561163",
"0.5608924",
"0.56015134",
"0.55905193",
"0.5583709",
"0.5583164",
"0.5576685",
"0.5563063",
"0.55609",
"0.556076",
"0.555838",
"0.55577964",
"0.5556094",
"0.55258924",
"0.5525808",
"0.5522665",
"0.5520733",
"0.55175865",
"0.5511274",
"0.55042416",
"0.55010796"
] | 0.0 | -1 |
INSTANCE METHODS Returns the date the last email of a specified category was sent | def email_sent_at(category)
emails = self.email_logs.select {|e| e.category == category}
emails.collect {|e| e.created_at}.sort.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emails_sent_at(category)\r\n emails = self.email_logs.select {|e|e.category == category}\r\n emails.collect {|e| e.created_at}.sort\r\n end",
"def last_contacted\n object.channels.where(is_private: true).first.last_message_time\n end",
"def last_delivered_date_time\n return @last_delivered_date_time\n end",
"def latest_mail(options = {})\n return only_latest(mail(options))\n end",
"def get_last_message_read(group)\n unless cookies[create_last_message_key(current_user, group)].nil?\n cookies[create_last_message_key(current_user, group)].to_datetime\n else\n DateTime.now - 1.day\n end\n end",
"def time_last_received\n a = emails_received.order(\"created_at DESC\").first\n a.created_at if a\n end",
"def get_last_mailed_date\n if self.reminder_date\n self.reminder_date.strftime('%m/%d/%y')\n elsif self.first_mailed_date\n self.first_mailed_date.strftime('%m/%d/%y')\n else\n nil\n end\n end",
"def emails(category = nil)\r\n return category ? self.email_logs.select {|e| e.category == category} : self.email_logs\r\n end",
"def sent_at\n # Use date it arrived (created_at) if mail itself doesn't have Date: header\n self.mail.date || self.created_at\n end",
"def email_date\n strftime(MO.email_time_format)\n end",
"def date_of_last_comment\n last_comment = Comment.last_comment(self)\n if !last_comment.nil?\n last_comment.created_at.to_s(:custom_datetime)\n end\n end",
"def email_date; strftime(EMAIL_TIME_FORMAT); end",
"def last_build_date\n if date = @doc.at_xpath(\"rss/channel/lastBuildDate\").try(:content)\n Time.rfc822(date)\n end\n end",
"def last_subject\n each_subject.to_a.last # TODO: optimize this\n end",
"def newest\n @messages.last\n end",
"def last_message\n @last_message = self.messages.find(:first, :order => 'created_at DESC') if @last_message.nil?\n return @last_message\n end",
"def final_due_date\n del = self.deliverables\n return nil unless del.size > 0\n\n dates = del.collect(&:due).delete_if { |d| d.blank?}\n \n return dates.sort[-1] \n end",
"def last_reported_date_time\n return @last_reported_date_time\n end",
"def last_trans_date\n tr_list_by_date = @page.css(\"li[data-semantic='activity-group']\")\n date_str = tr_list_by_date[-1].css(\"h3[data-semantic='activity-group-heading']\").text\n Date.parse(date_str)\n end",
"def last_action_date_time\n return @last_action_date_time\n end",
"def last_seen_at\n @data[:last_seen_at]\n end",
"def get_last_message\r\n @messages.fetch(self.count_messages - 1)\r\n end",
"def last_sent_relevant_delivery(channel = nil, channel_group = nil)\n delivery_notices = DeliveryNotice.includes(:message)\n delivery_notices = delivery_notices.where(channel: channel) if channel\n delivery_notices = delivery_notices.where(channel_group: channel_group) if channel_group\n delivery_notices.where(subscriber_id: potential_subscriber_ids)\n .where(tparty_identifier: to_phone)\n .where.not(\"messages.type\" => Message.responding_message_types)\n .order(created_at: :desc)\n .find { |dn|\n last_sr = dn.message.subscriber_responses.order(:created_at).last\n last_sr.nil? || last_sr.created_at < dn.created_at\n }\n end",
"def get_last_modified(feed)\n\t\t\t#assume, that first entry is newest\n\t\t\tfeed.last_modified || (feed.entries[0] && feed.entries[0].published) || Time.now\n\t\tend",
"def last_message \n messages.last\n end",
"def last_fetch\n datetime_from(\"sf:last_fetch\")\n end",
"def get_last_message\n Message.showing.last\n end",
"def last_message\n @last_message ||= messages.order(:created_at => :desc, :id => :desc).first\n end",
"def created_at\n self.events.map{|e| e.created_at}.max\n end",
"def last_lesson_booking_created_at\n last_lesson_booking = lesson_bookings.order(:created_at).last\n\n last_lesson_booking ? I18n.l(last_lesson_booking.created_at.to_date) : \"\"\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def last_seen_date_time\n return @last_seen_date_time\n end",
"def set_latest_discussion\n post = self.posts.last\n if post\n cat = self.category\n cat.latest_discussion_author = post.author_name\n cat.latest_discussion_date = Time.now.to_s(:db)\n cat.save\n end\n end",
"def get_max_updated_at\r\n @summary.max_updated_at\r\n end",
"def end_date\n @raw.last.date\n end",
"def last_date_time\n case @grouping.identifier\n when :hour\n DateTime.new(@date_time.year, @date_time.month, @date_time.day, @date_time.hour, 59, 59)\n when :day\n DateTime.new(@date_time.year, @date_time.month, @date_time.day, 23, 59, 59)\n when :week\n date_time = (@date_time - @date_time.wday.days) + 7.days\n Date.new(date_time.year, date_time.month, date_time.day)\n when :month\n Date.new(@date_time.year, @date_time.month, (Date.new(@date_time.year, 12, 31) << (12 - @date_time.month)).day)\n end\n end",
"def last_updated_at\n [ self.calendar_items.accessible.maximum('nodes.created_at'), self.updated_at ].compact.max\n end",
"def email_time\n strftime(MO.email_time_format)\n end",
"def last_message\n get_json('last-message.json')\n end",
"def last_comment\n self.comments.order(:timestamp_creation => :asc).last\n end",
"def last_read_announcements_at\n @attributes[:last_read_announcements_at]\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def send_email\n \n if self.category == \"Success\"\n \n UserMailer.success_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Warning\"\n \n UserMailer.warning_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Error\"\n \n UserMailer.error_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n end\n \n end",
"def last_use_date\n @attributes.fetch('last use date', nil)\n end",
"def last_delivered_date_time=(value)\n @last_delivered_date_time = value\n end",
"def production_date(*options)\n return (@check_level_details[:is_correspondent] ? @batch.date.strftime(\"%Y%m%d\") : @check.check_date.strftime(\"%Y%m%d\"))\n end",
"def last_date\n\t\tlast_date_value = expected_end_date\n\t\tif last_report_aux = last_report\n\t\t\tif last_report_aux.created_at > expected_end_date\n\t\t\t\tlast_date_value = last_report_aux.created_at\n\t\t\tend\n\t\tend\n\n\t\tif Date.today > last_date_value\n\t\t\tlast_date_value = Date.today\n\t\tend\n\n\t\treturn last_date_value\n\tend",
"def ezm_sent_at(message)\r\n message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase\r\n end",
"def conclusion_final_review_close_date_warning\n user = User.joins(reviews: :conclusion_final_review).take\n cfrs = user.conclusion_final_reviews\n\n NotifierMailer.conclusion_final_review_close_date_warning user, cfrs\n end",
"def last_date\n events.order(:date).last.date.to_date rescue nil\n end",
"def email_time; strftime(EMAIL_TIME_FORMAT); end",
"def last_period_dates(period_type)\n send(\"last_#{period_type}_dates\")\n end",
"def last_updated_at\n RefreshReportingViews.last_updated_at_facility_daily_follow_ups_and_registrations\n end",
"def delivered_mail(pos = 1)\n ActionMailer::Base.deliveries.last(pos).first\n end",
"def last_modified_date()\n\t\tmax_update = @database.execute(\"SELECT MAX(updated) as maxmodified FROM invoices;\")\n\t\tif (DBCHOICE == 'sqlite3') then\n\t\t\treturn max_update[0][0]\n\t\telsif (DBCHOICE == 'mysqltest' || DBCHOICE == 'mysql') then\n\t\t\t# structure is hash of hashes, look for the maxmodified key in 1st record and return\n\t\t\tmax_update.each do |row|\n\t\t\t\treturn row['maxmodified']\n\t\t\tend # max_update.each\n\t\tend\n\tend",
"def time_category\n # ActionController::Base.helpers.time_ago_in_words Groupify.groupify([self], Proc.new {|ep| ep.aired_at || ep.phile.file_created_at })[0][0]\n ActionController::Base.helpers.time_ago_in_words self.aired_at\n end",
"def campaign_start_date\n badge.sending_interval.start\n end",
"def last_meeting_date\n if !self.meetings.last\n return nil\n end\n\n self.meetings.last.created_at\n end",
"def last_entry user_id\n ActivityEntry.where(user_id: user_id, activity_id: self.id).maximum(:day)\n end",
"def max\n dates.last \n end",
"def came_comment\n @user = @receiver\n link = \"/#{@comment.commentable_type.downcase.pluralize}/#{@comment.commentable.id}\"\n @notification = @user.notifications.find_by(link: link) || @user.notifications.find_by(link: \"#{link}#latest-comment\")\n mail to: @user.email, subject: \"[FBC] #{@message}\"\n end",
"def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end",
"def updated_at\n @updated_at ||= begin\n updated_dates = [self[:updated_at] || self[:created_at] || Date.null_date.to_time]\n updated_dates += self.captions.collect{|c| c.updated_at }\n \n updated_dates.compact.max\n end\n end",
"def email\n mail.first\n end",
"def email\n mail.first\n end",
"def dailydigest_email(user)\n @user = user\n\n @profile_posts, @group_posts = Post.new_day_posts(@user)\n\n # @profile_posts is an array with posts. Add an element to the beginning of the array with a string \n # declaring how many new posts the user has\n if @profile_posts.length==1\n string = \"1 new post on your profile today\" #. Answer or thank them! // www.projecthelp.co/users/\" +user.id.to_s\n @profile_posts.unshift(string)\n elsif @profile_posts.length>1\n string = @profile_posts.length.to_s + \" new posts on your profile today. Answer or thank them! // www.projecthelp.co/users/\" +user.id.to_s\n @profile_posts.unshift(string)\n end\n\n subject = \"New posts for you today\"\n # @group_posts is an array with posts. Add an element to the beginning of the array with a string \n # declaring how many new posts the user has\n @group_posts.each do |group_id, posts|\n if !posts[0].title.blank?\n subject = posts[0].title\n end\n\n if posts.length == 1\n string = \"1 new post in \" +Group.find(group_id).name+ \" today\" #. Answer or thank them! // www.projecthelp.co/groups/\" +group_id.to_s\n posts.unshift(string)\n elsif posts.length > 1\n string = posts.length.to_s+ \" new posts in \" +Group.find(group_id).name+ \" today. Answer or thank them! // www.projecthelp.co/groups/\" +group_id.to_s\n posts.unshift(string)\n end\n\n end\n\n if (@profile_posts!=nil && @profile_posts.length>0) || (@group_posts!=nil && @group_posts.length>0)\n mail :to => user.email,\n :subject => subject\n end\n end",
"def last_updated\n [updated_at, book_updated_at, photo_updated_at].compact.max\n end",
"def last_edited\n\t\tself.latest_update.to_date\n\tend",
"def message_time\n created_at.strftime(\"%m/%d/%y\")\n end",
"def last_edited\n self.latest_update.to_date\n end",
"def get_most_recent_solve_datetime\n sub = self.submissions.where(correct: true).last\n if sub\n sub.created_at\n else\n DateTime.new(0)\n end\n end",
"def sent_date_time\n return @sent_date_time\n end",
"def last_invoiced\n processed_orders.last.try(:Created)\n end",
"def newest_certificate\n self.death_certificates.where('created_at is NOT NULL').order('created_at DESC').first\n end",
"def latest_badge_date(badge)\n # Get the latest badge of this value\n latest_user_badge = @user.user_badges\n .where(badge: badge)\n .order(created_at: :desc).first\n\n latest_user_badge&.created_at || 0\n end",
"def logs_last_week(user)\n @user = user\n mail(to: @user.email, subject: 'TimeTrckr.com: Your Logs from Last Week')\n end",
"def last_seen_at() ; info_time(:last_seen) ; end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def get_last_comment(xtype = nil)\n\n return nil if self.item.nil?\n\n if self.item.comments.nil?\n return nil\n else\n\n last_comment = nil\n\n self.item.comments.each do |comment|\n\n next if xtype != nil and comment.xtype != xtype\n\n if last_comment.nil?\n last_comment = comment\n else\n if last_comment.updated_at < comment.updated_at\n last_comment = comment\n end\n end\n end\n end\n\n return last_comment\n end",
"def membership_expire_date\n memberships_manager.most_recent_membership_last_day(self)\n # payment_expire_date(THIS_PAYMENT_TYPE)\n end",
"def last_rewarding_badge_date(badge)\n last_badge =\n issued_badges\n .where(badge: badge)\n .order(created_at: :desc)\n .first\n last_badge&.created_at\n end",
"def last_dav_login_at\n @attributes[:last_dav_login_at]\n end",
"def latest_due_date\n return due_date unless section_due_dates_type\n due_dates = section_due_dates.map(&:due_date) << due_date\n due_dates.compact.max\n end",
"def date_time\n @message[:date_time]\n end",
"def date_sent\n (@date_sent ||= Time.now)\n end",
"def last_failed_payment_created_at\n last_failed_payment = payments.with_state(:declined).order(:created_at).last\n\n last_failed_payment ? I18n.l(last_failed_payment.created_at.to_date) : \"\"\n end",
"def last_update() (last_answer = answers.last) ? last_answer.time_stamp : created_at end",
"def by_mail_tracker\n end",
"def last_fixity_date_time_after\n @last_fixity_date_time_after ||= formatted_last_fixity_date_time(blacklight_params['last_fixity_date_time_after'])\n end",
"def getMail\n# gets maximum id avoiding nil case\n id = Message.maximum(:id)\n if id.nil?\n id = 0\n else\n id += 1\n end\n allMail = Mail.all #Grab all unread mail\n if !allMail.empty? #Check to see if no new mail\n allMail.each do |mail|\n#This is a method to check to see if author is from grinnell domain\n# if mail.from[0].downcase.include? (\"@grinnell.edu\")\n# if mail.subject.downcase.include? (\"csstudent\")\n message = Message.new\n message.id = id\n #Grab subject that doesn't include csstudent and other tags\n message.subject = addTag(message, mail.subject)\n message.tag_list.sort!\n message.author = mail.from[0]\n message.content = getContent(mail)\n message.created_at = mail.date.to_s\n # Makes it so both have the same time format\n message.updated_at = Time.now.strftime(\"%Y-%m-%d %H:%M\")\n message.save\n id += 1\n# end\n end\n end\n end",
"def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n end",
"def credit_note_end_at\n I18n.l(object.refunded_at.to_date)\n end",
"def message_received_date_time\n return @message_received_date_time\n end",
"def email\n if @data.attribute_names.include?(:cmupreferredmail)\n @email ||= @data[:cmupreferredmail].last\n else\n @email ||= @data[:mail].last\n end\n end",
"def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end"
] | [
"0.6987794",
"0.6244684",
"0.60381854",
"0.60023266",
"0.59639037",
"0.59062535",
"0.58860993",
"0.58854175",
"0.57728815",
"0.5771505",
"0.5694127",
"0.5636091",
"0.5574436",
"0.5558278",
"0.55399436",
"0.54809076",
"0.5477554",
"0.5466854",
"0.54450583",
"0.5421657",
"0.5405584",
"0.5403816",
"0.54036236",
"0.5391478",
"0.5380963",
"0.53573066",
"0.534594",
"0.5339839",
"0.53170127",
"0.5309",
"0.5296037",
"0.5296037",
"0.5296037",
"0.5282374",
"0.526503",
"0.5257375",
"0.52373534",
"0.5228455",
"0.52224445",
"0.5203467",
"0.52017796",
"0.5191786",
"0.5183348",
"0.5183348",
"0.51821643",
"0.51813143",
"0.5170007",
"0.5169043",
"0.5168156",
"0.51676816",
"0.5167187",
"0.51589894",
"0.51480764",
"0.5146459",
"0.514569",
"0.513239",
"0.5118879",
"0.5118675",
"0.5110155",
"0.51055217",
"0.5099151",
"0.5092963",
"0.50767964",
"0.5066869",
"0.5058695",
"0.5057536",
"0.5057536",
"0.5052756",
"0.50477815",
"0.5044853",
"0.5039152",
"0.5034072",
"0.50278115",
"0.5025817",
"0.5020144",
"0.50179154",
"0.50155973",
"0.5015028",
"0.5013151",
"0.501095",
"0.501095",
"0.501095",
"0.501095",
"0.49966404",
"0.49861407",
"0.49838942",
"0.49800313",
"0.49728298",
"0.4967436",
"0.49667853",
"0.49636534",
"0.49544802",
"0.4954318",
"0.4953288",
"0.49466917",
"0.4921528",
"0.49175072",
"0.4910338",
"0.49094474",
"0.49078703"
] | 0.80622375 | 0 |
Returns an array of the dates the email of a specified category was sent | def emails_sent_at(category)
emails = self.email_logs.select {|e|e.category == category}
emails.collect {|e| e.created_at}.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_sent_at(category)\r\n emails = self.email_logs.select {|e| e.category == category}\r\n emails.collect {|e| e.created_at}.sort.last\r\n end",
"def emails(category = nil)\r\n return category ? self.email_logs.select {|e| e.category == category} : self.email_logs\r\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def mails_by_month(month)\n month_emails = self.email_tracks.where('extract(month from created_at) = ?', month).order(created_at: :desc)\n end",
"def day_log(day)\n @url = url_for(:controller => 'worklogs', :action => 'index', :day => day)\n @all_users = User.status(\"1\").where(\"id > 1\") #.all - User.find(1)\n recipients = @all_users.collect(&:mail)\n \n @day = day || Date.today.to_s\n @worklogs = Worklog.where(\"status = 0\").where(\"typee = 0\").where(:day => @day)\n \n @sended_user_ids = @worklogs.collect(&:user_id).uniq\n # @no_need_users_ids = [1,61,55,46]\n @no_need_users_ids = Worklog.no_need_users_ids\n @need_user_ids = @all_users.collect(&:id) - @no_need_users_ids\n @unsended_users = User.find(@need_user_ids - @sended_user_ids)\n \n #recipients\n mail :to => recipients ,\n :cc => Setting.plugin_worklogs['WORKLOGS_MAIL_CC'],\n :subject => l(:mail_subject_worklog_day, day)\n end",
"def chart_days\n daily_requests = self.daily_requests.limit(10)\n days = daily_requests.map(&:created_at)\n days.map { |d| d.strftime(\"%b %e\") }\n end",
"def day_posted_for_purchase\n @day = params[:day]\n @buyer = @day.buyer\n @url = \"https://chickpeas.herokuapp.com/days\"\n\n buyer_parent_ids = @buyer.parents.map(&:id)\n # email to all parents other than those posting\n emails = Parent.all_current_with_active_email_except(buyer_parent_ids)\n send_mail(to: emails, subject: \"Someone wants to buy a Chickpeas Day\")\n end",
"def attendance_logs_by_date\n attendance_logs.group_by { |al| al.occured_at.strftime(\"%F\") }\n end",
"def scheduled_emails\n @chat_history = EmailConversation.where(\"sender_id = #{current_user.id} AND sent_date is not null\")\n end",
"def send_email\n \n if self.category == \"Success\"\n \n UserMailer.success_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Warning\"\n \n UserMailer.warning_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Error\"\n \n UserMailer.error_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n end\n \n end",
"def failed_email_delivery_contacts\n \n failed_email_delivery_contacts = Array.new \n \n mailout_contacts.each do |mc|\n failed_email_delivery_contacts.push(mc) if !mc.delivery_timestamp.blank? && mc.delivery_failed\n end\n \n return failed_email_delivery_contacts\n end",
"def todays_calories\n array = self.daily_logs.map do |log|\n if log.date == Date.today\n return log.calories \n # else \"No calories logged for today's date\"\n else \"0 Days left, please check your bet dash\"\n end\n end\n return array[0]\n end",
"def dailydigest_email(user)\n @user = user\n\n @profile_posts, @group_posts = Post.new_day_posts(@user)\n\n # @profile_posts is an array with posts. Add an element to the beginning of the array with a string \n # declaring how many new posts the user has\n if @profile_posts.length==1\n string = \"1 new post on your profile today\" #. Answer or thank them! // www.projecthelp.co/users/\" +user.id.to_s\n @profile_posts.unshift(string)\n elsif @profile_posts.length>1\n string = @profile_posts.length.to_s + \" new posts on your profile today. Answer or thank them! // www.projecthelp.co/users/\" +user.id.to_s\n @profile_posts.unshift(string)\n end\n\n subject = \"New posts for you today\"\n # @group_posts is an array with posts. Add an element to the beginning of the array with a string \n # declaring how many new posts the user has\n @group_posts.each do |group_id, posts|\n if !posts[0].title.blank?\n subject = posts[0].title\n end\n\n if posts.length == 1\n string = \"1 new post in \" +Group.find(group_id).name+ \" today\" #. Answer or thank them! // www.projecthelp.co/groups/\" +group_id.to_s\n posts.unshift(string)\n elsif posts.length > 1\n string = posts.length.to_s+ \" new posts in \" +Group.find(group_id).name+ \" today. Answer or thank them! // www.projecthelp.co/groups/\" +group_id.to_s\n posts.unshift(string)\n end\n\n end\n\n if (@profile_posts!=nil && @profile_posts.length>0) || (@group_posts!=nil && @group_posts.length>0)\n mail :to => user.email,\n :subject => subject\n end\n end",
"def todays_deliverables\n self.deliverables.where('DATE(created_at) = ?', Date.today)\n end",
"def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end",
"def mails_per_day\n all_mpd = {}\n @senders.each do |name, value|\n # next sender it the current sender has no mails\n next if value.mails.empty?\n \n alldates = []\n value.mails.each {|i| alldates << i.date }\n alldates.sort!\n \n # get the date of the first (=oldest) mail\n since = alldates[0]\n # get the date of today\n now = Date.today()\n # how many days is the first mail old?\n duration = (now - since)\n # divide the number of mails by the duration\n mpd = (value.mails.length / duration).to_f\n # add the mail-per-day value to the dict\n all_mpd[name] = mpd\n end\n \n # sort from biggest to smallest\n all_mpd = all_mpd.sort {|a,b| b[1] <=> a[1] }\n \n puts \"Mails-per-day results of #{all_mpd.length} processed authors:\"\n \n all_mpd.each do |person, mpd|\n dpm = 1 / mpd\n puts \"#{person}: #{sprintf('%0.3f', mpd)} mails/day = #{sprintf('%0.1f', dpm)} days/mail\"\n end\n end",
"def dates\n entries = Entry.all\n $dates_array = Array.new\n entries.each do |entry|\n $dates_array << entry.created_at.strftime(\"%Y-%m-%d\")\n end\n $dates_array.uniq\n end",
"def daily_email\n mail(to: 'john.henderson@stackedsports.com,ben@stackedsports.com', subject: 'Recruit Suite Daily Offer & Commit Tweets')\n end",
"def delivery_days_to\n hash[\"DeliveryDaysTo\"]\n end",
"def sent_at\n # Use date it arrived (created_at) if mail itself doesn't have Date: header\n self.mail.date || self.created_at\n end",
"def send_mail_to_attendees_on_update\n if self.category.eql?(\"appointment\")\n if self.changed.include?(\"start_date\") or self.changed.include?(\"attendees_emails\") or self.changed.include?(\"repeat\") or self.changed.include?(\"count\") or self.changed.include?(\"until\")\n user = self.matter_people.assignee\n if self.attendees_emails\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_update_notificaton_to_attendees(user, self, i)\n end\n end\n\n true\n end\n end\n end",
"def campaign_start_date\n badge.sending_interval.start\n end",
"def day_meetings\n days = []\n @course.weekdays.each_char.each_with_index do |w, i|\n days.push(DAYS_AS_SYM[i]) if w.to_i == 1\n end\n days\n end",
"def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end",
"def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end",
"def send_mail_to_attendees_on_create\n if self.category.eql?(\"appointment\") and !self.attendees_emails.blank?\n user = self.matter_people.assignee\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_notificaton_to_attendees(user, self, i)\n end\n\n true\n end\n end",
"def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end",
"def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end",
"def dates\n if @dates.nil?\n first_post = MailingList.connection.select_value(\"select min(date) from posts\")\n if first_post\n last_post = MailingList.connection.select_value(\"select max(date) from posts\")\n @dates = first_post..last_post\n end\n end\n @dates\n end",
"def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end",
"def activity_log_non_student_time_categories_array\n activity_log_non_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def aggregate_attendees_list(duration=1.day)\n\t\tstart_time = Time.now - duration\n\t\tself.attendees_events.select { |c| c.created_at >= start_time }\n\tend",
"def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end",
"def email_date\n strftime(MO.email_time_format)\n end",
"def activity_log_student_time_categories_array\n activity_log_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def get_schedule_url_postfixes( city, category )\n dates = []\n schedule_dates_url = [@host_url, city, \"schedule_#{category}\\/\"].join('/')\n doc = nil\n retry_if_exception do\n doc = Nokogiri::HTML( easy_curl(schedule_dates_url) )\n end\n return [] if not doc\n a_dates = doc.xpath(\"//div[@id='content']//div[@class='m-schedule-top-mrg'][1]//select[contains(@id, 'DateNavigator')][1]/option\")\n a_dates.each do |a_date|\n dates.push( a_date['value'] )\n end\n dates\nend",
"def get_attendees()\n\t\turl = request.referrer.split(\"/\")\t# Get the URL of where the request CAME from, not the url that was requested.\n redis_key = url[-1].to_s + \":\" + url[-2].to_s + \":emails\";\n\t\tattendees = $redis.lrange(redis_key,0,-1)\n\t\tattendees.uniq!\n\t\tlogger.error \"@@@@@@@@@@@@ ATTENDEES: \" + attendees.to_s\n\t\treturn attendees\n\tend",
"def email_students\n date = params[:date][:send_email]\n reminder = params[:date][:reminder]\n #@emails = Survey.pluck(:student_email)\n @surveys = Survey.where.not(student_email: nil)\n\n if date == \"0\"\n delay = 0\n\n elsif date == \"1\"\n delay = Date.tomorrow.noon\n\n elsif date == \"2\"\n delay = 2.days.from_now.noon\n\n else\n delay = 1.week.from_now.noon\n end\n\n @surveys.each do |survey|\n #survey = Survey.find_by(student_email: email)\n section = Section.find_by(class_num: survey.class_num)\n if reminder == \"0\"\n StudentMailer.eval_email(survey, section).deliver_later(wait_until: delay)\n else\n StudentMailer.eval_reminder(survey, section).deliver_later(wait_until: delay)\n end\n\n end\n end",
"def emails_send_to\n (emails + [cc.presence]).compact.uniq.to_sentence\n end",
"def argument_daily_digest\n subscriptions = Subscription.find(:all , :conditions => ['status = 1 && daily_digest = 1 && argument_id is not null'])\n subscriptions.each do |sub|\n Mailers::Debate.deliver_send_subscription_email(\"\",sub.argument,sub,HOST_DOMAIN)\n end\n end",
"def days_assigned\r\n days_assigned = []\r\n self.groups.each {|g| days_assigned.push(g.day)}\r\n return days_assigned\r\n end",
"def group_by_day\n\n\tend",
"def get_all_redemptions(start_date, end_date)\n redemption_counts = Redemption.where(created_at: start_date..end_date).count\n formatted_rc = Array.new\n formatted_rc.push end_date.to_f * 1000\n formatted_rc.push redemption_counts\n formatted_rc\n end",
"def send_family_summaries\n @title = 'Send summaries'\n date_selection_filter = [\"summary_sent IS ? OR (? - summary_sent) > ?\", nil,\n Date.today, Settings.family.info_summary_interval]\n recipients = Family.those_active.where(date_selection_filter)\n @messages = []\n recipients.each do |family|\n if family.email\n @messages << Notifier.send_family_summary(family) \n family.update_attribute(:summary_sent, Date.today)\n#puts \"**Summary_sent set to #{family.reload.summary_sent}\"\n end\n end\n @messages.each {|m| m.deliver}\n flash[:notice] = \"Sent #{@messages.count} family summary messages\"\n redirect_to families_path\n end",
"def daily_deals\n\n # all categories from the database\n @categories = Category.all\n\n # daily deals grouped by product category\n if ((current_user.user_type == User::USER_DONOR) && (current_user.npo_id))\n @daily_deals_by_category = Deal.where(:is_daily_deal => 1, :npo_id => current_user.npo_id).group_by{ |d| d.product.category }\n end\n end",
"def by_mail_tracker\n end",
"def index\n @dates = AudioMessage.active\n .where(\"event_date is not null\")\n .group(\"date_format(audio_messages.event_date,'%Y')\")\n .order(\"audio_messages.event_date DESC\")\n .count\n # Peek at most recent load date\n @latest_addition_date = AudioMessage.maximum('created_at')\n end",
"def category(period, category) \n category = [category].flatten\n \n list = []\n category.uniq.each do |c|\n list << keys.select { |k| k.category == c and k.period == period }\n end\n \n return list.flatten!\n end",
"def date_group_items\n @date_group_items ||= []\n end",
"def filter_mail(email, threaded=false)\n\n unless check_email_addresses(email) #first check if email address matches category\n check_subject_and_body(email) #Second check each word in subject and body against keywords in categories\n end\n\n if !threaded\n email.save\n email.category.cases << email.case\n end\n\n return email\n end",
"def category categories\n categories = categories.to_a if !categories.is_a? Array\n categories.collect { |i| calendars.find_by_title i.to_s }.compact\n end",
"def events_on(day)\n ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq\n end",
"def date\n success ? { 'datesent' => sent } : {}\n end",
"def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end",
"def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end",
"def yearly\n NewsletterMailer.yearly\n end",
"def email_date; strftime(EMAIL_TIME_FORMAT); end",
"def production_date(*options)\n return (@check_level_details[:is_correspondent] ? @batch.date.strftime(\"%Y%m%d\") : @check.check_date.strftime(\"%Y%m%d\"))\n end",
"def show\n @event_data_by_category_and_minute = Event.where(whatspp_message_id: @whatspp_message_ids).group(:category).group_by_minute(:created_at).count\n @event_data_by_category = Event.where(whatspp_message_id: @whatspp_message_ids).group(:category).count\n end",
"def get_dates(arr) \ndayDifference = Date.today - 7.days\narr.select do |d| \nif d.created_at.to_date > dayDifference \n d \n end\nend \nend",
"def started_at\n [contact_date_date, contact_start_time]\n end",
"def event_disposition_category_for_contact\n if multiple_unique_events_for_contact?\n # GENERAL_STUDY_VISIT_EVENT\n NcsCode.for_list_name_and_local_code('EVENT_DSPSTN_CAT_CL1', 3)\n else\n event_type_code = contact_links.last.try(:event).try(:event_type_code)\n DispositionMapper.determine_category_from_event_type(event_type_code)\n end\n end",
"def message_subjects\n list = []\n active_div.divs(:class=>\"inbox_subject\").each do |div|\n list << div.text\n end\n return list\n end",
"def group_by_day\n created_at.to_date\n end",
"def event_categories\n data.event_categories\n end",
"def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end",
"def data_for(date)\n UseLog::Data.find_all_by_date(date).collect do |log|\n [log.category, log.count]\n end\n end",
"def can_send_mail\n month_emails = self.mails_by_month(Time.now.month)\n if(month_emails.count < self.setting_email_count_month )\n return true if month_emails.count == 0\n last_email_sent = month_emails.first.created_at\n (mail_duration(last_email_sent) >= self.setting_email_duration) ? true : false\n else\n false\n end\n end",
"def search_time_series(params)\n begin\n \n query = \"email:gmail.com\"\n date_from = params[:from_date]#\"2013-01-01\"\n date_to = params[:to_date]#\"2013-01-02\"\n tags = params[:tags]#[\"password-reset\", \"welcome\"]\n senders = params[:senders]#[\"sender@example.com\"]\n result = @mandrill.messages.search_time_series query, date_from, date_to, tags, senders\n # [{\"unique_opens\"=>42,\n # \"unsubs\"=>42,\n # \"clicks\"=>42,\n # \"time\"=>\"2013-01-01 15:00:00\",\n # \"complaints\"=>42,\n # \"rejects\"=>42,\n # \"soft_bounces\"=>42,\n # \"hard_bounces\"=>42,\n # \"sent\"=>42,\n # \"unique_clicks\"=>42,\n # \"opens\"=>42}]\n\n rescue Mandrill::Error => e\n # Mandrill errors are thrown as exceptions\n puts \"A mandrill error occurred: #{e.class} - #{e.message}\"\n # A mandrill error occurred: Mandrill::ServiceUnavailableError - Service Temporarily Unavailable\n raise\n end\n end",
"def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end",
"def final_due_date\n del = self.deliverables\n return nil unless del.size > 0\n\n dates = del.collect(&:due).delete_if { |d| d.blank?}\n \n return dates.sort[-1] \n end",
"def get_emails(emails,incidente)\n return ['informatica@botica.com.py'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"no-responder@botica.com.py\"]\n end\n mails1.concat(mails2).uniq\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def day_put_on_sale\n @day = params[:day]\n @seller = @day.seller\n @url = \"https://chickpeas.herokuapp.com/days\"\n\n seller_parent_ids = @seller.parents.map(&:id)\n # email to all parents other than those posting\n emails = Parent.all_current_with_active_email_except(seller_parent_ids)\n send_mail(to: emails, subject: \"A New Chickpeas Day is Up For Sale\")\n end",
"def time_category\n # ActionController::Base.helpers.time_ago_in_words Groupify.groupify([self], Proc.new {|ep| ep.aired_at || ep.phile.file_created_at })[0][0]\n ActionController::Base.helpers.time_ago_in_words self.aired_at\n end",
"def dates\n @dates ||= text.select do |line|\n line =~ @date_pattern \n end.map do |line|\n line[@date_pattern]\n end.uniq.first\n end",
"def message_date\n active_div.div(:id=>\"inbox_show_message\").div(:class=>\"inbox_date\").span.text\n end",
"def send_on_date(n_weeks)\n today = category.user.today\n send_on_date = today + n_weeks * 7 + (send_on - today.wday % 7)\n send_on_date += 7 if today.wday > send_on\n send_on_date\n end",
"def get_start_and_end_dates(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"When\" && \"Tickets\")\n description = description.split(\"When\")[1].split(\"Tickets\")[0]\n datetimes = description.gsub(\";\", \",\").split(\",\")\n @additional_datetimes = datetimes[1..-1].join(\",\") if datetimes.size > 1\n get_event_datetimes(datetimes[0])\n else\n [nil, nil]\n end\n else\n [nil, nil]\n end\n end",
"def requests_per_day\n group_by_day.map { |date, ents|\n [date, ents.size]\n }.sort { |a,b|\n a[0] <=> b[0]\n }\n end",
"def get_sent_mailings_for_org(options={})\n raise ArgumentError, \":date_start is required\" unless options.has_key?(:date_start)\n raise ArgumentError, \":date_end is required\" unless options.has_key?(:date_end)\n\n options[:date_start] =\n options[:date_start].utc.strftime(\"%m/%d/%Y %H:%M:%S\") unless options[:date_start].is_a?(String)\n options[:date_end] =\n options[:date_end].utc.strftime(\"%m/%d/%Y %H:%M:%S\") unless options[:date_end].is_a?(String)\n\n request_body = String.new\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetSentMailingsForOrg do\n apply_xml_options!(xml, options)\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)[\"Mailing\"] || []\n end",
"def emails\n public_instance_methods(false).map(&:to_s).sort\n end",
"def emails\n public_instance_methods(false).map(&:to_s).sort\n end",
"def filter_messages(json, start_date, end_date)\n return json if start_date.nil? && end_date.nil?\n to_ret = Array.new\n json.each do | message |\n message_date = Date.strptime(message[\"created_at\"].to_s, '%s')\n if message_date >= start_date && message_date <= end_date\n to_ret << message\n end\n end\n return to_ret\nend",
"def available_emails\n sent_emails = StudioEmail.sent_to(self).collect(&:email_name).collect(&:to_sym)\n Notifier.studio_emails - sent_emails\n end",
"def collect_messages(email, password, label, criteria, save_attachments)\n messages = []\n\n gmail = Gmail.connect(email, password)\n\n begin\n criteria.each do |c|\n messages += fetch_messages(gmail, label, c, save_attachments)\n end\n rescue Exception => e\n puts e.inspect\n ensure\n gmail.logout\n end\n messages\n end",
"def published_content_stats(start_time, end_time)\n start_time = start_time.to_i\n end_time = end_time.to_i\n arr = []\n @content_deliveries = ContentDelivery.where(\"user_id=? and created_at >=? and created_at < ? and message_id is NOT ? \", self.id, start_time, end_time, nil)\n @content_deliveries.each do |c|\n begin\n book_metadata = c.ibook.get_metadata\n uri = c.uri.split(\"/\") if c.uri.present?\n location = uri\n location.pop\n location.shift\n\n arr << [self.edutorid + \" (#{self.name})\", self.class.name , self.academic_class.present? ? self.academic_class.name : \"NA\", self.section.present? ? self.section.name : \"NA\",\n c.group_id.present? ? User.find(c.group_id).name : c.recipients,\n book_metadata[\"displayName\"],book_metadata[\"subject\"],book_metadata[\"academicClass\"],\n uri.last,c.user_asset.nil? ? \"NA\" : c.user_asset.asset_name,\n c.published_as,\"NA\",Time.at(c.created_at).to_formatted_s(:long),\n c.group_id.present? ? User.find(c.group_id).students.size : (c.recipients.nil? ? \"NA\" : c.recipients.split(\",\").size),\n c.group_id.present? ? c.message.message_sync_count(c.group_id) : (c.recipients.nil? ? \"NA\" :c.message.message_sync_individual_count(c.recipients)),\n c.message.assets.empty? ? \"NA\" : c.message.assets.last.attachment.url , c.published_to_inbox_or_toc,\n location[0].present? ? location[0] : \"NA\",\n location[1].present? ? location[1] : \"NA\", location[2].present? ? location[2] : \"NA\"]\n rescue\n next\n end\n end\n arr\n end",
"def delivery_days_from\n hash[\"DeliveryDaysFrom\"]\n end",
"def all_grouping_collection_dates\n submission_rule_hours = submission_rule.periods.pluck('periods.hours').sum.hours\n no_penalty = Set.new(groupings.joins(:extension).where('extensions.apply_penalty': false).pluck(:id))\n collection_dates = Hash.new { |h, k| h[k] = due_date + submission_rule_hours }\n all_grouping_due_dates.each do |grouping_id, grouping_due_date|\n if no_penalty.include? grouping_id\n collection_dates[grouping_id] = grouping_due_date\n else\n collection_dates[grouping_id] = grouping_due_date + submission_rule_hours\n end\n end\n collection_dates\n end",
"def notify_groups_for_alert(alert)\n @alert = alert\n groups = Group.where(id: alert.groups_alerted)\n\n users = groups.inject([]) do |users, group|\n users += group.users\n end.uniq\n\n user_emails = users.map(&:email)\n\n mail bcc: user_emails, subject: \"Alerta de inventário de item\"\n end",
"def this_period_dates(period_type)\n send(\"this_#{period_type}_dates\")\n end",
"def monthly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"to@example.org\"\n end",
"def getDatesToDisplay()\n\n\t\tnumDays = 10\n\t\tretDays = []\n\n\t\tfor i in 0..10\n\t\t\ta_date = (DateTime.now + i.days)\n\t\t\tretDays.push(a_date)\n\t\tend\n\n\t\treturn retDays\n\tend",
"def category_names_of_subject subject, &block\n categories_of_subject(subject).keys\n end",
"def category\n business_event_category\n end",
"def date_of_service(service)\n notification = Notification.find_by_name()\n vehicle = service.fleet\n setting = vehicle.truck_fleet.setting.email_notifications.find_by_notification_id(notification.id)\n emails = self.find_emails(vehicle, setting)\n \n if emails.present?\n mail :to => emails,\n :subject => \"Service is today. For #{vehicle.fleet_number}\"\n end\n end",
"def latest_mail(options = {})\n return only_latest(mail(options))\n end",
"def fetch_month_sheets()\n date = Date.today\n days_in_month = date.end_of_month.day\n for day in ('1'..days_in_month.to_s).to_a\n range = day + \"!\" + ENV[\"CELL_RANGE\"]\n info_list = get_sheet_response(range)\n detect_change_send_email(info_list)\n end \nend"
] | [
"0.8045334",
"0.7213177",
"0.59212357",
"0.5675265",
"0.56417847",
"0.5412332",
"0.53950673",
"0.5337325",
"0.5273472",
"0.527337",
"0.52124107",
"0.52004474",
"0.51962835",
"0.5196167",
"0.5133509",
"0.50920033",
"0.5091613",
"0.5084544",
"0.5077146",
"0.5075498",
"0.5065847",
"0.506388",
"0.5062836",
"0.5053389",
"0.5053389",
"0.5034623",
"0.5034025",
"0.5019856",
"0.50103873",
"0.5006291",
"0.49804214",
"0.49797422",
"0.49783662",
"0.4973437",
"0.49597457",
"0.49513432",
"0.49376842",
"0.49347883",
"0.49346825",
"0.4932954",
"0.49177596",
"0.49083373",
"0.49048662",
"0.48975965",
"0.48955995",
"0.48844597",
"0.4876911",
"0.48719862",
"0.4865353",
"0.48593718",
"0.4842248",
"0.48399508",
"0.48366258",
"0.48344398",
"0.48328844",
"0.4831467",
"0.4831467",
"0.48296705",
"0.48294482",
"0.48280904",
"0.48209947",
"0.48130333",
"0.4810315",
"0.48036748",
"0.4801892",
"0.47853562",
"0.4785283",
"0.4784707",
"0.47846976",
"0.47812012",
"0.47786483",
"0.47771516",
"0.47740576",
"0.47714043",
"0.47692725",
"0.47621775",
"0.47617215",
"0.47572008",
"0.4755016",
"0.47525436",
"0.4752061",
"0.4751955",
"0.47512677",
"0.47476372",
"0.47476372",
"0.47453",
"0.47437316",
"0.47379583",
"0.47347012",
"0.4728632",
"0.47219434",
"0.4717707",
"0.47140738",
"0.471357",
"0.47133738",
"0.47082308",
"0.47004595",
"0.46889004",
"0.4679136",
"0.46759266"
] | 0.8071173 | 0 |
Returns all emails or all emails of a specified category (if given) | def emails(category = nil)
return category ? self.email_logs.select {|e| e.category == category} : self.email_logs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_sent_at(category)\r\n emails = self.email_logs.select {|e| e.category == category}\r\n emails.collect {|e| e.created_at}.sort.last\r\n end",
"def index\n @emails = Email.where(\"category=?\", current_user.id%2).paginate(:page => params[:page])\n # @emails = Email.where(\"category=?\", current_user.id%2)\n end",
"def emails_sent_at(category)\r\n emails = self.email_logs.select {|e|e.category == category}\r\n emails.collect {|e| e.created_at}.sort\r\n end",
"def filter_mail(email, threaded=false)\n\n unless check_email_addresses(email) #first check if email address matches category\n check_subject_and_body(email) #Second check each word in subject and body against keywords in categories\n end\n\n if !threaded\n email.save\n email.category.cases << email.case\n end\n\n return email\n end",
"def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end",
"def check_email_addresses(email)\n @all_categories.each do |cat|\n cat.email_accounts.each do |account|\n #see if theres a matching email address\n if account.email_address.downcase.eql? email.to.downcase\n attach_category_to_email(email,cat)\n return true\n end\n end\n end\n return false\n end",
"def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end",
"def all_email(email)\n content = \"\"\n address = email\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n content << \"#{task.title}\\n\"\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n unless content.empty?\n mail(to: address, subject: \"Your Tasks\", body: content)\n end\n end",
"def find_emails(opts)\n emails.reverse.select do |email|\n email.to.include?(opts[:to]) || email.subject == opts[:subject]\n end\n end",
"def collect_messages(email, password, label, criteria, save_attachments)\n messages = []\n\n gmail = Gmail.connect(email, password)\n\n begin\n criteria.each do |c|\n messages += fetch_messages(gmail, label, c, save_attachments)\n end\n rescue Exception => e\n puts e.inspect\n ensure\n gmail.logout\n end\n messages\n end",
"def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end",
"def getEmailsByRecipient(recipientEmail)\n searchCriteria = Hash.new\n searchCriteria['recipient']= recipientEmail\n return getEmails(searchCriteria)\n end",
"def scrape_all_emoji_in_category!(category, delay = 2)\n scrape_all_emoji_in_category(@all_emoji[category], delay)\n end",
"def getEmails(searchCriteria = Hash.new)\n if searchCriteria.is_a? String\n search = searchCriteria\n searchCriteria = Hash.new\n searchCriteria['search'] = search\n end\n searchCriteria['key'] = @API_KEY\n searchCriteria['mailbox'] = @MAILBOX\n for i in 1..10\n response = RestClient.get(\"#{@BASE_URI}/emails\", {:params => searchCriteria})\n data = JSON.parse(response.body)\n emails = data.map { |em| Email.new(em) }\n\n if !emails.nil? && emails.length>0\n return emails\n end\n # back off and retry\n sleep(i*i)\n end\n end",
"def get_emails(emails,incidente)\n return ['informatica@botica.com.py'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"no-responder@botica.com.py\"]\n end\n mails1.concat(mails2).uniq\n end",
"def all_organizations_emails\n orgs = apply_forms.accepted.select(:organization_id).map(&:organization_id)\n mails = EmailContact.incoming.where('organization_id in (?)',orgs).select(:address).map(&:address)\n mails.join(', ')\n end",
"def getMails(groups, users, mails)\n mails = getGroupsMails(groups, mails)\n mails = getUsersMails(users, mails)\n mails = mails.uniq\n return mails\n end",
"def items_with_category(category, items=nil)\n items = @items if items.nil?\n items.select { |item| has_category?( item, category ) }\n end",
"def search_emails(search, subject)\n @gmail.in_mailbox(self) do\n email_results = @gmail.imap.uid_search(search).collect { |uid| messages[uid] ||= Message.new(@gmail, self, uid) }\n # If subject is not nil, filter results by subject and mark the rest of the emails as unread.\n if subject\n result = email_results.select {|email| email.subject == subject} \n email_results.reject {|email| email.subject == subject}.each do |email|\n email.mark(:unread)\n end\n return result\n end\n return email_results\n end\n end",
"def meals_by_category(category)\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/filter.php?c=Seafood\n content = api_call(\"filter.php?c=#{category}\")\n validate(content)\n content\n end",
"def get_emails(limit = 100, offset = 0, conditions = {})\n params = extract_query_params conditions\n\n params['limit'] = limit\n params['offset'] = offset\n\n request :get, \"/v3/emails.json\", params\n end",
"def get_emails_by_recipient(recipient_email)\n search_criteria = {'recipient' => recipient_email}\n get_emails(search_criteria)\n end",
"def all_without_email\n\n end",
"def get_emails(search_criteria = {})\n if search_criteria.is_a? String\n search_criteria = {'search' => search_criteria}\n end\n search_criteria['key'] = @api_key\n search_criteria['mailbox'] = @mailbox\n response = send_get_emails_request(search_criteria)\n if response.length > 2\n data = JSON.parse(response.body)\n data.map { |em| Email.new(em) }\n else\n message.no_emails_found(search_criteria)\n end\n end",
"def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend",
"def articles_with_category(category, posts=articles)\n posts.select { |article| has_category?(category, article) }\n end",
"def emails_send_to\n (emails + [cc.presence]).compact.uniq.to_sentence\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def employee\n result = contact_categories.first(:conditions => {:category_type => Employee.to_s})\n result ? result.category : nil\n end",
"def get_emails\n emails = [self.email1, self.email2, self.email3]\n emails.compact!\n emails.delete('')\n return emails\n end",
"def get_all_emails\n urls = get_all_the_urls_of_val_doise_townhalls\n emails = []\n\n urls.each do |url|\n emails << get_the_email_of_a_townhal_from_its_webpage(url)\n end\n\n emails\nend",
"def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend",
"def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend",
"def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend",
"def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend",
"def index\n @category = params[:category]\n if @category\n @category_s = Item.categories_s(@category)\n @items = @course.items.find(:all, :conditions => [\"lower(category) IN (?)\", @category.downcase.split(' ')])\n else\n @category_s = 'All Items'\n @items = @course.items\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end",
"def send_email\n \n if self.category == \"Success\"\n \n UserMailer.success_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Warning\"\n \n UserMailer.warning_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Error\"\n \n UserMailer.error_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n end\n \n end",
"def get_ldap_user_attributies_by_email_alias(email:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('proxyaddresses', \"smtp:#{email}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n return response # Only want the first entry\n end\n return nil\n end",
"def get_sms_list\n if(self.category_id == 1)\n users = User.where(:subscribed_to_sms => true, :faculty_meetings => true)\n elsif(self.category_id == 2)\n users = User.where(:subscribed_to_sms => true, :cpcb_seminars => true)\n elsif(self.category_id == 3)\n users = User.where(:subscribed_to_sms => true, :miscellaneous => true)\n elsif(self.category_id == 4)\n users = User.where(:subscribed_to_sms => true, :csb_seminars => true)\n else\n users = User.all\n end\n end",
"def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end",
"def user\n result = contact_categories.first(:conditions => {:category_type => User.to_s})\n result ? result.category : nil\n end",
"def get_ldap_user_attributies_by_email(email:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('mail', \"#{email}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n return response # Only want the first entry\n end\n return nil\n end",
"def all_emails(current_user)\n mails = []\n self.users.map{ |u| mails << u.email unless u == current_user || !u.accepting_emails }.compact.join(\", \")\n end",
"def category_of_subject subject, &block\n found_cat = categories.select {|cat| cat.include? subject }\n yield found_cat if cat && block\n found_cat\n end",
"def get_category_newsgroup(category)\n case category\n when \"sell\"\n \"tori.myydaan\"\n when \"buy\"\n \"tori.ostetaan\"\n when \"give\"\n \"tori.myydaan\"\n when \"lost\"\n \"tori.kadonnut\"\n when \"rides\"\n \"tori.kyydit\"\n else\n nil \n end \n end",
"def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def scrape_category_page!(category, category_url)\n @all_emoji[category] = scrape_category_page(category_url)\n end",
"def articles_by_category(posts=articles)\n cats = []\n all_categories.each do |cat|\n cats << [cat, articles_with_category(cat)]\n end\n cats\n end",
"def all_emails\n User.pluck(:email)\n end",
"def all(*args, &block)\n Mail.all(*args, &block)\n end",
"def index\n @emails = DirectEmail.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end",
"def get_contact_emails\n if @info == nil || !(@info.key? \"contacts\")\n return Array.new\n end\n \n return @info[\"contacts\"]\n end",
"def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end",
"def index\n @emails = Email.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end",
"def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end",
"def chimp_batch_subscribe(batch, email_content_type=\"html\", double_optin=true, update_existing=true, replace_interests=false)\n begin\n @client.call(\"listBatchSubscribe\", @api_key, @mailing_list_id, batch, double_optin, update_existing, replace_interests)\n rescue XMLRPC::FaultException => e\n raise MailChimpAPI::CreateError, e.faultString\n end \n end",
"def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end",
"def category\n if self.channel.generator == 'Twitter'\n return self.categories.join(', ')\n end\n return '' if @item.categories.empty? \n @item.categories.collect{|c| c.content}.join(', ')\n end",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend",
"def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end",
"def index\n all_mail_users =\n case @type\n when 'applicable'\n @recipient_list.applicable_mail_users\n when 'included'\n @recipient_list.included_mail_users\n when 'excluded'\n @recipient_list.excluded_mail_users\n end&.order(:name)\n\n @mail_users =\n if params[:page] == 'all'\n all_mail_users&.page(nil)&.per(all_mail_users&.count)\n else\n all_mail_users&.page(params[:page])\n end\n\n flash.alert = '指定のリストはありません。' if @mail_users.nil?\n end",
"def get_related_to(category)\n raise \"Cannot do a look-up with a blank category!\" if category.blank?\n collection = self.class.new\n collection.kinds = @kinds.get_related_to(category)\n collection.mixins = @mixins.get_related_to(category)\n collection\n end",
"def category(period, category) \n category = [category].flatten\n \n list = []\n category.uniq.each do |c|\n list << keys.select { |k| k.category == c and k.period == period }\n end\n \n return list.flatten!\n end",
"def search(from,after)\n emails = @yahoo_api.find_emails from,after\n\n emails.in_groups_of(10,false).each do |group| \n mids = group.map{|email| email[:mid]}\n email_contents = @yahoo_api.fetch_email_contents mids\n \n mails = email_contents.map do |email_content| \n text = CGI.unescapeHTML(CGI.unescapeHTML(\n email_content[:text]))\n mail = Mail.new(\n :message_id => email_content[:mid],\n :date => email_content[:date],\n :subject => email_content[:subject],\n :body => text)\n mail.html_part = Mail::Part.new do\n content_type 'text/html; charset=UTF-8'\n body text\n end\n mail\n end \n\n yield mails if block_given?\n end\n end",
"def civicrm_emails\n emails = ALF::Email.where('person', self.person_id)\n prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.person_id).take.contact_id;\n contact = CIVICRM::Contact.find(prev_id)\n\n emails.each do |e|\n e_type = ALF::EmailType.findId(e.email_type)\n\n if e_type.present? && (e_type.email_type == 'Personal')\n loc_type = CIVICRM::LocationType.where(name: 'Primary').take\n primary = true\n else\n loc_type = CIVICRM::LocationType.where(name: 'Secondary').take\n primary = false\n end\n\n email = CIVICRM::Email.new(\n contact_id: contact.id,\n email: e.email_address,\n location_type_id: loc_type.id,\n is_primary: primary\n )\n\n if !email.valid? || !email.save\n raise \"Invalid Email Model\\nCIVICRM::Email: #{email.inspect}\\nALF::Email: #{e.inspect}\\nPerson: #{self.person_id}\\n\"\n end\n end\n end",
"def emails(text)\n scan(text, EMAIL, :email)\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end",
"def objects_in_category(category_type_, *category_spec_)\n @config.lock\n\n return nil unless @categories.include?(category_type_)\n spec_ = category_spec_.size == 1 && category_spec_.first.is_a?(::Array) ? category_spec_.first : category_spec_\n tuple_hash_ = (@catdata[category_type_] ||= {})[spec_]\n tuple_hash_ ? tuple_hash_.values.map{ |objdata_| objdata_[0] } : []\n end",
"def sendgrid_category category\n @sg_category = category\n end",
"def subscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_subscribe(emails)\n end",
"def contact_types\n values = categories.map(&:contact_type_id)\n values.empty? ? @contact_types : values\n end",
"def find_email(opts)\n find_emails(opts).first\n end",
"def recipient_emails\n [patient.try(:email), doctor.try(:email)].compact\n end",
"def recipient_emails\n recipients.map(&:first)\n end",
"def get_specific_conversations usr, c_type \n conv_ids = Array.new\n convos = Conversation.get_conversations(usr)\n convos.find_each do |convo|\n convo.posts.find_each do |post|\n if (c_type == \"received\" && post.recipient_id == usr.id && post.recipient_status == 'active') ||\n (c_type == \"sent\" && post.user_id == usr.id && post.status == 'active')\n conv_ids << convo.id if usr_msg?(convo, usr); break\n end\n end\n end\n return convos.where([\"id in (?)\", conv_ids]).sort_by {|x| x.posts.last.created_at }.reverse \n end",
"def ajax_category\n case params[:category]\n when Reporting::ALL\n @query_hash = {:category_all => true}\n when Reporting::PROVIDER\n @query_hash = {:category_provider => true}\n when Reporting::PATIENT\n @query_hash = {:category_patient => true}\n when Reporting::CLAIM\n @query_hash = {:category_claim => true}\n when Reporting::BALANCE\n @query_hash = {:category_balance => true}\n when Reporting::INVOICES\n @query_hash = {:category_invoice => true}\n when Reporting::USER\n @query_hash = {:category_user => true}\n when Reporting::SYSTEM\n @query_hash = {:category_system => true}\n end\n @reporting = Reporting.without_status(:deleted).where(@query_hash)\n end",
"def search_shopify_customer(context)\n customer_emails = context_customer_emails(context)\n shopify_customer = nil\n\n customer_emails.each do |customer_email|\n shopify_customer = ShopifyAPI::Customer.search(query: customer_email).first\n break if shopify_customer\n end\n\n return shopify_customer\nend",
"def categorize_cell(cdscell, category)\r\n\r\n Category.where.not(name: category.name).each do |cat|\r\n #Only run if the cell is not tagged\r\n cdscell = category.cdscells.find_by(name: \"uncategorized\")\r\n if !cdscell\r\n user.tag(cdscell, :with => \"uncategorized\", :on => :categories)\r\n end\r\n end\r\n \r\n end",
"def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end",
"def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end",
"def get_email(deputy_page_url)\n email = ''\n\n page = Nokogiri::HTML(open(deputy_page_url))\n\n page.css('a[@href ^=\"mailto:\"]').each do |element|\n email << element.text\n break\n end\n\n email\nend",
"def find_emails\n options = { :conditions => ['last_send_attempt < ?', Time.now.to_i - 300] }\n options[:limit] = batch_size unless batch_size.nil?\n mail = ActionMailer::Base.email_class.find :all, options\n\n log \"found #{mail.length} emails to send\"\n mail\n end",
"def category_members(category, options = {})\n titles = []\n apfrom = nil\n begin\n form_data = options.merge(\n {'action' => 'query',\n 'list' => 'categorymembers',\n 'apfrom' => apfrom,\n 'cmtitle' => category,\n 'cmlimit' => @options[:limit]})\n res, apfrom = make_api_request(form_data, '//query-continue/categorymembers/@apfrom')\n titles += REXML::XPath.match(res, \"//cm\").map { |x| x.attributes[\"title\"] }\n end while apfrom\n titles\n end",
"def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end",
"def index\n @mailing_lists = MailingList.all\n @email = @mailing_lists.collect(&:email).join(\"; \")\n end",
"def mailboxer_email(object)\n #If actor has disabled the emails, return nil.\n return nil if !notify_by_email\n #If actor has enabled the emails and has email\n return \"#{name} <#{email}>\" if email.present?\n #If actor is a Group, has enabled emails but no mail we return the highest_rank ones.\n if (group = self.subject).is_a? Group\n relation = group.relation_customs.sort.first\n receivers = group.contact_actors(:direction => :sent, :relations => relation)\n emails = Array.new\n receivers.each do |receiver|\n receiver_emails = receiver.mailboxer_email(object)\n case receiver_emails\n when String\n emails << receiver_emails\n when Array\n receiver_emails.each do |receiver_email|\n emails << receiver_email\n end\n end\n end\n return emails\n end\n end",
"def emails(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Emails\", params: params)\n end",
"def local_customer_emails\n self.customers.pluck(:email)\n end",
"def export_emails(data)\n\t\t\t\t\t\tmy_string = \"\"\n\t\t\t\t\t\t\t\tmatch_val = 0\n\t\t\t\t\t\t\t\t\t\tloc_urn = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\temails = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata[\"configurable_attributes\"].each do |item|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr = []\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif item[\"category\"] == \"Location\" && item[\"location_urn\"] != nil\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only push values that are emails\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmy_string = item[\"value\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatch_val = /@/ =~ my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts match_val\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif match_val >= 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# add data to csv\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr.push(item[\"location_urn\"], item[\"value\"])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tadd_to_csv arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"def all_answered_questions_per_category(category)\n self.all_answered_questions.select{|question| question.category === category}\n end",
"def index\n @emails = EventEmail.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end",
"def getEmails\n begin\n puts 'attempting to connect to ' + @username + '@gmail.com'\n Gmail.new(@username, @password) do |gmail|\n puts 'connection established'\n #use peek to make emails not be automatically marked as read\n gmail.peek = (@peek === 'true' ? true : false)\n\n if @label == \"none\"\n inbox = gmail.inbox\n boxname = 'inbox'\n else\n inbox = gmail.mailbox(@label)\n boxname = @label + ' box'\n end\n number_unread = inbox.count(:unread)\n if number_unread < 1\n abort(\"There are no new messages in the \" + boxname)\n end\n p \"there are \" + number_unread.to_s + \" unread emails in the \" + boxname\n inbox.emails(:unread).each do |email|\n puts parser(email)\n end\n end\n\n rescue Net::IMAP::NoResponseError\n puts 'connection failed, check your config file for incorrect credentials'\n puts 'perhaps you opted to use a label that doesn\\'t exist, try \"none\" instead'\n end\nend",
"def batch_subscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def index\n @categories = StudentAttachmentCategory.fetch_all # default.to_a + StudentAttachmentCategory.all\n end",
"def recipients_filtered_by_email_setting\n recipients\n .where.not(email: nil)\n .includes(:email_setting)\n .where(email_settings: email_setting_filter.merge(global_unsubscribe: false))\n end"
] | [
"0.62495255",
"0.61910415",
"0.6139023",
"0.6003403",
"0.56699127",
"0.5651843",
"0.5591714",
"0.55803734",
"0.54984456",
"0.5470508",
"0.5468105",
"0.5408793",
"0.53955835",
"0.53639007",
"0.5339856",
"0.5300101",
"0.52669877",
"0.52366275",
"0.5226064",
"0.5197954",
"0.51501447",
"0.5134633",
"0.5126687",
"0.5109496",
"0.51020753",
"0.50986236",
"0.5088314",
"0.508501",
"0.50714666",
"0.50609124",
"0.5053485",
"0.49980226",
"0.49980226",
"0.49980226",
"0.49980226",
"0.4974925",
"0.4965045",
"0.49646714",
"0.49518383",
"0.494931",
"0.49406248",
"0.4933207",
"0.49296638",
"0.49279553",
"0.4917968",
"0.49119613",
"0.48957992",
"0.48907363",
"0.4871211",
"0.4861804",
"0.48442453",
"0.48425",
"0.48346147",
"0.48243365",
"0.48075235",
"0.48041692",
"0.47962293",
"0.47809651",
"0.47782084",
"0.4765669",
"0.4765669",
"0.4765669",
"0.4765669",
"0.47643992",
"0.47624454",
"0.47520944",
"0.47461557",
"0.47457764",
"0.47434705",
"0.47411638",
"0.47406036",
"0.47336647",
"0.47307444",
"0.47282785",
"0.4728255",
"0.47190696",
"0.47133937",
"0.46910638",
"0.4686625",
"0.46834922",
"0.46805587",
"0.46777508",
"0.4675804",
"0.46702057",
"0.46682546",
"0.46678314",
"0.46626592",
"0.46618667",
"0.46469915",
"0.46457526",
"0.46453503",
"0.46424383",
"0.46391833",
"0.4637914",
"0.4633217",
"0.46331373",
"0.46296147",
"0.46270466",
"0.46223962",
"0.46209264"
] | 0.8209447 | 0 |
Public: Initialize an Pot. params A Hash of pot parameters. | def initialize(params)
@id = params[:id]
@name = params[:name]
@style = params[:style]
@balance = params[:balance]
@currency = params[:currency]
@created = params[:created]
@updated = params[:updated]
@deleted = params[:deleted]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(params:, robot:, surface:)\n self.params = Hash[*[self.class::PARAMS_CONFIG, params].transpose.flatten(1)]\n self.robot = robot\n self.surface = surface\n end",
"def initialize(params = {})\n parameters(params)\n end",
"def initialize(params={})\n\t\t\t\tparams.each_pair do |k,v|\n\t\t\t\t\tinstance_variable_set(\"@#{k}\", v)\n\t\t\t\tend\n\t\t\tend",
"def initialize(params)\n @byr = params['byr']&.to_i\n @iyr = params['iyr']&.to_i\n @eyr = params['eyr']&.to_i\n if params.key?('hgt')\n @hgt = if (md = /\\A(?<value>\\d+)(?<unit>cm|in)\\z/.match(params['hgt']))\n [md['value'].to_i, md['unit']]\n else\n params['hgt']\n end\n end\n\n @hcl = params['hcl']\n @ecl = params['ecl']\n @pid = params['pid']\n @cid = params['cid']\n end",
"def initialize(params)\n @params = params\n end",
"def initialize(params)\n @params = params\n end",
"def initialize(params)\n @params = params \n end",
"def pot_params\n params.require(:pot).permit(:user_id, :description, :cash_demand, :cash_collected, :credits_collected)\n end",
"def initialize(params = {})\n @params = params.symbolize_keys\n end",
"def initialize(params = {})\n # set up our initial wallet state\n @messages ||= {}\n # @warning = false\n @cards ||= []\n @errors ||= []\n self.attributes = params\n end",
"def initialize\n @params = {}\n end",
"def initialize(tool, parms)\n @tool = tool\n raise \"abstract is too long\" if parms[:abstract] && parms[:abstract].length > 63\n @parameters = {}\n @parameters.update defaults\n parms.each { |k,v| @parameters[k.to_s.to_sym] = v }\n end",
"def initialize(params)\n params.each do |key, value|\n instance_variable_set(\"@#{key}\", value) if respond_to?(key)\n end\n end",
"def initialize(params = { })\n params.keys.each { |k| self.send(\"#{k}=\".to_sym, params[k]) if self.respond_to?(k.to_sym) }\n end",
"def initialize(parametros)\n # En cada variable intanciada le asignamos un hash con la variable correspondiente\n @villano = parametros[:villano]\n @frase = parametros[:frase]\n end",
"def initialize(params = {})\n Poke::Params.check_params(params, PARAMS_REQUIRED)\n @window = params[:window]\n @player = params[:player]\n end",
"def initialize(params={})\n params.each do |k, v|\n self.instance_variable_set(\"@#{k}\", v)\n end\n end",
"def initialize(bot, data, params)\n @bot = bot\n @data = data\n @params = params\n end",
"def initialize (params = {}) # Get a value from the \"new\" call, or set a default\n # @id = \"000000000\", @name = \"Unknown_name\", @mut_phen = \"Unknown_mutant_phenotype\", @linked_to = \"Not_linked_to_any_other_gene\"\n @id = params.fetch(:id, \"000000000\")\n @name = params.fetch(:name, \"Unknown_name\") \n @mut_phen = params.fetch(:mut_phen, \"Unknown_mutant_phenotype\")\n @linked_to = params.fetch(:linked_to, \"Not_linked_to_any_other_gene\")\n end",
"def initialize (params = {}) # Get a value from the \"new\" call, or set a default\n # @id = \"Unknown_gene_id\", @prot=\"Unknown_protein_name\", @annot=\"Unknown_annotation\", @kegg_entryº=nil\n @id = params.fetch(:id, \"Unknown_gene_id\")\n @prot = params.fetch(:prot, \"Unknown_protein_name\")\n @annot = params.fetch(:annot, \"Unknown_annotation\")\n @kegg_entry = params.fetch(:kegg_entry, nil)\n end",
"def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Legislator.instance_methods.include? key\n end\n end",
"def initialize (params = {})\n @seed_stock = params.fetch(:seed_stock, []) #gives default value\n @mutant_gene_id = params.fetch(:mutant_gene_id, []) \n @last_planted = params.fetch(:last_planted, []) \n @storage = params.fetch(:storage, [])\n @grams_remaining = params.fetch(:grams_remaining, []) \n end",
"def initialize(data)\n @parms = data\n end",
"def initialize(params = {})\n params = Geos::Constants::BUFFER_PARAM_DEFAULTS.merge(params)\n\n ptr = FFIGeos.GEOSBufferParams_create_r(Geos.current_handle_pointer)\n @ptr = FFI::AutoPointer.new(\n ptr,\n self.class.method(:release)\n )\n\n @params = {}\n VALID_PARAMETERS.each do |param|\n send(\"#{param}=\", params[param])\n end\n end",
"def set_pot\n @pot = Pot.find(params[:id])\n end",
"def initialize(params, supplied_params = nil)\n @supplied_params = (supplied_params || params).deep_dup\n @params = params\n @specd = []\n end",
"def from_params(params)\n self.cpus = params['cpus'].to_i\n self.ram = params['memory'].to_i\n self.video_ram = params['vram'].to_i\n self.hardware_id = params['hardwareuuid']\n self.os = self.class.os_types[params['ostype']]\n\n self.pae = params['pae'] == 'on' \n self.acpi = params['acpi'] == 'on' \n self.io_apic = params['io_apic'] == 'on' \n\n self.hardware_virtualization = params['hwvirtex'] == 'on' \n self.nested_paging = params['nestedpaging'] == 'on' \n self.tagged_tlb = params['vtxvpid'] == 'on' \n\n self.efi = params['firmware'] == 'efi'\n self.bios_logo_fade_in = params['bioslogofadein'] == 'on'\n self.bios_logo_fade_out = params['bioslogofadeout'] == 'on'\n self.bios_logo_display_time = params['bioslogodisplaytime'].to_i\n \n self.bios_boot_menu = case params['bootmenu']\n when 'disabled'\n false\n when 'message'\n :menu_only\n else\n true\n end\n \n self.boot_order = []\n %w(boot1 boot2 boot3 boot4).each do |boot_key|\n next unless params[boot_key] && params[boot_key] != 'none'\n boot_order << params[boot_key].to_sym\n end\n \n self.audio = params['audio'] != 'none'\n \n self\n end",
"def initialize(params = {})\n puts 'Building Robot with Params:'\n pp params\n self.my_set = params.fetch(:my_set, nil)\n self.my_color = params.fetch(:my_color, nil)\n self.my_background_set = params.fetch(:my_background_set, nil)\n end",
"def initialize(pot, name)\n @pot = pot\n @name = name\n @hand = Hand.new\n end",
"def initialize params = nil\n \n end",
"def initialize(params = nil)\n @env = Hash.new\n unless params.nil?\n params.each_pair { |var, typ|\n @env[var] = {type: typ, fixed: true}\n }\n end\n end",
"def initialize(params)\n @params = normalize(params)\n end",
"def initialize(*params)\n @params = *params\n end",
"def initialize(optHash)\n @optHash=optHash\n setParameters()\nend",
"def initialize(params)\n # Validates the parameters provided\n validate(params)\n\n @lat = params[\"lat\"]\n @lng = params[\"lng\"]\n @name = params[\"name\"]\n end",
"def initialize(params = nil)\n set_params(params)\n set_simulation\n end",
"def initialize \n @params = Struct::CheckoutParams.new\n @params.order = Struct::Order.new\n @params.billing_address = Struct::Address.new\n @params.shipping_address = Struct::Address.new\n @params.consumer = Struct::Consumer.new\n @params.metadata = Struct::Metadata.new\n @params.version = Struct::Version.new\n @params.order.detail = Array.new\n end",
"def potty_params\n params.require(:potty).permit(:number, :notes, :date, :location)\n end",
"def set_pot\n @pot = Pot.find(params[:pot_id])\n end",
"def initialize(params)\n @options = Templates::Utils::Options.new(defaults, params)\n end",
"def initialize(params={})\n @name = params[:name]\n @type = params[:type]\n if params.key? :protocol\n @protocols = [ params[:protocol] ]\n else\n @protocols = params[:protocols] || []\n end\n if params.key? :ontology\n @ontologies = [ params[:ontology] ]\n else\n @ontologies = params[:ontologies] || []\n end\n if params.key? :language\n @languages = [ params[:language] ]\n else\n @languages = params[:languages] || []\n end\n @ownership = params[:ownership] || []\n @properties = params[:properties] || {}\n end",
"def initialize (params = {})\n\n @uniprotid = params.fetch(:uniprotid, \"XXXXXX\")\n @intactid = params.fetch(:intactid, nil)\n @networkid = params.fetch(:networkid, nil)\n\n @@prot_obj[uniprotid] = self\n\n if intactid\n @@prot_int_obj[intactid] = self #We only introduce the data in the hash if the protein has an Intact ID, and will use it as key\n end\n\n end",
"def initialize(params = {})\n params.each { |k,v| instance_variable_set \"@\" + k.to_s,v}\n load if @auto_load\n end",
"def initialize(prm = nil)\n @params = prm&.dup || {}\n @value = {}\n super()\n end",
"def initialize(params={})\n @name = params[:name]\n if params.key? :service\n @services = [ params[:service] ]\n else\n @services = params[:services] || []\n end\n if params.key? :protocol\n @protocols = [ params[:protocol] ]\n else\n @protocols = params[:protocols] || []\n end\n if params.key? :ontology\n @ontologies = [ params[:ontology] ]\n else\n @ontologies = params[:ontologies] || []\n end\n if params.key? :language\n @languages = [ params[:language] ]\n else\n @languages = params[:languages] || []\n end\n @lease_time = params[:lease_time]\n end",
"def initialize(params, token = nil)\n @token = token\n @params = normalize(params)\n end",
"def initialize(params, shared_secret: nil)\n raise ArgumentError, \"params should be a Hash\" unless params.is_a?(Hash)\n raise ArgumentError, \"params should contain :merchantSig\" unless params.key?('merchantSig')\n\n @params = params\n skin = Adyen.configuration.form_skin_by_code(params['skinCode']) || {}\n @shared_secret = shared_secret || skin[:shared_secret]\n end",
"def initialize(params = {})\n params.each { |key, value| send \"#{key}=\", value }\n @inst_id = params[:inst_id] || \"\"\n @contract_interval = params[:contract_interval] || \"\"\n end",
"def initialize(person, place, weapon, type)\n @person = person\n @place = place\n @weapon = weapon\n @type = type\n end",
"def initialize(params = nil) \n if (params!=nil && params.length>0)\n params.each_index{|elem|@elem = params.at(elem)}\n end\n end",
"def initialize(hash = {})\n hash.delete_if { |k, v| v.nil? }\n hash = defaults.merge(hash)\n\n @heating = hash[:heating]\n @cooling = hash[:cooling]\n @interior_lighting = hash[:interior_lighting]\n @exterior_lighting = hash[:exterior_lighting]\n @interior_equipment = hash[:interior_equipment]\n @exterior_equipment = hash[:exterior_equipment]\n @electric_vehicles = hash[:electric_vehicles]\n @fans = hash[:fans]\n @pumps = hash[:pumps]\n @heat_rejection = hash[:heat_rejection]\n @humidification = hash[:humidification]\n @heat_recovery = hash[:heat_recovery]\n @water_systems = hash[:water_systems]\n @refrigeration = hash[:refrigeration]\n @generators = hash[:generators]\n\n # initialize class variables @@validator and @@schema\n @@validator ||= Validator.new\n @@schema ||= @@validator.schema\n end",
"def initialize(params={})\n puts \"=== initialize ===\"\n @prefix = params[:prefix]\n @type = params[:type]\n\n @br_ope = BridgeOperator.create(@type)\n\n if params[:subnet].nil?\n @dhcpip = params[:dhcpip]\n @swip = params[:swip]\n @name = params[:name]\n @range = params[:range]\n else\n subnet = IPAddr.new(\"#{params[:subnet]}/#{@prefix}\")\n swip_ipaddr = subnet.to_host_range.last.proceed\n @dhcpip = subnet.to_host_range.last\n @swip = swip_ipaddr.to_s\n @name = params[:subnet].gsub(/\\./, \"_\")\n @range = \"#{subnet.to_host_range.first},#{swip_ipaddr.proceed}\"\n end\n end",
"def initialize(params = nil)\n @params = params\n @state = {}\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n # Default values:\n @data['provisioning'] ||= {}\n @data['type'] ||= 'StorageVolumeTemplateV3'\n end",
"def initialize(hash)\n @type = hash[:type]\n @description = hash[:help]\n @name = hash[:text]\n @for_game = hash[:in_game]\n @tag = hash[:tag]\n @default = hash[:default]\n @id = hash[:id]\n @min = 0\n # noinspection RubyCaseWithoutElseBlockInspection\n case @type\n when :switch;\n init_switch(hash)\n when :variable;\n init_variable(hash)\n when :separator;\n init_separator(hash)\n when :advanced;\n init_advanced(hash)\n when :bar;\n init_bar(hash)\n end\n @method = hash[:method]\n @value_method = hash[:val_mt] unless hash[:val_mt].nil?\n @special_draw = hash[:special] unless hash[:special].nil?\n @enabled_condition = hash[:condition] unless hash[:condition].nil?\n end",
"def initialize(params = { key: :global, logEng: [], active_tag: LogTag } )\n @myMethods = [:debug, :error, :warn, :warning, :info]\n @defKey = params[:key]\n @logEng = params[:logEng] || []\n @activeTag = params[:active_tag] || []\n end",
"def initialize(parameters = {})\n @parameters = parameters\n end",
"def initialize (params = {})\n \n @prot_id = params.fetch(:prot_id, \"XXXXXX\") \n @intact_id = params.fetch(:intact_id, nil)\n @network = params.fetch(:network, nil)\n \n @@total_protein_objects[prot_id] = self\n \n if intact_id\n @@total_protwithintact_objects[intact_id] = self\n end \n \n end",
"def initialize(params:)\n raise('Missing required params: [:dip_location] and [:package_metadata][:dip_uuid] are required') unless params[:dip_location] && params[:package_metadata][:dip_uuid]\n @params = params\n @package_payload = {}\n @works_payload = []\n @dip = DIPReader.new(params[:dip_location])\n @dip_id = params[:package_metadata][:dip_uuid]\n @bag_key = dip_id\n rescue StandardError => e\n raise e\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n # Default values:\n @data['provisioning'] ||= {}\n @data['type'] ||= 'StorageVolumeTemplateV3'\n end",
"def initialize(chainring:, cog:, :wheel)\n # ...\nend",
"def initialize(params = {})\n params.each_pair do |attr, value|\n send(\"#{attr}=\", value) if respond_to?(\"#{attr}=\", true)\n end unless params.blank?\n end",
"def initialize(params)\n\t\t\t@id=params[:id]\n\t\t \t@component_id=params[:component_id]\n\t \t@short_name=params[:short_name]\n\t\t\t@long_name=params[:long_name]\n\t\t\t@charge_or_tax=params[:charge_or_tax]\n\t\t\t@calculation_type=params[:calculation_type]\n\t\t\t@applied_on_rate=params[:applied_on_rate]\n\t\t\t@round_off_to=params[:round_off_to]\n\t\t\t@round_off_to_num=params[:round_off_to_num]\n\t\t\t@applicable_amount=params[:applicable_amount]\n\t\t\t@minimum_tax_amount=params[:minimum_tax_amount]\n\t\t\t@maximum_tax_amount=params[:maximum_tax_amount]\n\t\t\t@gl_detail=params[:gl_detail]\n\t\t\t@country=params[:country]\n\t\t\t@state=params[:state]\n\t\t\t@slab=SlVO.new\n\t\t\t@slab.serial_no=params[:serial_no]\n\t\t\t@slab.slab_start_amount=params[:slab_start_amount]\n\t\t\t@slab.slab_end_amount=params[:slab_end_amount]\n\t\t\t@slab.slab_calculation_type=params[:slab_calculation_type]\n\t\t\t@slab.slab_applicable_amount=params[:slab_applicable_amount]\n\t\tend",
"def initialize\n super()\n @params = {}\n end",
"def initialize(params = {})\n params ||= {}\n params = params.try(:to_hash) || params if params.is_a?(self.class)\n self.dump(params)\n end",
"def initialize(params = {})\n self.attributes = params\n end",
"def initialize(reg_param: 1.0)\n super()\n @params = {\n reg_param: reg_param\n }\n end",
"def initialize(protein, base, toppings)\n @protein = protein\n @base = base\n @toppings = toppings\n end",
"def initialize(protein, base, toppings)\n @protein = protein\n @base = base\n @toppings = toppings\n end",
"def initialize(protein, base, toppings)\n @protein = protein\n @base = base\n @toppings = toppings\n end",
"def initialize (parameters={})\n @seed_stock_id = parameters.fetch(:seed_stock_id, \"XXXXXX\")\n @gene = self.check_gene=(parameters.fetch(:gene, \"XXXXXX\"))\n @last_planted = self.check_last_planted=(parameters.fetch(:last_planted, \"XXXXXX\"))\n @storage = parameters.fetch(:storage, \"XXXXXX\")\n @grams_remaining = self.check_grams_remaining=(parameters.fetch(:grams_remaining, \"XXXXXX\"))\n @@count += 1\n @@objects << self\n end",
"def initialize(hash = {})\n @names = hash[:names] || [[], []]\n @classes = hash[:classes] || [[], []]\n @battlers = hash[:battlers] || [[], []]\n @bags = hash[:bags] || [[], []]\n @parties = hash[:parties] || [[], []]\n @max_level = hash[:max_level] || nil\n @vs_type = hash[:vs_type] || 1\n @trainer_is_couple = hash[:couple] || false\n @battle_id = hash[:battle_id] || -1\n end",
"def initialize(hash)\n @type = hash[:type]\n @description = hash[:help]\n @name = hash[:text]\n @for_game = hash[:in_game]\n @tag = hash[:tag]\n @default = hash[:default]\n case @type\n when :switch; init_switch(hash)\n when :variable; init_variable(hash)\n when :separator; init_separator(hash)\n when :advanced; init_advanced(hash)\n when :bar; init_bar(hash)\n end\n @method = hash[:method]\n @value_method = hash[:val_mt] unless hash[:val_mt].nil?\n @special_draw = hash[:special] unless hash[:special].nil?\n @enabled_condition = hash[:condition] unless hash[:condition].nil?\n end",
"def initialize (params = {})\n @gene_name = params.fetch(:gene_name,\"unknown\")\n @gene_phenotype = params.fetch(:gene_phenotype, \"unknown\") \n @gene_links = params.fetch(:gene_links, []) \n @gene_id = params.fetch(:gene_id,\"AT0G00000\") #gives default value\n\n end",
"def initialize(params={})\n @throttle = params[:throttle] || 1\n end",
"def set_potassium\n @potassium = Potassium.find(params[:id])\n end",
"def initialize (params = {})\n @gene_id = params.fetch(:gene_id, \"AT0G00000\")\n @gene_name = params.fetch(:gene_name, \"no_gene\")\n @mutant_phenotype = params.fetch(:mutant_phenotype, \"no_phenotype\")\n @linked = params.fetch(:linked, false) #This will change if the gene is linked\n#Default params, in case we don't introduce any or they aren't correct\n @@total_gene_objects[gene_id] = self #This way, we store the data to retrieve it later\n end",
"def initialize(params = {})\n params.each do |key, value|\n setter = \"#{key}=\"\n send(setter, value) if respond_to?(setter.to_sym, false)\n end\n end",
"def initialize(spec)\n @spec = ParamSpec.normalize_spec_hash(spec)\n @type = TypeSpec.new(@spec['type'])\n end",
"def initialize(params)\n @product = params[:product]\n @quantity = params[:quantity]\n end",
"def initialize(sugar, protein, fat, weight)\n super(sugar, protein, fat)\n @weight = weight\n end",
"def initialize(name_parameter, breed_parameter, attitude_parameter = \"jolly\")\n @name = name_parameter\n @breed = breed_parameter\n @number_of_legs = 4\n @attitude = attitude_parameter\n @chip_id = 74365745 #let's assume this is a number generated by some method\n end",
"def initialize(params = {})\n super\n\n @lock_id = params[:lock_id]\n @client_webhook_setting_id = params[:client_webhook_setting_id].to_i\n @admin_id = params[:admin_id]\n end",
"def initialize(name, porcions=1, geiPerKg, terreno, carbs, proteins, lipidos)\n\t\t\t\t@name = name\n\t\t\t\t@geiPerKg = porcions*geiPerKg\n\t\t\t\t@gei = (@geiPerKg / 1000) * porcions * 100\n\t\t\t\t@terreno = porcions*terreno\n\t\t\t\t@carbs = porcions*carbs\n\t\t\t\t@proteins = porcions*proteins\n\t\t\t\t@lipidos = porcions*lipidos\n\t\t\tend",
"def initialize(params={})\n self.api_url = 'https://pay1.plugnpay.com/payment/pnpremote.cgi'\n # self.api_url = 'https://pay1.plugnpay.com/payment/inputtestapi.cgi'\n self.publisher_name = params['publisher-name'] if params['publisher-name']\n self.debug = params['debug'] if params['debug']\n end",
"def initialize(chainring: default_chainring, cog: 18, wheel:)\n @chainring = chainring\n @cog = cog\n @wheel = wheel\n end",
"def initialize(params=nil)\n if params\n @title = params['title']\n @address = params['address']\n end\n end",
"def init_params(params)\n @params = params\n @client_id = params[:client_id].to_i\n @event_source = params[:event_source]\n @event_name = params[:event_name]\n @event_data = params[:event_data]\n @event_timestamp = params[:event_timestamp].to_i\n\n @filtered_webhook_settings = []\n @event_obj = {}\n @lock_id = nil\n end",
"def initialize(good_options={})\n @id = good_options[\"id\"]\n @serial_number = good_options[\"serial_number\"]\n @distributor_id = good_options[\"distributor_id\"]\n @product_id = good_options[\"product_id\"]\n @name = good_options[\"name\"]\n @description = good_options[\"description\"]\n @cost = good_options[\"cost\"]\n @quantity = good_options[\"quantity\"]\n end",
"def initialize(param)\n @param = param\n end",
"def initialize(o_params)\n params = o_params.dup\n if params.is_a?(Hash)\n @name, @type = params.shift\n @doc = params.delete(:doc) if params.has_key?(:doc)\n @opts = params\n elsif params.is_a?(Array)\n @name = params.shift\n @type = params.shift\n @doc = params.shift\n @opts = params\n end\n end",
"def initialize(**params)\n\n # Set some colour defaults\n colourable(255, 255, 255, 255, 0)\n\n # Store the parameters we find in our ivars\n params.each do |key, value|\n instance_variable_set(key.to_s.prepend('@'), value)\n end\n\n end",
"def initialize(order_hash)\n\n\n\n @action = order_hash['action']\n @application = order_hash['applicatienaam']\n @environment = order_hash['environment']\n\n @type = order_hash['applicatieserver']\n @template = order_hash['template']\n\n @middleware_settings = order_hash['middleware']\n\n @environment = order_hash['omgeving']\n\n # compose the order hash. This will get passed to the process later on\n @order_hash = {\n 'application' => @application,\n 'environment' => @environment,\n 'items' => get_order_template(order_hash)\n }\n\n @pdef = get_ruote_pdef\n\n\n end",
"def initialize(opts = {})\n opts.each_pair { |k, v| instance_variable_set(:\"@#{k}\", v) }\n @api_key ||= ENV['OPEN_WEATHER_MAP_API_KEY']\n @units ||= 'imperial'\n @disp ||= :temp\n end",
"def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Filing.instance_methods.include? key\n end\n end",
"def initialize(vendor_hash)\n @id = vendor_hash[:id]\n @name = vendor_hash[:name]\n @no_of_employees = vendor_hash[:no_of_employees]\n @market_id = vendor_hash[:market_id]\n end",
"def initialize(vendor_hash)\n @id = vendor_hash[:id]\n @name = vendor_hash[:name]\n @no_of_employees = vendor_hash[:no_of_employees]\n @market_id = vendor_hash[:market_id]\n end",
"def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Lobbyist.instance_methods.include? key\n end\n end",
"def initialize(params = {})\n \n unless params.empty?\n @name = params[:name] if params.has_key?(:name)\n @surname = params[:surname] if params.has_key?(:surname)\n @phone = params[:phone] if params.has_key?(:phone)\n end\n\n end",
"def initialize(params)\n setMake(params[:make]);\n setModel(params[:model]);\n setYear(params[:year]);\n commitCar!();\n\n end",
"def initialize(params={})\n\t#byebug\n\tparams.symbolize_keys!\n\t@id=params[:_id].to_s\n\t@formatted_address=params[:formatted_address]\n\t#locations are point classes, create from hash passed in\n\t#byebug\n\tif !params[:geometry].key?(:geolocation)\n\t\t@location=Point.new(params[:geometry])\n\telse #created if because tes was pasing in :geometry:geolocation\n\t\t@location=Point.new(params[:geometry][:geolocation])\n\tend\t\n\t\n\t@address_components=[]\n\t#byebug\n\t#address component is an array of hashes that should be created into AddressComponents\n\tparams[:address_components].each {|r| @address_components.push(AddressComponent.new(r))} if params[:address_components]\nend"
] | [
"0.6911692",
"0.670716",
"0.6407503",
"0.6378588",
"0.6344991",
"0.6344991",
"0.6267009",
"0.62593484",
"0.6170548",
"0.6168719",
"0.6154312",
"0.61437327",
"0.61195296",
"0.6116495",
"0.6112937",
"0.6112329",
"0.61016273",
"0.6084338",
"0.6073246",
"0.60727644",
"0.6063524",
"0.60446197",
"0.60392237",
"0.6030198",
"0.6024143",
"0.6021742",
"0.60130346",
"0.6010022",
"0.6003211",
"0.599034",
"0.5987532",
"0.59682965",
"0.59650475",
"0.5951776",
"0.5942773",
"0.5937113",
"0.5931003",
"0.59052426",
"0.58884376",
"0.5885399",
"0.5860832",
"0.5858442",
"0.58474314",
"0.5837596",
"0.58314407",
"0.58304363",
"0.5827786",
"0.58245015",
"0.5811029",
"0.57788855",
"0.5775751",
"0.5774621",
"0.57739604",
"0.5767743",
"0.57677317",
"0.5767658",
"0.5750766",
"0.57367754",
"0.5736395",
"0.5732526",
"0.5732417",
"0.57143664",
"0.57080954",
"0.5703962",
"0.57005495",
"0.5691484",
"0.5689957",
"0.5688213",
"0.5688213",
"0.5688213",
"0.56689686",
"0.56623435",
"0.5659654",
"0.56571555",
"0.56459343",
"0.5644818",
"0.5642377",
"0.5640914",
"0.56383926",
"0.5637698",
"0.5634207",
"0.56321526",
"0.5618865",
"0.56187195",
"0.56121355",
"0.56114256",
"0.560771",
"0.55951387",
"0.5591433",
"0.5587247",
"0.5586242",
"0.55792826",
"0.55749196",
"0.55738556",
"0.55737734",
"0.55649346",
"0.55649346",
"0.5556404",
"0.55551875",
"0.55513734",
"0.555066"
] | 0.0 | -1 |
Public: Deposit Money in a pot amount The amount to deposit, in pennies. source_account_id The account_id of the account to withdraw from. dedupe_id (optional) A random string, to prevent duplicate deposits. Returns self: a single Monzo::Pot | def deposit!(amount, source_account_id, dedupe_id = SecureRandom.uuid)
data = {
amount: amount,
source_account_id: source_account_id,
dedupe_id: dedupe_id,
}
response = Monzo.client.put("/pots/#{@id}/deposit", data)
parsed_response = parse_response(response)
update_self(parsed_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def withdraw!(amount, destination_account_id, dedupe_id = SecureRandom.uuid)\n data = {\n amount: amount,\n destination_account_id: destination_account_id,\n dedupe_id: dedupe_id,\n }\n\n response = Monzo.client.put(\"/pots/#{@id}/withdraw\", data)\n parsed_response = parse_response(response)\n update_self(parsed_response)\n end",
"def deposit acct, amount\n\t\t\treturn \"Invalid account: '#{acct}'\" unless valid_acct acct\n\n\t\t\tamount = to_money amount.abs\n\n\t\t\tadjust acct, amount\n\t\tend",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend",
"def collect_deposit!(deposit, deposit_spread)\n @adapter.configure(wallet: @wallet.to_wallet_api_settings,\n currency: deposit.currency.to_blockchain_api_settings)\n pa = deposit.member.payment_address(@wallet.id)\n # NOTE: Deposit wallet configuration is tricky because wallet UIR\n # is saved on Wallet model but wallet address and secret\n # are saved in PaymentAddress.\n @adapter.configure(\n wallet: @wallet.to_wallet_api_settings\n .merge(address: pa.address)\n .tap { |s| s.merge!(secret: pa.secret) if pa.secret.present? }\n .compact\n )\n\n deposit_spread.map { |t| @adapter.create_transaction!(t, subtract_fee: true) }\n end",
"def deposit(amount, options={})\n adjust_and_save(amount.abs, :deposit, options)\n end",
"def deposit(amount_of_money)\n return @balance + amount_of_money\n end",
"def deposit(money_to_deposit)\n @balance += money_to_deposit\n end",
"def total_debt\n Money.new(all_debts.sum { |_, debt| debt }, 'PLN')\n end",
"def deposit(amount_to_deposit)\n @balance += amount_to_deposit\n return @balance\n end",
"def deposit(amount_to_deposit)\n @balance += amount_to_deposit\n return @balance\n end",
"def cards_deposit(data, opts = {})\n data, _status_code, _headers = cards_deposit_with_http_info(data, opts)\n data\n end",
"def deposit(amount)\n deposit_account = Account.find_by(account_type: :deposit)\n raise 'No deposit account, has the db been seeded?' if\n deposit_account.nil?\n\n create_transfer('deposit', amount, deposit_account, self)\n end",
"def deposit(money_amount)\n # Negative deposit amount, invalid\n if money_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be a negetive value\"\n else\n @balance += money_amount\n return @balance\n end\n end",
"def deposit(amount)\n @balance += amount\n return @balance\n end",
"def debit_player(p)\n p.money -= p.bet\n end",
"def deposit(deposit_amount)\n self.balance += deposit_amount\n end",
"def deposit(deposit_amt = 0)\n @balance = @balance + deposit_amt\n return @balance\n end",
"def deposit!(amount)\n raise NegativeDepositError if amount < 0\n add_transaction(amount)\n\n balance\n end",
"def deposits\n Transfer.where(\n to: id,\n transfer_type: 'deposit'\n )\n end",
"def deposit_quantity\n money.to_d.divmod(market.settle_price(currency)).first\n end",
"def deposit (amount, options={})\n options[:memo] ||= 'Regular deposit.'\n @transactions.push({:amount => amount, :memo => options[:memo]})\n end",
"def set_deposit\n @deposit = Deposit.find(params[:id])\n end",
"def set_deposit\n @deposit = Deposit.find(params[:id])\n end",
"def set_deposit\n @deposit = Deposit.find(params[:id])\n end",
"def set_deposit\n @deposit = Deposit.find(params[:id])\n end",
"def deposit(name, amount)\n find_account(name)[:balance] += amount\n end",
"def deposit(amount)\n @balance += amount\n puts \"#{money_convert(balance)}\"\n return @balance\n end",
"def money(key)\n Money.new @config.fetch(key)\n end",
"def deposit(amount)\n @balance += amount\n @balance\n end",
"def deposit(amount)\n result = BigDecimal.new(balance) + BigDecimal.new(amount)\n update_attributes(balance: result)\n end",
"def deposit(deposit_amount)\n if deposit_amount < 0\n puts \"Invalid deposit amount entered.\"\n else\n @balance += deposit_amount\n puts \"You deposited $#{deposit_amount}. \"\n end\n return balance\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def debit_account\n @debit_account ||= Account.find_by_full_name 'Expenses:Unknown'\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance = @balance + amount\n end",
"def send_money_to(receiver, amount, note=nil)\n debits.create!(receiver: receiver, amount: amount, note: note)\n end",
"def deposit(amount)\n amount = amount.abs\n @balance = @balance + amount\n one_transaction\n return @balance\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def set_deposit\r\n @deposit = Deposit.find(params[:id])\r\n end",
"def deposit(deposit_amount)\n self.balance += deposit_amount\n end",
"def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end",
"def get_deposited_coin(transaction)\n deposited_coin = @user.coins.find(transaction.coin_id) if @user\n return deposited_coin\n end",
"def +(other)\n raise TypeError.new(\"Argument is not a Money object\") unless other.instance_of?(Money)\n \n d = @dollars + other.dollars\n c = @cents + other.cents\n\n if c >= 100\n d = d + 1\n c = c % 100\n end\n \n Money.new(d,c)\n end",
"def debit!(amount)\n self.balance -= parse_monetary_value(amount)\n self.store\n end",
"def deposit(t)\n\n @balance += t.amount\n t.currBalance = @balance\n @ledger << t\n\n end",
"def deposit(amount, *args)\n do_transaction :deposit, amount, *args\n end",
"def direct_deposit(amount, options={})\n adjust_and_save(amount.abs, :direct_deposit, options)\n end",
"def money\n Spree::Money.new(amount, { currency: currency })\n end",
"def deposit(money)\n self.balance = (self.balance + money)\n end",
"def debit!(amount:, kind: :main, reference: nil,\n member_id: nil, currency: nil)\n return if amount.zero?\n\n currency ||= reference.currency\n account_code = Operations::Chart.code_for(\n type: operation_type,\n kind: kind,\n currency_type: currency.type\n )\n create!(\n debit: amount,\n reference: reference,\n currency_id: currency.id,\n code: account_code,\n member_id: member_id || reference.member_id\n ).tap(&:save!)\n end",
"def deposit(balance, amount)\n\tnew_balance = balance + amount\n\treturn new_balance\nend",
"def money(amount)\n Money.new((amount * 100).to_i)\n end",
"def buy_pet(pet_cost)\n sql = \"SELECT SUM (pets.cost) FROM pets INNER JOIN adoptions ON pets.id = adoptions.pet_id WHERE adoptions.owner_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values).first\n @funds = @funds - result['sum'].to_i\n end",
"def deposit\n request_params = params.permit(:source_account_id, :destination_account_id, :amount)\n\n bank ||= Actions.new.deposit(\n request_params['source_account_id'], \n request_params['destination_account_id'], \n request_params['amount']\n )\n\n return render status: bank[0], json: bank[1]\n end",
"def pay_for_drink(drink)\n @wallet -= drink.price\n end",
"def deposit(amount)\n @balance += amount\n puts \"Deposit #{amount}. New Balance: $#{@balance}\"\n returned\n end",
"def deposit_cash(deposit_amount)\n @balance += deposit_amount\n end",
"def deduct(amount)\n @balance -= amount\n end",
"def set_depoimento\n @depoimento = Depoimento.find(params[:id])\n end",
"def debit *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n appears_on_statement_as = args[1] || options.fetch(:appears_on_statement_as) { nil }\n meta = args[2] || options.fetch(:meta) { nil }\n description = args[3] || options.fetch(:description) { nil }\n\n self.account.debit(\n :amount => amount,\n :appears_on_statement_as => appears_on_statement_as,\n :meta => meta,\n :description => description,\n :source_uri => self.uri\n )\n end",
"def buys_drink(pub, drink_name)\n drink_to_buy = pub.sell_drink(self, drink_name)\n @wallet -= drink_to_buy.price\n end",
"def annuity_calculator_deposit_amount(annuity_calculator_deposit_amount_request, opts = {})\n data, _status_code, _headers = annuity_calculator_deposit_amount_with_http_info(annuity_calculator_deposit_amount_request, opts)\n data\n end",
"def deposit(money_amount)\n # Negative deposit amount, invalid\n if money_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be a negetive value\"\n elsif @num_transaction < 6\n if @balance >= 1000000\n @num_transaction += 1\n end\n @balance += money_amount\n end\n return @balance\n end",
"def get_deposit_using_get(deposit_id, opts = {})\n data, _status_code, _headers = get_deposit_using_get_with_http_info(deposit_id, opts)\n data\n end",
"def deposit(deposit_amount)\n\n if deposit_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be negative number\"\n else\n @balance += deposit_amount\n end\n end",
"def copy_price(options={})\n if object = options[:dependent]\n result = self.price(options[:currency_code])\n dependent_price = object.price if object.respond_to?(:price)\n if self.price_percentage(options[:currency_code]) && self.price_percentage(options[:currency_code]).to_f > 0.0\n result += dependent_price * (self.price_percentage(options[:currency_code]) / 100)\n end\n result\n else\n self.price(options[:currency_code])\n end\n end",
"def deposit(deposit_amount)\n\n raise ArgumentError.new \"Your deposit amount must be greater than 0.\" if deposit_amount <= 0\n\n @balance += deposit_amount\n end",
"def deposit(cash)\n @balance += cash\n end",
"def deduction(price, copoun_obj) \n if copoun_obj.deduction_type == \"percentage\"\n total_price = price * (copoun_obj.deduction_percentage / 100)\n else\n total_price = price - copoun_obj.deduction_amount\n end\n end",
"def +(other_money)\n Money.new(amount +\n other_money.convert_to(currency).amount,\n self.currency)\n end",
"def debit (amount=nil,\n appears_on_statement_as=nil,\n hold_uri=nil,\n meta={},\n description=nil,\n source_uri=nil)\n debit = Debit.new(\n :uri => self.debits_uri,\n :amount => amount,\n :appears_on_statement_as => appears_on_statement_as,\n :hold_uri => hold_uri,\n :meta => meta,\n :description => description,\n :source_uri => source_uri,\n )\n debit.save\n end",
"def decrease_wallet(drink)\n return @wallet -= drink.price\n end",
"def deposit(amount_to_deposit)\n\n if @frozen\n\n @balance += amount_to_deposit\n\n if @balance > MIN_BAL\n @frozen = false\n puts \"Thank you - you have exceeded the minimum balance of $%.2f\" % MIN_BAL + \", and your account is unfrozen.\"\n end\n\n else\n\n if @transactions_remaining == 0\n puts \"Sorry, you cannot perform transactions right now. You have already used your #{MAX_TRANSACTIONS} transactions for the month.\"\n else\n @balance += amount_to_deposit\n @transactions_remaining -= 1\n end\n\n end\n\n return @balance\n\n end",
"def balance_dollars\n transactions = Transaction.where('contact_id = ?', id)\n .includes(:settled_by)\n\n totalPaid = Money.new(0)\n totalSettled = Money.new(0)\n\n transactions.each do |loan|\n totalPaid = totalPaid + loan.amount_dollars\n\n loan.settled_by.each do |payback|\n totalSettled = totalSettled + payback.amount_dollars\n end\n end\n\n return totalPaid + totalSettled\n end",
"def deshacer\n entidad.deposit monto, operadora\n end",
"def set_deposits_product\n @deposits_product = DepositsProduct.find(params[:id])\n end",
"def deposit(amount)\n \n #return if amount_is_not_valid(amount)\n ActiveRecord::Base.transaction do\n #note: need to use self or Account as a prefix when using balance, since it is not a variable or anythign defined in tis class\n self.update!(balance: self.balance + amount)\n end \n end",
"def set_deposit\n @deposit_amount = set_deposit_amount(@project.id)\n end",
"def +(other_money)\n if currency == other_money.currency\n Money.new(cents + other_money.cents, other_money.currency)\n else\n Money.new(cents + other_money.exchange_to(currency).cents, currency)\n end\n end",
"def money(amount, name)\n Currency::Money.new(amount, name)\n end",
"def debit!(reference:, amount:, kind:, member_id: nil, currency: nil)\n return if amount.zero?\n\n currency ||= reference.currency\n account_code = Operations::Chart.code_for(\n type: operation_type,\n kind: kind,\n currency_type: currency.type.to_sym\n )\n create!(\n debit: amount,\n reference: reference,\n currency_id: currency.id,\n code: account_code,\n member_id: member_id || reference.member_id\n )\n end",
"def deposit(amount)\n self.balance = (self.balance + amount).round(2)\n self.save!\n end",
"def *(other)\n Money.create_from_cents((cents * other).round)\n end",
"def gov_proposals_proposal_id_deposits_post(proposal_id, post_deposit_body, opts = {})\n data, _status_code, _headers = gov_proposals_proposal_id_deposits_post_with_http_info(proposal_id, post_deposit_body, opts)\n data\n end",
"def money\n Money.from_amount(amount.to_f)\n end",
"def set_debt_payment\n @debt_payment = DebtPayment.find(params[:id])\n end",
"def set_deposito\n @deposito = Deposito.find(params[:id])\n end",
"def adjusted_amount\n m = (deposit? or transfer_in?) ? 1 : -1\n amount * m\n end",
"def set_debtor\n @debtor = Debtor.find(params[:id])\n end",
"def deposit_address(currency = 'XBt')\n get 'depositAddress', currency: currency do |response|\n raise response.body unless response.success?\n\n response.to_s\n end\n end",
"def debit amount, appears_on_statement_as=nil, meta={}, description=nil\n self.account.debit(amount, appears_on_statement_as, meta, description, self.uri)\n end",
"def debit\n @debit ||= begin\n @debit = if parent\n expenses.debit.sum(:transaction_amount)\n else\n children.inject(0) { |total, child| total += child.debit }\n end\n end\n end",
"def withdraw acct, amount\n\t\t\treturn \"Invalid account: '#{acct}'\" unless valid_acct acct\n\n\t\t\tamount = to_money -(amount)\n\n\t\t\tadjust acct, amount\n\t\tend",
"def debitCoins(amount)\r\n @betESSCoins -= amount\r\n end",
"def +(other)\n Money.create_from_cents((cents + other.to_money.cents))\n end",
"def deposit(amt)\n @bank_acct += amt\n puts \"Your balance is #{@bank_acct}.\"\n end"
] | [
"0.63066536",
"0.54378045",
"0.52988845",
"0.5282323",
"0.5272958",
"0.52329355",
"0.5188685",
"0.51588774",
"0.5135322",
"0.5135322",
"0.5124892",
"0.50152",
"0.49326217",
"0.4913594",
"0.49131262",
"0.49029785",
"0.48937592",
"0.4889848",
"0.48779532",
"0.4859872",
"0.48578253",
"0.48449248",
"0.48449248",
"0.48449248",
"0.48449248",
"0.4832089",
"0.48266414",
"0.48205012",
"0.4818237",
"0.4800028",
"0.4799633",
"0.47904316",
"0.47904316",
"0.47904316",
"0.4789503",
"0.47876963",
"0.4785548",
"0.4784604",
"0.47645554",
"0.47542113",
"0.47542113",
"0.4754022",
"0.4741879",
"0.4738363",
"0.47312462",
"0.47294274",
"0.47255915",
"0.47249913",
"0.4722717",
"0.47110102",
"0.47018218",
"0.46995014",
"0.46928978",
"0.46488687",
"0.46447182",
"0.46414414",
"0.46399128",
"0.46362004",
"0.4630741",
"0.462945",
"0.46202195",
"0.46021512",
"0.45940158",
"0.45898318",
"0.45851454",
"0.45827124",
"0.45808554",
"0.4562917",
"0.45527133",
"0.45411497",
"0.45178849",
"0.45085138",
"0.45028228",
"0.4500663",
"0.4499389",
"0.4481364",
"0.4477292",
"0.44715196",
"0.44680694",
"0.4467179",
"0.44665375",
"0.44584945",
"0.4445492",
"0.4439667",
"0.44393566",
"0.44378555",
"0.44335216",
"0.44332266",
"0.44278556",
"0.44231212",
"0.44217244",
"0.44113222",
"0.44090846",
"0.44047126",
"0.44031614",
"0.43969592",
"0.43924448",
"0.43897653",
"0.43893668",
"0.43887192"
] | 0.78251565 | 0 |
Public: Withdraw Money from a pot amount The amount to withdraw, in pennies. destination_account_id The account_id of the account to deposit into. dedupe_id (optional) A random string, to prevent duplicate deposits. Returns self: a single Monzo::Pot | def withdraw!(amount, destination_account_id, dedupe_id = SecureRandom.uuid)
data = {
amount: amount,
destination_account_id: destination_account_id,
dedupe_id: dedupe_id,
}
response = Monzo.client.put("/pots/#{@id}/withdraw", data)
parsed_response = parse_response(response)
update_self(parsed_response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deposit!(amount, source_account_id, dedupe_id = SecureRandom.uuid)\n data = {\n amount: amount,\n source_account_id: source_account_id,\n dedupe_id: dedupe_id,\n }\n\n response = Monzo.client.put(\"/pots/#{@id}/deposit\", data)\n parsed_response = parse_response(response)\n update_self(parsed_response)\n end",
"def deposit acct, amount\n\t\t\treturn \"Invalid account: '#{acct}'\" unless valid_acct acct\n\n\t\t\tamount = to_money amount.abs\n\n\t\t\tadjust acct, amount\n\t\tend",
"def deposit(amount_of_money)\n return @balance + amount_of_money\n end",
"def withdraw acct, amount\n\t\t\treturn \"Invalid account: '#{acct}'\" unless valid_acct acct\n\n\t\t\tamount = to_money -(amount)\n\n\t\t\tadjust acct, amount\n\t\tend",
"def deposit(money_to_deposit)\n @balance += money_to_deposit\n end",
"def deposit(amount, options={})\n adjust_and_save(amount.abs, :deposit, options)\n end",
"def collect_deposit!(deposit, deposit_spread)\n @adapter.configure(wallet: @wallet.to_wallet_api_settings,\n currency: deposit.currency.to_blockchain_api_settings)\n pa = deposit.member.payment_address(@wallet.id)\n # NOTE: Deposit wallet configuration is tricky because wallet UIR\n # is saved on Wallet model but wallet address and secret\n # are saved in PaymentAddress.\n @adapter.configure(\n wallet: @wallet.to_wallet_api_settings\n .merge(address: pa.address)\n .tap { |s| s.merge!(secret: pa.secret) if pa.secret.present? }\n .compact\n )\n\n deposit_spread.map { |t| @adapter.create_transaction!(t, subtract_fee: true) }\n end",
"def withdraw(amount_of_money)\n return @balance - amount_of_money\n end",
"def pay_for_drink(drink)\n @wallet -= drink.price\n end",
"def deposit(amount_to_deposit)\n @balance += amount_to_deposit\n return @balance\n end",
"def deposit(amount_to_deposit)\n @balance += amount_to_deposit\n return @balance\n end",
"def deposit(deposit_amount)\n self.balance += deposit_amount\n end",
"def withdraw\n copy self.class.withdraw(@id)\n true\n end",
"def withdraw\n copy self.class.withdraw(@id)\n true\n end",
"def deposit(amount)\n @balance += amount\n return @balance\n end",
"def deposit(deposit_amount)\n self.balance += deposit_amount\n end",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend",
"def deposit(amount)\n @balance += amount\n @balance\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n deposit_account = Account.find_by(account_type: :deposit)\n raise 'No deposit account, has the db been seeded?' if\n deposit_account.nil?\n\n create_transfer('deposit', amount, deposit_account, self)\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def deposit(amount)\n @balance += amount\n end",
"def +(other)\n raise TypeError.new(\"Argument is not a Money object\") unless other.instance_of?(Money)\n \n d = @dollars + other.dollars\n c = @cents + other.cents\n\n if c >= 100\n d = d + 1\n c = c % 100\n end\n \n Money.new(d,c)\n end",
"def deposit(amount)\n result = BigDecimal.new(balance) + BigDecimal.new(amount)\n update_attributes(balance: result)\n end",
"def withdraw(amount)\n @balance = @balance - amount\n end",
"def deposit(money_amount)\n # Negative deposit amount, invalid\n if money_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be a negetive value\"\n else\n @balance += money_amount\n return @balance\n end\n end",
"def deposit(name, amount)\n find_account(name)[:balance] += amount\n end",
"def buys_drink(pub, drink_name)\n drink_to_buy = pub.sell_drink(self, drink_name)\n @wallet -= drink_to_buy.price\n end",
"def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end",
"def deposit(money)\n self.balance = (self.balance + money)\n end",
"def deposit(amount)\n @balance += amount\n puts \"#{money_convert(balance)}\"\n return @balance\n end",
"def deposit(amount)\n @balance = @balance + amount\n end",
"def deposit!(amount)\n raise NegativeDepositError if amount < 0\n add_transaction(amount)\n\n balance\n end",
"def deposit(deposit_amt = 0)\n @balance = @balance + deposit_amt\n return @balance\n end",
"def withdraw(amount, options={})\n options = {:fee => false}.merge(options).symbolize_keys\n adjust_and_save(amount.abs * -1, :withdraw, options)\n end",
"def withdraw(amount_to_withdraw)\n @balance -= amount_to_withdraw\n end",
"def deposit\n request_params = params.permit(:source_account_id, :destination_account_id, :amount)\n\n bank ||= Actions.new.deposit(\n request_params['source_account_id'], \n request_params['destination_account_id'], \n request_params['amount']\n )\n\n return render status: bank[0], json: bank[1]\n end",
"def deposit(amount)\n amount = amount.abs\n @balance = @balance + amount\n one_transaction\n return @balance\n end",
"def +(other_money)\n Money.new(amount +\n other_money.convert_to(currency).amount,\n self.currency)\n end",
"def withdraw(amount)\n @balance -= amount\n end",
"def deposit(amount)\n self.balance = (self.balance + amount).round(2)\n self.save!\n end",
"def withdraw(amount)\n withdrawal_account = Account.find_by(account_type: 'withdrawal')\n raise 'No withdrawal account, has the db been seeded?' if\n withdrawal_account.nil?\n\n create_transfer('withdrawal', amount, self, withdrawal_account)\n end",
"def withdraw(amount)\n @balance -= amount\n end",
"def send_money_to(receiver, amount, note=nil)\n debits.create!(receiver: receiver, amount: amount, note: note)\n end",
"def decrease_wallet(drink)\n return @wallet -= drink.price\n end",
"def deposit(amount)\n \n #return if amount_is_not_valid(amount)\n ActiveRecord::Base.transaction do\n #note: need to use self or Account as a prefix when using balance, since it is not a variable or anythign defined in tis class\n self.update!(balance: self.balance + amount)\n end \n end",
"def make_withdraw\n\t\tif Qiwicoin::Client.instance.get_balance >= self.amount && self.address.present?\n\t\t\tself.qc_tx_id = Qiwicoin::Client.instance.send_to_address(self.address, self.amount.to_f)\n\t\t\tself.save\n\t\tend\n end",
"def direct_deposit(amount, options={})\n adjust_and_save(amount.abs, :direct_deposit, options)\n end",
"def +(other)\n Money.create_from_cents((cents + other.to_money.cents))\n end",
"def deposit(deposit_amount)\n if deposit_amount < 0\n puts \"Invalid deposit amount entered.\"\n else\n @balance += deposit_amount\n puts \"You deposited $#{deposit_amount}. \"\n end\n return balance\n end",
"def deposit(balance, amount)\n\tnew_balance = balance + amount\n\treturn new_balance\nend",
"def withdraw(amount)\n if amount <= @balance && (@balance - amount >= self.class::MINIMUM_BALANCE)\n @balance -= amount\n else\n puts \"Your account does not contain enough to withdraw the amount requested.\"\n end\n return @balance\n end",
"def deduct(amount)\n @balance -= amount\n end",
"def deposit(amt)\n @bank_acct += amt\n puts \"Your balance is #{@bank_acct}.\"\n end",
"def +(other_money)\n if currency == other_money.currency\n Money.new(cents + other_money.cents, other_money.currency)\n else\n Money.new(cents + other_money.exchange_to(currency).cents, currency)\n end\n end",
"def deposit_cash(deposit_amount)\n @balance += deposit_amount\n end",
"def deposit(amount)\n @balance += amount\n puts \"Deposit #{amount}. New Balance: $#{@balance}\"\n returned\n end",
"def withd amount\n unless amount > @savings_account_balance\n @savings_account_balance -= amount\n \n else\n end\n end",
"def transfer(options={})\n self.transfer_amount = Money.new(0, self.person ? self.person.default_currency : 'USD') unless self.transfer_amount\n \n return Response.new(false, transfer_amount, :transfer, \n :description => self.errors.full_messages.to_sentence) unless self.valid?\n\n result = Response.new\n PiggyBankAccount.transaction do\n self.person.piggy_bank.lock!\n begin\n I18n.switch_locale(self.person.default_locale) do\n # transfer net transfer amount to paypal\n response = PaypalDepositAccount::gateway.transfer(\n self.net_transfer_amount, # money amount of type Money\n self.paypal_account, # paypal account (email)\n :subject => MESSAGE_PAYPAL_SUBJECT.t % {\n :name => self.person.name\n },\n :description => MESSAGE_PAYPAL_DESCRIPTION.t % {\n :account => self.paypal_account,\n :name => self.person.name,\n :gross_amount => self.gross_transfer_amount.format,\n :net_amount => self.net_transfer_amount.format,\n :fee => self.transaction_fee.abs.format,\n :date => Date.today.to_s(:short)\n }\n )\n \n if response.success?\n # withdraw gross transfer amount from user's piggy bank\n result = self.person.piggy_bank.withdraw(\n self.gross_transfer_amount,\n options.merge(\n :fee => false,\n :description => MESSAGE_USER_PIGGY_BANK_DESCRIPTION.t % {\n :account => self.paypal_account,\n :name => self.person.name,\n :gross_amount => self.gross_transfer_amount.format,\n :net_amount => self.net_transfer_amount.format,\n :fee => self.transaction_fee.abs.format,\n :date => Date.today.to_s(:short)\n }\n )\n )\n\n # ...and deposit the transaction fee to Probono's piggy bank\n if result.success?\n result.fee = self.transaction_fee\n probono_result = Organization.probono.piggy_bank.deposit(\n self.transaction_fee.abs,\n options.merge(\n :description => MESSAGE_PROBONO_PIGGY_BANK_DESCRIPTION.t % {\n :account => self.paypal_account,\n :name => self.person.name,\n :gross_amount => self.transfer_amount.format,\n :net_amount => (self.transfer_amount - self.transaction_fee.abs).format,\n :fee => self.transaction_fee.abs.format,\n :date => Date.today.to_s(:short)\n }\n )\n )\n end\n else\n result = Response.new(response.success?, self.transfer_amount, :transfer)\n result.authorization = response.authorization\n result.description = response.message\n result.params = response.params\n result.test = response.test?\n end\n end\n rescue ActiveMerchant::ActiveMerchantError => e\n result = Response.new(false, self.transfer_amount, :transfer)\n result.authorization = nil\n result.description = e.message\n result.params = {}\n result.test = PaypalDepositAccount::gateway.test?\n end\n end\n result\n end",
"def withdraw(amount)\n\n raise ArgumentError.new \"Your withdrawal amount must be greater than 0.\" if amount <= 0\n\n if amount > @balance\n puts \"Insufficent funds\"\n else\n @balance -= amount\n end\n\n return @balance\n end",
"def deposit(cash)\n @balance += cash\n end",
"def withdraw!(amount)\n amount = -amount if amount > 0\n add_transaction(amount)\n\n balance\n end",
"def total_debt\n Money.new(all_debts.sum { |_, debt| debt }, 'PLN')\n end",
"def withdraw(name, amount)\n a = find_account(name)\n a[:balance] < amount ? a[:balance] -= 30 : a[:balance] -= amount\n end",
"def buy_ship(other)\n @credits -= (other.price - @start_ship.tradein)\n @start_ship.mission_cargo.each do | cargo |\n other.add_cargo(cargo, cargo.amount)\n end\n @start_ship = other.dup\n end",
"def deposit (amount, account)\n if account == \"checking\"\n @checking_account_balance += amount\n elsif account == \"saving\"\n @saving_account_balance += amount\n else\n puts \"No account was selected\"\n end\n end",
"def deposit(money)\n @balance += money\nend",
"def debit_player(p)\n p.money -= p.bet\n end",
"def transfer(amount, other)\n @balance -= amount\n other.balance += amount\n puts \"#{@owner} your balance will be #{@balance} after the transfering to #{other.owner}\"\n end",
"def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end",
"def withdraw(amount)\n # Make sure requested amount + withdrawal fee can be deducted without leaving account below min balance\n if @balance - amount - self.class::WITHDRAWAL_FEE >= self.class::MINIMUM_BALANCE\n @balance -= amount\n @balance -= self.class::WITHDRAWAL_FEE\n else\n puts \"Insufficient funds: Cannot withdraw #{ amount } cents from account.\",\n \"Minimum balance is #{ self.class::MINIMUM_BALANCE } cents. \"+\n \"Withdrawal fee is #{ self.class::WITHDRAWAL_FEE } cents.\",\n \"Current balance is: #{ @balance } cents.\"\n end\n return @balance\n end",
"def set_withdraw\n @withdraw = Withdraw.find(params[:id])\n end",
"def deposit (amount, options={})\n options[:memo] ||= 'Regular deposit.'\n @transactions.push({:amount => amount, :memo => options[:memo]})\n end",
"def adjusted_amount\n m = (deposit? or transfer_in?) ? 1 : -1\n amount * m\n end",
"def deduct\n @balance -= @journey_log.fare\n end",
"def deposit(amount, *args)\n do_transaction :deposit, amount, *args\n end",
"def debit_account\n @debit_account ||= Account.find_by_full_name 'Expenses:Unknown'\n end",
"def debit!(amount)\n self.balance -= parse_monetary_value(amount)\n self.store\n end",
"def withdraw(withdraw_amount)\n if (balance - withdraw_amount - fee) < limit\n puts \"There is not enough money in your account to withdraw that amount.\"\n else\n @balance -= (withdraw_amount + fee)\n puts \"You withdrew $#{withdraw_amount} (plus a fee of $#{fee}).\"\n end\n return balance\n end",
"def deposit(deposit_amount)\n\n raise ArgumentError.new \"Your deposit amount must be greater than 0.\" if deposit_amount <= 0\n\n @balance += deposit_amount\n end",
"def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end",
"def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end",
"def deposit(deposit_amount)\n @amount+=deposit_amount\n puts @amount\n end",
"def transfer(amount, destination_account, options={})\n process('transfer', amount, options) do |gw|\n gw.transfer(amount.cents, destination_account, options)\n end\n end",
"def donate_cash\n @donation_cash = DonationCash.new(donation_cash_params)\n @sender = User.find(@donation_cash.user_id)\n @donation_cash.pot = @pot\n @donation_cash.user = @sender\n @pot.cash_collected = @pot.cash_collected + @donation_cash.amount\n\n respond_to do |format|\n if @donation_cash.save && @pot.save\n format.json\n else\n format.json { render json: @donation_cash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def donate\n\n @context_user = @receiver.user\n \n # Test that the transfer money between the two people is a viable option\n rec_acc = @receiver.monetary_processor_account\n pay_acc = @sender.monetary_processor_account\n \n rec_usid = rec_acc.account_identifier\n pay_usid = pay_acc.account_identifier\n \n @donation.update_attributes do |d|\n d.receiver_wmid = rec_acc\n d.sender_wmid = pay_acc\n end\n store_donation\n \n res = WebMoney::Ext::Client.get_max_transaction_amount(pay_usid, rec_usid, @donation.purse_type[0].to_i)\n \n # Verify maximum transaction possible\n @max_amount = res.maxAmount\n if @max_amount < @amount.to_f\n @amount = @max_amount\n if @amount.to_i != -1\n flash.now[:warning] = \"The maximum that you can contribute is %s.\" / \"#{@amount}\"\n end\n end\n \n # We are confirmed, lets do it!\n if params[:confirm]\n \n # confirm their password\n @account_setting = current_user.account_setting\n unless @account_setting.validate_password(current_user,params[:password])\n flash.now[:error] = \"Invalid Password\".t\n return\n end\n \n # want to see the result logged for debugging?\n # WebMoney::Ext::Client.config.merge!({:debug => true, :wiredump => true})\n transfer = WebMoneyTransfer.create(\n :source_wmid => @sender.webmoney_account,\n :destination_wmid => @receiver.webmoney_account,\n :purse_type => @donation.purse_type[0].to_i,\n :amount => @donation.amount)\n \n res = WebMoney::Ext::Client.send_funds(\n pay_usid,\n rec_usid,\n transfer.request_number,\n @donation.purse_type[0].to_i,\n @donation.amount,\n @donation.item_name)\n \n if res.errordesc == 'Success'\n MonetaryDonation.from_webmoney_donation(@donation).save\n \n transfer.update_attribute(:success, true)\n flash[:success] = \"You have successfully transfered %s\" / [@donation.amount]\n clear_donation\n redirect_back_or_default '/'\n else\n transfer.update_attributes(:success => false, :response => res.errordesc)\n flash.now[:error] = res.errordesc.t\n end\n end\n end",
"def withdraw(amount, atm, pin, acc_no)\n if @balance >= amount && atm.balance >= amount && @pin == pin && acc_no == @account_no\n atm.dispense(amount)\n @balance = @balance - amount\n puts \"your new balance is #{@balance}\"\n else\n puts \"you are too pov\"\n end\n end",
"def buy(amount)\n @bought_amount += amount if amount_remaining >= amount\n end",
"def deposit(deposit_amount)\n\n if deposit_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be negative number\"\n else\n @balance += deposit_amount\n end\n end",
"def deposit ( person, amount )\r\n\t\tif person.worth >= amount\r\n\t\t@bank_listing[person.id_number][:balance]+=amount\r\n\t\tputs \"#{@bank_name}: Thanks #{person.name}, you deposited #{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry, you don't have enough on hand.\"\r\n\t\tend\r\n\tend",
"def deposit(money_amount)\n # Negative deposit amount, invalid\n if money_amount < 0\n raise ArgumentError.new \"Deposit amount cannot be a negetive value\"\n elsif @num_transaction < 6\n if @balance >= 1000000\n @num_transaction += 1\n end\n @balance += money_amount\n end\n return @balance\n end",
"def withdraw!(amount, address)\n if amount >= 1000\n fail(FilthyRichError.new(\"#withdraw! take bitcoin amount as parameter (you are trying to withdraw #{amount} BTC\"))\n else\n post('/api/1/generic/bitcoin/send_simple', :amount_int => intify(amount, :btc), :address => address)['trx']\n end\n end",
"def withdraw(amount_to_withdraw)\n\n if @frozen\n puts \"Sorry, you cannot perform transactions right now. Your account is frozen because it is below the minimum balance of $%.2f\" % MIN_BAL + \".\"\n return @balance\n end\n\n if @transactions_remaining == 0\n puts \"Sorry, you cannot perform transactions right now. You have already used your #{MAX_TRANSACTIONS} transactions for the month.\"\n return @balance\n end\n\n # Prevent a withdrawal that will send the balance negative (after $100 fee)\n\n if amount_to_withdraw <= @balance - BELOW_MINIMUM_FEE\n\n @balance -= amount_to_withdraw\n\n # Penalize a dip below minimum account balance\n\n if balance < MIN_BAL\n @balance -= BELOW_MINIMUM_FEE\n puts \"You have incurred a $%.2f\" % BELOW_MINIMUM_FEE + \" fee for letting your account balance drop below $%.2f\" % MIN_BAL + \". You will not be able to make further withdrawals until you bring your balance above $%.2f\" % MIN_BAL + \" again.\"\n @frozen = true\n end\n\n @transactions_remaining -= 1\n\n else\n\n puts \"Sorry, your account balance is only $%.2f\" % @balance + \", which is not enough for you to withdraw $%.2f\" % amount_to_withdraw + \". Remember that a $%.2f\" % BELOW_MINIMUM_FEE + \" fee is incurred for withdrawals that bring the account balance below $%.2f\" % MIN_BAL + \". No withdrawal was made.\"\n\n end\n\n return @balance\n\n end",
"def amount_owed\n total_price - amount_paid\n end",
"def withdraw(amount_to_withdraw)\n\n if amount_to_withdraw <= @balance\n @balance -= amount_to_withdraw\n else\n puts \"Sorry, your account balance is only $%.2f\" % @balance + \", which is not enough for you to withdraw $%.2f\" % amount_to_withdraw + \". No withdrawal was made.\"\n end\n\n return @balance\n\n end",
"def withdraw(amount_to_withdraw)\n\n if amount_to_withdraw <= @balance\n @balance -= amount_to_withdraw\n else\n puts \"Sorry, your account balance is only $%.2f\" % @balance + \", which is not enough for you to withdraw $%.2f\" % amount_to_withdraw + \". No withdrawal was made.\"\n end\n\n return @balance\n\n end"
] | [
"0.70585525",
"0.5388718",
"0.5341916",
"0.5332373",
"0.51238686",
"0.51234907",
"0.51031196",
"0.5100767",
"0.5096095",
"0.50661516",
"0.50661516",
"0.50245917",
"0.49921238",
"0.49921238",
"0.498018",
"0.49618948",
"0.495959",
"0.49303898",
"0.48987123",
"0.48985964",
"0.48985964",
"0.48871517",
"0.48865157",
"0.48865157",
"0.48865157",
"0.48856097",
"0.48744816",
"0.485991",
"0.484984",
"0.48454735",
"0.4840988",
"0.48219085",
"0.48177242",
"0.48105472",
"0.48093003",
"0.48067638",
"0.48063514",
"0.47778696",
"0.47510594",
"0.47432935",
"0.47393066",
"0.47358355",
"0.47243962",
"0.47147998",
"0.46816224",
"0.46740377",
"0.46697435",
"0.46674168",
"0.4662954",
"0.46590108",
"0.46583417",
"0.46558607",
"0.46517116",
"0.46420383",
"0.46361053",
"0.4630691",
"0.46282697",
"0.4624234",
"0.46168894",
"0.46153772",
"0.46059352",
"0.46000412",
"0.45994633",
"0.45785803",
"0.45770046",
"0.4575453",
"0.45715502",
"0.45710257",
"0.45696035",
"0.45637238",
"0.45597738",
"0.45558542",
"0.4552166",
"0.45416707",
"0.45237857",
"0.4519689",
"0.45188433",
"0.4505301",
"0.44997334",
"0.4480447",
"0.44797632",
"0.44742873",
"0.44731593",
"0.44669566",
"0.44651484",
"0.44651484",
"0.4464",
"0.4461898",
"0.44618767",
"0.4454998",
"0.44530913",
"0.44514325",
"0.44372344",
"0.4435782",
"0.44351244",
"0.44211748",
"0.44188887",
"0.44145256",
"0.44122222",
"0.44122222"
] | 0.7733153 | 0 |
Private: Update the Pot instance variables parsed_response a hash whose keys exactly match the instance variables for Monzo::Pot. Returns self (an instance of Monzo::Pot) | def update_self(parsed_response)
instance_variables.each do |iv|
instance_variable_set(iv, parsed_response[iv.to_s[1..-1].to_sym])
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pot\n @pot = Pot.find(params[:id])\n end",
"def set_pot\n @pot = Pot.find(params[:pot_id])\n end",
"def parse_response(response)\n response = sanitize_response_keys(response.parsed_response)\n end",
"def update\n pot = Pot.find_by(game_id: params[:id])\n\n player_list = []\n g = Game.find(pot.game_id)\n player_list << Player.find(g.player1_id) if g.player1_id != nil\n player_list << Player.find(g.player2_id) if g.player2_id != nil\n player_list << Player.find(g.player3_id) if g.player3_id != nil\n player_list << Player.find(g.player4_id) if g.player4_id != nil\n if match?(player_list, g.current_high_bet) == true\n player_list.each do |player|\n pot.total_chips += player.betting\n player.betting = 0\n player.save\n end\n end\n pot.update_attributes(pot_params)\n pot.save\n render json: pot\n end",
"def update\n respond_to do |format|\n if @pot.update(pot_params)\n format.html { redirect_to @pot, notice: 'Pot was successfully updated.' }\n format.json { render :show, status: :ok, location: @pot }\n else\n format.html { render :edit }\n format.json { render json: @pot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(response, url)\n return response if ApiKits.config.hydra\n attributes = ApiKits::Parser.response(response, url)\n hash = remove_root(attributes)\n hash = hash.merge({ 'response' => attributes })\n self.attributes = hash\n self\n end",
"def update\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n if @pot.update_attributes(params[:pot])\n format.html { redirect_to @pot, notice: 'Pot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def considering(response)\n @response = response\n self\n end",
"def update(response, url)\n return response if ApiClient.config.hydra\n attributes = ApiClient::Parser.response(response, url)\n hash = remove_root(attributes)\n hash = hash.merge({ 'response' => attributes })\n self.attributes = hash\n self\n end",
"def load_attributes_from_response(response)\n data = response.body\n assign_attributes(self.class.parse(data)) unless data.empty?\n changes_applied\n self\n end",
"def parsed_response\n #logger.debug { \"Parsing Response: #{response.content_type}\" }\n @parsed_response ||= ResponseParser.parse(response)\n end",
"def merge(updating_response)\n if updating_response == nil or updating_response.data == nil\n return self\n end\n \n if updating_response.status > status\n @status = updating_response.status\n end\n \n if data == nil\n @data = updating_response.data\n return self\n end\n \n if updating_response.body != nil\n if @body == nil\n @body = updating_response.body\n else\n @body += updating_response.body\n end\n end\n\n @data['msgs'] += updating_response.msgs\n \n if updating_response.files != nil\n f = files\n if f != nil\n @data['results']['files'] += updating_response.files\n else\n @data['results']['files'] = updating_response.files\n end\n end\n \n return self\n end",
"def update\n @potz = Potz.find(params[:id])\n\n respond_to do |format|\n if @potz.update_attributes(params[:potz])\n format.html { redirect_to @potz, notice: 'Potz was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @potz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(response)\n @last_request_time = Time.now\n %w(used remaining reset).each do |type|\n value = response.headers[\"x-ratelimit-#{type}\"]\n instance_variable_set(\"@#{type}\", value.to_i) unless value.nil?\n end\n end",
"def parse_response(response)\n response = Hash.from_xml(response.parsed_response.gsub(\"\\n\", \"\")) if response.parsed_response.is_a? String\n response = sanitize_response_keys(response)\n end",
"def parse_response(response)\n Lita.logger.debug \"parse_response started.\"\n gimme_what_you_got = {}\n valid_products = {}\n products = {}\n response.split(/\\n/).each do |line|\n if matches = line.match(/window.siteData = (.*)/)\n site_hash = JSON.parse matches[1].sub /;$/, ''\n valid_products = site_hash['page']['properties']['contentAreas']['userContent']['content']['cells'][0]['content']['properties']['products']\n end\n if matches = line.match(/window.__BOOTSTRAP_STATE__ = (.*)/)\n whatevenintheshitsquarespace = JSON.parse matches[1].sub /;$/, ''\n products = whatevenintheshitsquarespace['commerceLinks']['products']\n end\n end\n\n valid_products\n products\n live_products = []\n\n valid_products.each do |p|\n live_products.push products[p] unless products[p].nil?\n end\n\n live_products.each_with_index do |beer, idx|\n tap = idx + 1\n tap_type = ''\n beer_name = beer['name'].sub(/ 32oz Crowler/, '')\n full_text_search = \"#{tap} #{beer_name}\"\n\n gimme_what_you_got[tap] = {\n type: tap_type,\n name: beer_name.to_s,\n search: full_text_search\n }\n end\n\n gimme_what_you_got\n end",
"def parse_response(response)\n response = Hash.from_xml( response.parsed_response.gsub(\"\\n\", \"\") ) if response.parsed_response.is_a? String\n response = sanitize_response_keys(response)\n end",
"def parse_response(response)\n\n if response[\"outcome\"]==\"success\"\n\n #Assign calorie counts and grams breakdown\n self.total_calories=response[\"fields\"][\"total_calories\"].to_i\n self.protein_grams=response[\"fields\"][\"total_calories\"].to_i\n self.fat_grams=response[\"fields\"][\"fat_grams\"].to_i\n self.carbohydrate_grams=response[\"fields\"][\"carbohydrate_grams\"].to_i\n self.fiber_grams=response[\"fields\"][\"fiber_grams\"].to_i\n\n #Number of coffees\n self.number_of_coffees=response[\"fields\"][\"number_of_coffees\"].to_i\n\n #Assign medications based on response\n if response[\"choice\"]=='only_took_morning_meds'\n self.morning_medications=true\n self.evening_medications=false\n\n elsif response[\"choice\"]=='only_took_evening_meds'\n self.morning_medications=false\n self.evening_medications=true\n\n elsif response[\"choice\"]=='took_both_morning_and_evening'\n self.morning_medications=true\n self.evening_medications=true\n\n else\n self.morning_medications=false\n self.evening_medications=false\n\n end\n\n self.save \n\n else\n raise \"Bad Scale API callback data\"\n end\n\n end",
"def set_potassium\n @potassium = Potassium.find(params[:id])\n end",
"def response=(response); @response = response end",
"def parse!(response)\n case response.code\n when 404\n raise Rioter::Errors::SummonerNotFound.new\n when 403\n # TODO: custom errors\n raise StandardError.new(\"Riot error: Forbidden.\")\n when 429\n retry_after = response.headers[\"Retry-After\"]\n raise Rioter::Errors::RateLimited.new(msg: \"Rate limit reached, retry after: #{retry_after}\", retry_after: retry_after)\n else\n JSON.parse(response.body)\n end\n end",
"def parse(response)\n Hpricot.XML(response || '')\n end",
"def set_potty\n @potty = Potty.find(params[:id])\n end",
"def parse_response(response)\n @response = response.body\n @code = response.code\n @message = response.message\n end",
"def set_from_response_data(hash)\n self.response_data = hash\n self.initialize_from_response_data\n self\n end",
"def set_api_v1_poll_response\n @api_v1_poll_response = Api::V1::PollResponse.find(params[:id])\n end",
"def parse_response!; end",
"def update_values\n response_hash = run_json_http_request\n @last = response_hash['last'].to_f * @rate\n @vol = response_hash['volume'].to_f\n @high = response_hash['high'].to_f * @rate\n @low = response_hash['low'].to_f * @rate\n @buy = response_hash['bid'].to_f * @rate\n @sell = response_hash['ask'].to_f * @rate\n end",
"def initialize(response)\n handle_errors(response)\n\n JSON.parse(response.body).each do |key, value|\n if key == 'decks'\n # Keep the API response count, it will differ when invalid decks are stripped\n @decks_count = value.size\n\n instance_variable_set(\n \"@#{key}\".to_sym, value.map { |deck| ZombieBattleground::Api::Models::Deck.new(deck) }\n )\n else\n instance_variable_set(\"@#{key}\".to_sym, value)\n end\n end\n end",
"def update\n respond_to do |format|\n if @potassium.update(potassium_params)\n format.html { redirect_to @potassium, notice: 'Potassium was successfully updated.' }\n format.json { render :show, status: :ok, location: @potassium }\n else\n format.html { render :edit }\n format.json { render json: @potassium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def prepare_response(response)\n response\n end",
"def parse_response(response)\n Lita.logger.debug 'parse_response started.'\n gimme_what_you_got = {}\n noko = Nokogiri.HTML response\n index = 1\n\n noko.css(\"div.beverageInfo[name='beerLayout']\").each do |beer_node|\n next if beer_node.css('.beverageName').children.to_s == ''\n\n tap_name = index.to_s\n index += 1\n\n brewery = beer_node.css('.producerName').children.to_s\n beer_name = beer_node.css('.beverageName').children.to_s\n beer_type = beer_node.css('.beverageStyle').children.to_s\n beer_location = beer_node.css('.producerLocation').children.to_s\n abv = beer_node.css('.abv').children.to_s.sub /%\\s*/, ''\n ibu = beer_node.css('.ibu').children.to_s\n full_text_search = \"#{brewery} #{beer_name} #{beer_type} #{beer_location}\" # #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\n\n gimme_what_you_got[tap_name] = {\n # type: tap_type,\n # remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_type.to_s,\n abv: abv.to_f,\n # price: price,\n search: full_text_search\n }\n end\n # puts gimme_what_you_got.inspect\n\n gimme_what_you_got\n end",
"def normalize_responses\n return if form.blank?\n\n form.response_fields.each do |response_field|\n if (x = self.response_value(response_field))\n response_field.normalize_response(x, get_responses)\n end\n end\n\n mark_responses_as_changed!\n end",
"def response=(response)\n self.success = response.success?\n self.authorization = response.authorization\n self.message = response.message\n self.params = response.params\n rescue ActiveMerchant::ActiveMerchantError => e\n self.success = false\n self.authorization = nil\n self.message = e.message\n self.params = {}\n end",
"def update_with_response(response)\n if response.is_a?(Braintree::GatewayResponse)\n self.update_attributes(response.to_order_attributes)\n end\n end",
"def set_attrs_from_response(response)\n unless response.body.nil? || (response.body.length < 2)\n json = self.class.parse_json(response.body)\n set_attrs(json)\n end\n end",
"def initialize(responses)\n parse_response responses\n end",
"def initialize(response)\n @response = response\n end",
"def prepare_response(response)\n JSON.parse(response)\n end",
"def response\n @parsed_response ||= JSON.parse(@response.body, symbolize_names: true)\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def unpack(response)\n return OTPResponse.new(response)\n end",
"def parse_response(response)\n raise NotImplementedError, '.parse_response should be implemented in subclass'\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def parse_response(response)\n\t date_title = response.parsed_response['response']['trip']\n\t self.title = date_title['title']\n\n\t date_start = response.parsed_response['response']['trip']['period_of_record']['date_start']['date']\n\t self.startdate = date_start['pretty']\n\n\t date_end = response.parsed_response['response']['trip']['period_of_record']['date_end']['date']\n\t\tself.enddate = date_end['pretty']\n\n\t\t#elements\n\t \tminprecip = response.parsed_response['response']['trip']['precip']['min']\n\t self.precipmin = minprecip['in']\n\t avgprecip = response.parsed_response['response']['trip']['precip']['avg']\n\t self.precipavg = avgprecip['in']\n\t maxprecip = response.parsed_response['response']['trip']['precip']['max']\n\t self.precipmax = maxprecip['in']\n\n\t mindewpoint = response.parsed_response['response']['trip']['dewpoint_high']['min']\n\t self.dewmin = mindewpoint['F']\n\t avgdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['avg']\n\t self.dewavg = avgdewpoint['F']\n\t maxdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['max']\n\t self.dewmax = maxdewpoint['F']\n\n\t chance_of_sunny = response.parsed_response['response']['trip']['chance_of']['chanceofsunnycloudyday']\n\t self.sunny = chance_of_sunny['name']\n\t self.sunnyper = chance_of_sunny['percentage']\n\n\t chance_of_rain = response.parsed_response['response']['trip']['chance_of']['chanceofrainday']\n\t self.rain = chance_of_rain['name']\n\t self.rainper = chance_of_rain['percentage']\n\n\t chance_of_thunder = response.parsed_response['response']['trip']['chance_of']['chanceofthunderday']\n\t self.thunder = chance_of_thunder['name']\n\t self.thunderper = chance_of_thunder['percentage']\n\n\t chance_of_wind = response.parsed_response['response']['trip']['chance_of']['chanceofwindyday']\n\t self.wind = chance_of_wind['name']\n\t self.windper = chance_of_wind['percentage']\n\n\t chance_of_snow = response.parsed_response['response']['trip']['chance_of']['chanceofsnowday']\n\t self.snow = chance_of_snow['name']\n\t self.snowper = chance_of_snow['percentage']\n\n\t chance_of_tornado = response.parsed_response['response']['trip']['chance_of']['chanceoftornadoday']\n\t self.tornado = chance_of_tornado['name']\n\t self.tornadoper = chance_of_tornado['percentage']\n\n\t chance_of_hail = response.parsed_response['response']['trip']['chance_of']['chanceofhailday']\n\t self.hail = chance_of_hail['name']\n\t self.hailper = chance_of_hail['percentage']\n\n\t chance_of_fog = response.parsed_response['response']['trip']['chance_of']['chanceoffogday']\n\t self.fog = chance_of_fog['name']\n\t self.fogper = chance_of_fog['percentage']\n\n\t #temperature\n\t date_mintemp = response.parsed_response['response']['trip']['temp_high']['min']\n\t self.min = date_mintemp['F']\n\t date_avgtemp = response.parsed_response['response']['trip']['temp_high']['avg']\n\t self.avg = date_avgtemp['F']\n\t date_maxtemp = response.parsed_response['response']['trip']['temp_high']['max']\n\t self.max = date_maxtemp['F']\n\n\t chance_of_freezing = response.parsed_response['response']['trip']['chance_of']['tempbelowfreezing']\n\t self.freeze = chance_of_freezing['name']\n\t self.freezeper = chance_of_freezing['percentage']\n\n\t chance_of_overfreezing = response.parsed_response['response']['trip']['chance_of']['tempoverfreezing']\n\t self.overfreeze = chance_of_overfreezing['name']\n\t self.overfreezeper = chance_of_overfreezing['percentage']\n\n\t chance_of_oversixty = response.parsed_response['response']['trip']['chance_of']['tempoversixty']\n\t self.warm = chance_of_oversixty['name']\n\t self.warmper = chance_of_oversixty['percentage']\n\n\t chance_of_overninety = response.parsed_response['response']['trip']['chance_of']['tempoverninety']\n\t self.hot = chance_of_overninety['name']\n\t self.hotper = chance_of_overninety['percentage']\n\n\t chance_of_sultry = response.parsed_response['response']['trip']['chance_of']['chanceofsultryday']\n\t self.sweltering = chance_of_sultry['name']\n\t self.swelteringper = chance_of_sultry['percentage']\n\n\t chance_of_humid = response.parsed_response['response']['trip']['chance_of']['chanceofhumidday']\n\t self.humid = chance_of_humid['name']\n\t self.humidper = chance_of_humid['percentage']\n\tend",
"def update_pairs\n download_data_from_exchange\n\n @html_body_parsed[\"result\"].each do |pair_JSON|\n pair_name = pair_JSON[\"MarketName\"]\n @pairs[pair_name].bid_best = pair_JSON[\"Bid\"]\n @pairs[pair_name].ask_best = pair_JSON[\"Ask\"]\n end\n end",
"def update!(raw: false)\n if valid? == false\n errors.full_messages.each do |msg|\n warn \"[#{parse_class}] warning: #{msg}\"\n end\n end\n response = client.update_object(parse_class, id, attribute_updates, session_token: _session_token)\n if response.success?\n result = response.result\n # Because beforeSave hooks can change the fields we are saving, any items that were\n # changed, are returned to us and we should apply those locally to be in sync.\n set_attributes!(result)\n end\n puts \"Error updating #{self.parse_class}: #{response.error}\" if response.error?\n return response if raw\n response.success?\n end",
"def create_location response\n GeoMagic::Location.new response.parsed_response\n end",
"def parsed_response\n response\n end",
"def normalize!(parsed)\n # command\n parsed[:command].downcase!\n\n if !['rm', 'ins', 'set'].include?(parsed[:command])\n raise OneCfg::Exception::FileParseError,\n \"Invalid patch action '#{parsed[:command]}'\"\n end\n\n # path\n parsed[:path] = parsed[:path].split('/').reject(&:empty?)\n\n # value\n unless parsed[:value].nil?\n parsed[:value] = JSON.parse(parsed[:value])\n end\n\n parsed\n end",
"def update\n respond_to do |format|\n if @api_v1_poll_response.update(api_v1_poll_response_params)\n format.html { redirect_to @api_v1_poll_response, notice: 'Poll response was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_poll_response }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_poll_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_vapix_response(raw)\n if raw =~ /Error: Error/\n return {}\n end\n response = nested_hash\n raw_responses = raw.split(/\\n/)\n raw_responses.each do |raw_response|\n raw_key_string, raw_value = raw_response.split('=')\n raw_keys = raw_key_string.split('.')\n raw_keys.shift # get rid of root.\n last_key = nil\n semilast_hash = nil\n last_hash = response\n raw_keys.length.times do |level|\n last_key = raw_keys[level]\n semilast_hash = last_hash\n last_hash = last_hash[last_key]\n end\n semilast_hash[raw_keys.last] = raw_value\n end\n return response\n end",
"def wrap_response(response)\n\t\t\t\t\tif body = response.body\n\t\t\t\t\t\tresponse.body = parser_for(response).new(body)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn response\n\t\t\t\tend",
"def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end",
"def parse_response(response)\n Lita.logger.debug \"parse_response started.\"\n gimme_what_you_got = {}\n noko = Nokogiri.HTML response\n noko.css('div#boxfielddata').each do |beer_node|\n # gimme_what_you_got\n tap_name = get_tap_name(beer_node)\n tap = tap_name.match(/\\d+/).to_s\n tap_type = tap_name.match(/(cask|nitro)/i).to_s\n\n remaining = beer_node.attributes['title'].to_s\n\n brewery = get_brewery(beer_node)\n beer_name = beer_node.css('span i').first.children.to_s\n beer_desc = get_beer_desc(beer_node)\n abv = get_abv(beer_desc)\n full_text_search = \"#{tap.sub /\\d+/, ''} #{brewery} #{beer_name} #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\"\n prices = get_prices(beer_node)\n\n gimme_what_you_got[tap] = {\n type: tap_type,\n remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_desc.to_s,\n abv: abv.to_f,\n prices: prices,\n price: prices[1][:cost],\n search: full_text_search\n }\n end\n gimme_what_you_got\n end",
"def create\n @pot = Pot.new(pot_params)\n\n respond_to do |format|\n if @pot.save\n format.html { redirect_to @pot, notice: 'Pot was successfully created.' }\n format.json { render :show, status: :created, location: @pot }\n else\n format.html { render :new }\n format.json { render json: @pot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_response(response)\n Lita.logger.debug \"parse_response started.\"\n gimme_what_you_got = {}\n noko = Nokogiri.HTML response\n tap = 0\n noko.css('div#boxfielddata').each do |beer_node|\n # gimme_what_you_got\n tap = tap + 1\n tap_name = get_tap_name(beer_node)\n\n remaining = beer_node.attributes['title'].to_s\n\n brewery = get_brewery(beer_node)\n beer_name = beer_node.css('span i').first.children.to_s\n beer_desc = get_beer_desc(beer_node)\n abv = get_abv(beer_desc)\n full_text_search = \"#{brewery} #{beer_name} #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\"\n\n gimme_what_you_got[tap] = {\n remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_desc.to_s,\n abv: abv.to_f,\n search: full_text_search\n }\n end\n gimme_what_you_got\n end",
"def setup\n @response ||= {}\n end",
"def update(response)\t\r\n\t\t@response = response\t\r\n\t\tmatched = false\r\n\t\tsaved_index = 0\r\n\r\n\t\t#Check for partial match\r\n\t\t@dictionary.each_index do |i|\r\n\t\t\tif response.include? @dictionary[i][0] and response.include? \"?\"\r\n\t\t\t\tsaved_index = i\r\n\t\t\t\tmatched = true\r\n\t\t\tend\r\n\t\tend\r\n\t\t#No partial match found, now check for a \"?\", no match, or one word response\t\t\r\n\t\tif matched\r\n\t\t\t@match_strategy.respond(saved_index)\r\n\t\telse\r\n\t\t\tif response.include? \"?\"\r\n\t\t\t\t@question_strategy.respond(saved_index)\t\t\r\n\t\t\telsif response.split(/\\s+/).length == 1\r\n\t\t\t\tgoodbye\r\n\t\t\t\t@user.delete_observer(self)\r\n\t\t\telse\r\n\t\t\t\t@change_strategy.respond(CHANGED_SUBJECT_INDEX)\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def processP45response(response)\n result = JSON.parse(response)\n status = result[\"status\"] \n sunk = result[\"sunk\"]\n game_status = result[\"game_status\"]\n \n if status == 'hit'\n self.enemy_hits += 1\n elsif status == 'miss'\n self.enemy_misses += 1\n end\n\n if !sunk.nil?\n # P45's naming convention is a bit diffenent, so this is necessary...\n if sunk == \"Patrol Boat\"\n p1 = Ship.find_by_name(\"Patrol1\")\n if self.enemy_ships.find_by_ship_id(p1).sunk == true\n sunk = \"Patrol2\"\n else\n sunk = \"Patrol1\"\n end\n end\n if sunk == \"Submarine\"\n s1 = Ship.find_by_name(\"Submarine1\")\n if self.enemy_ships.find_by_ship_id(s1).sunk == true\n sunk = \"Submarine2\"\n else\n sunk = \"Submarine1\"\n end\n end\n\n ship = Ship.find_by_name(sunk)\n eShip = self.enemy_ships.find_by_ship_id(ship)\n eShip.sunk = true\n eShip.save\n end\n\n toggle_turn\n if game_status == \"lost\"\n self.finished = true\n end\n self.save\n end",
"def update\n @response = Admin::Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:admin_response])\n format.html { redirect_to @response, notice: 'Response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_response(response)\n Lita.logger.debug 'parse_response started.'\n gimme_what_you_got = {}\n noko = Nokogiri.HTML response\n\n noko.css('article.tap-item').each do |beer_node|\n # gimme_what_you_got\n tap_name = beer_node.css('small.tapnum').children.to_s.sub 'Tap#', ''\n next if tap_name.empty?\n\n beer_name = beer_node.css('div.tap-content h1').children.to_s.strip\n\n greyout = beer_node.css('small.grayout').children.to_s\n greyedouts = greyout.split /\\|/\n beer_type = greyedouts[0].strip\n abv = greyedouts[1].match(/\\d+\\.*\\d*/).to_s\n if greyedouts[2]\n ibu = greyedouts[2].match(/\\d+/).to_s\n end\n\n price = beer_node.css('div.beer-price').children.first.to_s.strip.sub '$', ''\n\n full_text_search = \"#{beer_name} #{beer_type}\"\n\n gimme_what_you_got[tap_name] = {\n # type: tap_type,\n # remaining: remaining,\n # brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_type.to_s,\n abv: abv.to_f,\n ibu: ibu.to_f,\n price: price,\n search: full_text_search\n }\n end\n # puts gimme_what_you_got.inspect\n\n gimme_what_you_got\n end",
"def parse_response\n parse_address()\n parse_expires()\n parse_token_type()\n parse_token()\n end",
"def parse_response(response)\n details = response[:completed_shipment_detail]\n rate = details[:shipment_rating][:shipment_rate_details].first[:total_net_charge]\n package_details = details[:completed_package_details]\n \n shipment = Shipment.new\n shipment.rate = BigDecimal.new(rate[:amount])\n shipment.currency = rate[:currency]\n shipment.delivery_date = Date.parse(details[:routing_detail][:delivery_date])\n shipment.tracking_number = package_details[:tracking_id][:tracking_number]\n shipment.label = package_details[:label][:parts][:image] && Base64.decode64(package_details[:label][:parts][:image])\n shipment.barcode = package_details[:barcodes][:common2_d_barcode] && Base64.decode64(package_details[:barcodes][:common2_d_barcode])\n shipment\n end",
"def parse_response(response)\n gimme_what_you_got = {}\n response_doc = JSON.parse(response)\n response_doc['data'].each do |id, tap|\n tap_name = id\n\n brewery = tap['brewery']\n beer_name = tap['beer']\n\n beer_type = tap['style']\n # beer_type.sub! /\\s+-\\s+/, ''\n\n # abv = beer_node.css('td')[4].children.to_s\n full_text_search = \"#{brewery} #{beer_name.to_s.gsub /(\\d+|')/, ''}\" # #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\n\n price = (tap['prices'][0].sub /\\$/, '').to_f\n\n gimme_what_you_got[tap_name] = {\n # type: tap_type,\n # remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_type.to_s,\n # abv: abv.to_f,\n price: price,\n search: full_text_search\n }\n end\n\n gimme_what_you_got\n end",
"def set_response\n @response = Response.without_soft_destroyed.find(params[:id])\n end",
"def initialize(response, connection)\n @location = response.header[\"location\"]\n @status_code = response.code\n @status_message = response.message\n \n if response.body\n \n #If a receipt was returned, parse it\n begin\n #ensure that there are not parse errors. If there are, warn, rather then raise\n @entry = ::Atom::Entry.parse(response.body) \n @has_entry = true\n @entry.http = connection\n rescue Exception => message\n @has_entry = false\n $stderr.puts \"ERROR: An error occured processing the Response XML: #{message}\"\n rescue StandardError => error\n @has_entry = false\n $stderr.puts \"WARN: The deposit was successful, but there was an issue with Response XML. It could be missing. (#{error})\"\n end\n \n else\n #if the receipt was not returned, try and retrieve it\n if @location\n @entry = ::Atom::Entry.parse(connection.get(@location).body)\n @has_entry = true\n else\n #Otherwise, there is no receipt (e.g. for a delete)\n @has_entry = false\n @entry = nil\n end\n end\n end",
"def create\n @pot = Pot.new(params[:pot])\n\n respond_to do |format|\n if @pot.save\n format.html { redirect_to @pot, notice: 'Pot was successfully created.' }\n format.json { render json: @pot, status: :created, location: @pot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_response\n attrs.merge(@tag_ids_by_type).merge(\n {\n ingredients: @ingredients.reduce({}) { |h, i| h.merge(i.api_response) },\n priorities: @priority_tag_hash_array,\n ratings: @rating_tag_hash_array.select { |h| h[:tag_name].include? 'star' },\n comments: @comment_tag_hash_array\n }\n )\n end",
"def update_values\n response_hash = run_json_http_request\n @currency = 'CNY'\n @rate = BtcExchange.get_exchange_rate @currency, 'USD'\n @last = response_hash['ticker']['last'].to_f * @rate\n @vol = response_hash['ticker']['vol'].to_f\n @high = response_hash['ticker']['high'].to_f * @rate\n @low = response_hash['ticker']['low'].to_f * @rate\n @buy = response_hash['ticker']['buy'].to_f * @rate\n @sell = response_hash['ticker']['sell'].to_f * @rate\n end",
"def update\n @potluck = Potluck.find(params[:id])\n\n respond_to do |format|\n if @potluck.update_attributes(params[:potluck])\n session[:letin] = \"ok\"\n format.html { redirect_to :back, notice: 'Thanks for helping out. The host will be notified that you are bringing '+ @potluck.item + '.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @potluck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reload\n handle_response SurveyGizmo.get(handle_route(:get)) do\n if _response.ok?\n self.attributes = _response.data\n clean!\n else\n false\n end\n end\n end",
"def wiki_process_response( response, response_plugin, wiki_searched )\n\n\t\treturn false if ! submit?() || ! authorized?\n\n\t\tlyrics_found_on_site = response.lyrics && response_plugin == self\n\t\tlyrics_autogenerated = lyrics_found_on_site && ! response.custom_data[\"reviewed\"]\n\n\t\treturn false if lyrics_found_on_site && ! lyrics_autogenerated # we have nothing to do\n\t\treturn false if (! @wpa_prompt_autogen && lyrics_autogenerated) || (! @wpa_prompt_no_lyrics && ! response.lyrics)\n\n\t\tbegin\n\n\t\t\tcheck_submit_conditions()\n\n\t\t\tsong_data = MediaWikiLyrics::SongData.new(\n\t\t\t\tresponse.artist ? response.artist : response.request.artist,\n\t\t\t\tresponse.title ? response.title : response.request.title,\n\t\t\t\tresponse.lyrics,\n\t\t\t\tresponse.album ? response.album : response.request.album,\n\t\t\t\tresponse.year ? response.year : response.request.year,\n\t\t\t\tresponse.custom_data[\"credits\"],\n\t\t\t\tresponse.custom_data[\"lyricist\"]\n\t\t\t)\n\n\t\t\tsubmitted_url, submitted_data = submit_song_page(\n\t\t\t\tsong_data,\n\t\t\t\tlyrics_autogenerated ? response.url : nil, # are we editing an existing page or creating a new one?\n\t\t\t\tsong_data.artist == response.request.artist && song_data.title == response.request.title &&\n\t\t\t\twiki_searched && ! lyrics_found_on_site, # do we KNOW FOR SURE the page doesn't exists?\n\t\t\t\t@wpa_review || lyrics_autogenerated, # should we show the review contents dialog?\n\t\t\t\tlyrics_autogenerated # should user be forced to review contents? (true causes the operation to abort otherwise)\n\t\t\t)\n\n\t\t\t# transfer summited data to response\n\t\t\tif submitted_data\n\t\t\t\tresponse.artist = submitted_data[\"artist\"] if ! Strings.empty?( submitted_data[\"artist\"] )\n\t\t\t\tresponse.title = submitted_data[\"title\"] if ! Strings.empty?( submitted_data[\"title\"] )\n\t\t\t\tresponse.album = submitted_data[\"album\"] if ! Strings.empty?( submitted_data[\"album\"] )\n\t\t\t\tresponse.year = submitted_data[\"year\"] if ! Strings.empty?( submitted_data[\"year\"] )\n\t\t\t\tresponse.lyrics = submitted_data[\"lyrics\"] if ! Strings.empty?( submitted_data[\"lyrics\"] )\n\t\t\t\tcustom_data = {}\n\t\t\t\tcustom_data.merge( response.custom_data )\n\t\t\t\tcustom_data[\"credits\"] = submitted_data[\"credits\"] if ! Strings.empty?( submitted_data[\"credits\"] )\n\t\t\t\tcustom_data[\"lyricst\"] = submitted_data[\"lyricst\"] if ! Strings.empty?( submitted_data[\"lyricst\"] )\n\t\t\t\tresponse.custom_data = custom_data\n\t\t\tend\n\n\t\t\treturn (@wpa_review || lyrics_autogenerated) && submitted_data\n\n\t\trescue TimeoutError\n\t\t\tnotify( I18n.get( \"cli.application.plugintimeout\", plugin_name(), site_host() ) )\n\t\t\treturn false\n\t\tend\n\n\tend",
"def prepare_commander_result(commander)\n commander.instance_exec do\n command.to_hash.each do |name, value|\n instance_variable_set to_ivar(name), value\n end\n remove!(:command)\n end\n end",
"def parse(response)\n case response\n when Hash\n response.each_with_object({}) do |(key, value), new_hash|\n new_hash[camel_case_to_snake_case(key).to_sym] = parse(value)\n end\n when Array\n response.map { |item| parse item }\n else\n response\n end\n end",
"def update_response(processed)\n case processed\n when Integer then response.status = processed\n when String,NilClass then response.body << processed.to_s\n when Array\n response.status = processed[0].to_i\n if response.respond_to?(:headers=)\n response.headers = processed[1]\n else\n processed[1].each do |key, value|\n response[key] = value\n end\n end\n response.body = processed[2].respond_to?(:each) ? processed[2] : [processed[2]]\n when Hash\n response.status = processed[:status].to_i if processed.key?(:status)\n response.headers.update(processed[:headers]) if processed.key?(:headers)\n response.body = processed[:body].respond_to?(:each) ? processed[:body] : [processed[:body]] if processed.key?(:body)\n end\n end",
"def Pot\n exp1, msg = self.Primario\n if exp1 then\n if @token.get_tipo == \"^\" then\n op, msg = le(\"^\")\n if op\n exp2, msg = self.Fator\n if exp2 then\n return Hash[\"tag\" => \"pot\", \"1\" => exp1, \"2\" => exp2]\n else\n return nil, msg\n end\n else\n return nil, msg\n end \n end\n return exp1\n end \n return nil, msg \n end",
"def update!(**args)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def update!(**args)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def update!(**args)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def parsed_response\n #logger.debug { \"Parsing Response: #{response.content_type}\" }\n return response unless response\n @parsed_response ||= case response.content_type\n when 'application/json'; response.body.empty? ? '' : JSON.parse(response.body)\n when 'text/html'; { } #HTMLResponseParser.parse(response.body)\n else; response.respond_to?(:to_hash) ? response.to_hash : response.to_s\n end\n @parsed_response\n end",
"def set_attrs_from_response(response)\n unless response.body.nil? or response.body.length < 2\n json = self.class.parse_json(response.body)\n set_attrs(json)\n end\nend",
"def initialize(attributes, response, token) # :nodoc:\n Helpers.load_variables(self, ATTRIBUTES, attributes)\n\n @last_response = response\n @application_token = token\n end",
"def pot_adjustment\n @committed += @active_players[0].current_bet unless @active_players[0].folded\n @pot_size += @active_players[0].current_bet\n @active_players[0].chip_stack -= @active_players[0].current_bet\n @active_players[0].acted = true\nend",
"def initialize(response_string)\n @field_delim = \"|\"\n @value_delim = \"~\"\n @multi_value_delim = \"+\"\n @values = {}\n @errors = {}\n\n if response_string.include? 'COMMERROR' or response_string.include? 'COMM ERROR' \n raise PayTrace::Exceptions::NetworkError, \"Request was not processed due to a connectivity issue.\"\n end\n parse_response(response_string)\n end",
"def set_http_response(response, skip_body=false)\n @data[:response][:instance] = HTTPResponse.new(\n response.code,\n skip_body ? nil : response.body,\n response.to_hash,\n response\n )\n nil\n end",
"def respond_with(response_hash = {})\n if response_hash[:errors]\n response_hash[:errors].merge!(errors) # Just in case there are errors loaded directly from the caller, we don't want to completely obliterate them\n else\n response_hash[:errors] = errors\n end\n \n Response.new(response_hash)\n end",
"def parse_response(response)\n raise NotImplementedError\n end",
"def update_values\n response_hash = run_json_http_request\n \n # check to make sure we're using the correct currency\n currency = response_hash['return']['last']['currency']\n if @currency != currency\n @currency = currency\n @rate = BtcExchange.get_exchange_rate @currency, 'USD'\n end\n \n # set the values\n @last = response_hash['return']['last']['value'].to_f * @rate\n @vol = response_hash['return']['vol']['value'].to_f\n @high = response_hash['return']['high']['value'].to_f * @rate\n @low = response_hash['return']['low']['value'].to_f * @rate\n @buy = response_hash['return']['buy']['value'].to_f * @rate\n @sell = response_hash['return']['sell']['value'].to_f * @rate\n end",
"def load_attributes_from_response(response)\n if (response['Transfer-Encoding'] == 'chunked' ||\n (!response['Content-Length'].blank? && response['Content-Length'] != \"0\")) &&\n !response.body.nil? && response.body.strip.size > 0\n load( self.class.format.decode(response.body)[self.class.element_name] )\n end\n end",
"def returns(response)\n @response = response\n self\n end",
"def prepare_response\n self.send(route, parse_query)\n end",
"def parse_tracking_response(document)\n response = {}\n response[:tracking_numbers] = {}\n\n track_node = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:TrackingNumber')\n if track_node\n id_node = REXML::XPath.first(document, '//ns1:MerchantFulfillmentOrderId')\n response[:tracking_numbers][id_node.text] = track_node.text\n # Changes start here:\n carrier = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:CarrierCode')\n ship_time = REXML::XPath.first(document, '//ns1:FulfillmentShipment/ns1:ShippingDateTime')\n eta = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:EstimatedArrivalDateTime')\n response[:fulfillment_info] = {}\n response[:fulfillment_info][id_node.text] = {}\n response[:fulfillment_info][id_node.text][:tracking_number] = track_node.text\n response[:fulfillment_info][id_node.text][:carrier] = carrier.text if carrier\n response[:fulfillment_info][id_node.text][:ship_time] = ship_time.text if ship_time\n response[:fulfillment_info][id_node.text][:eta] = eta.text if eta\n # Changes end here\n end\n\n response[:response_status] = ActiveMerchant::Fulfillment::AmazonService::SUCCESS\n response\n end",
"def update!(**args)\n @prominence_meters = args[:prominence_meters] if args.key?(:prominence_meters)\n end",
"def initialize(resp)\n @response = resp\n @parsed = -> { MultiJson.load(body) rescue body }.call\n end",
"def parse(savon_response)\n new(savon_response)\n end"
] | [
"0.5730362",
"0.5544215",
"0.5327246",
"0.5315911",
"0.53124005",
"0.5204266",
"0.51660633",
"0.51212996",
"0.50939006",
"0.5052703",
"0.50027585",
"0.49511257",
"0.49487406",
"0.4944145",
"0.4937013",
"0.4935006",
"0.49239412",
"0.4900529",
"0.48654515",
"0.48588693",
"0.4853622",
"0.48517793",
"0.48335502",
"0.48040313",
"0.4800802",
"0.47891772",
"0.47861975",
"0.47808754",
"0.47530922",
"0.4747429",
"0.47312826",
"0.4730056",
"0.47206506",
"0.472041",
"0.4705029",
"0.4692809",
"0.4691295",
"0.4683768",
"0.46583512",
"0.46572065",
"0.4644022",
"0.4644022",
"0.4644022",
"0.4644022",
"0.46437982",
"0.46303707",
"0.4626897",
"0.46260515",
"0.46216995",
"0.4615026",
"0.4603283",
"0.46023896",
"0.45918655",
"0.45657912",
"0.45600578",
"0.455669",
"0.45556536",
"0.45450443",
"0.45392445",
"0.45326957",
"0.45297933",
"0.45295867",
"0.45238298",
"0.45203087",
"0.4515475",
"0.45044455",
"0.45039138",
"0.45038742",
"0.44996426",
"0.44894737",
"0.44406584",
"0.44402373",
"0.44395393",
"0.4439301",
"0.44342682",
"0.44289297",
"0.44203007",
"0.4417429",
"0.4413204",
"0.44116214",
"0.44109437",
"0.44057003",
"0.44057003",
"0.44057003",
"0.4394865",
"0.4389367",
"0.43759117",
"0.43705648",
"0.43704876",
"0.43651462",
"0.43542728",
"0.43461034",
"0.4341815",
"0.4338281",
"0.43371183",
"0.43331617",
"0.4324226",
"0.43232122",
"0.43196622",
"0.43054855"
] | 0.6521878 | 0 |
Initializes a FSEvent worker and adds a watcher for each directory passed to the adapter. | def init_worker
FSEvent.new.tap do |worker|
worker.watch(@directories.dup, :latency => @latency) do |changes|
next if @paused
@mutex.synchronize do
changes.each { |path| @changed_dirs << path.sub(LAST_SEPARATOR_REGEX, '') }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_worker\n worker = FChange::Notifier.new\n @directories.each do |directory|\n watcher = worker.watch(directory, :all_events, :recursive) do |event|\n next if @paused\n @mutex.synchronize do\n @changed_dirs << File.expand_path(event.watcher.path)\n end\n end\n worker.add_watcher(watcher)\n end\n worker\n end",
"def _init_worker\n INotify::Notifier.new.tap do |worker|\n _directories_path.each { |path| worker.watch(path, *EVENTS, &_worker_callback) }\n end\n end",
"def init_worker\n @worker = FSEvent.new\n @worker.watch(@directory, :latency => @latency) do |changed_dirs|\n next if @paused\n\n changed_dirs.map! { |path| path.sub /\\/$/, '' }\n @callback.call(changed_dirs, {})\n end\n end",
"def init_worker\n @worker = INotify::Notifier.new\n @worker.watch(@directory, *EVENTS.map(&:to_sym)) do |event|\n next if @paused\n \n unless event.name == \"\" # Event on root directory\n @changed_dirs << File.dirname(event.absolute_name)\n end\n end\n end",
"def _configure(dir, &callback)\n opts = { latency: options.latency }\n\n @workers ||= ::Queue.new\n @workers << FSEvent.new.tap do |worker|\n _log :debug, \"fsevent: watching: #{dir.to_s.inspect}\"\n worker.watch(dir.to_s, opts, &callback)\n end\n end",
"def init_worker\n callback = Proc.new do |change|\n next if @paused\n @mutex.synchronize do\n @changed_dirs << File.dirname(change.path)\n end\n end\n\n WDM::Monitor.new.tap do |worker|\n @directories.each { |d| worker.watch_recursively(d, &callback) }\n end\n end",
"def _init_worker\n KQueue::Queue.new.tap do |queue|\n _directories_path.each do |path|\n Find.find(path) { |file_path| _watch_file(file_path, queue) }\n end\n end\n end",
"def setup_watcher\n this = self\n Handler.send(:define_method, :app) do\n this\n end\n\n @@load_paths.each do |name, path|\n Dir[\"#{self.app_path}/#{path}\"].each do |f|\n EM.watch_file(f, Handler)\n end\n end\n end",
"def attach\n @monitored_paths.each {|path| SingleFileWatcher.new(path.to_s).attach(@loop) }\n end",
"def listen\n @listener ||= Listen.to(@directory) do |modified, added, removed|\n to_reload = Set[] # list of component path to reload\n\n (added + modified + removed).each do |file|\n to_reload.add(file) if file.end_with? @suffix # add the file to the reload list if it's a component\n\n dependent_comps = @loaded_components.select{ |comp| comp.depend_on? file } # find every components that depend on the current file\n to_reload += dependent_comps.map(&:path) if dependent_comps # add their path to the reload list\n end\n\n unless to_reload.empty?\n @mutex.synchronize do\n info 'Waiting for all event threads to finish...' unless @bot.event_threads.empty?\n @bot.event_threads.each(&:join)\n\n to_reload.each { |file| reload! file }\n end\n end\n end\n\n @listener.start unless @listener.processing?\n end",
"def initialize(paths, dirs={}, opts={}, &block)\n @paths = paths\n @dirs = dirs\n @opts = opts\n @block = block\n\n @start_time = Time.now\n @file_cache = ThreadSafe::Cache.new\n @changed_files = Queue.new\n @semaphore = Mutex.new\n\n listen_for_changes\n end",
"def do_listening\n in_dir @config.base_path do\n\n # Notify people if we are using fallback mode\n if @config.force_poll\n puts statusbar \"Using polling fallback listener\", &:yellow\n end\n\n # Force a change to start with\n run_command\n\n params = {\n latency: 0.5,\n }\n\n params[:only] = Regexp.new(@config.filters.join(\"|\")) unless @config.filters.empty?\n params[:ignore] = Regexp.new(@config.ignored.join(\"|\")) unless @config.ignored.empty?\n\n if @config.force_poll\n params[:latency] = @config.force_poll\n params[:force_poll] = true\n end\n\n @listener = Listen.to(*@config.paths, params) do |*args|\n self.on_change *args\n end\n \n @listener.start\n end\n end",
"def watch(watched_dirs)\n watched_dirs << @directory\n end",
"def start_watchers\n # Watcher callbacks are invoked in a separate Ruby thread. Note that there\n # is a possible deadlock between invoking watcher callbacks and calling\n # close(): if we get a watcher event and a close at around the same time,\n # the close might fire first. Closing the Zk handle will block on\n # dispatching outstanding watchers, but it does so holding the @zk_mutex,\n # causing a deadlock. Hence, we just have the watcher callback spin on the\n # @zk_mutex, aborting if the handle is ever closed.\n @child_watcher = Zookeeper::Callbacks::WatcherCallback.new do\n while true\n break if @zk.closed?\n if @zk_mutex.try_lock\n get_and_watch unless @zk.closed?\n @zk_mutex.unlock\n break\n end\n end\n end\n\n @stat_watcher = Zookeeper::Callbacks::WatcherCallback.new do\n while true\n break if @zk.closed?\n if @zk_mutex.try_lock\n stat_and_watch unless @zk.closed?\n @zk_mutex.unlock\n break\n end\n end\n end\n\n stat_and_watch\n end",
"def start\n $stderr.puts \"Watching filesystem events in: #{@existing_parent}\"\n\n callback = Proc.new do |modified, added, removed|\n if added.any? {|i| File.fnmatch(@watch_path, i) }\n puts \"Added: #{@watch_path}\"\n exit 0\n end\n end\n\n listener = Listen.to(@existing_parent, ignore!: [], &callback)\n listener.start\n\n # Set trap so that we can break out of `sleep`\n Signal.trap(\"INT\") do\n puts \"Exiting...\"\n exit 4\n end\n\n sleep\n end",
"def start\n puts \"Watching these files for changes #{glob}...\"\n configure_directory_watcher\n setup_graceful_exit\n \n directory_watcher.start.join\n end",
"def start_poller\n @poller_thread = Thread.new { poll_changed_directories }\n end",
"def setup\n t = Thread.new { build_directories_records }\n @adapter = initialize_adapter\n t.join\n end",
"def initialize\n @path_watcher_map = Hash.new do |hash, key|\n hash[key] = Watcher.new(key)\n end\n end",
"def initialize_adapter\n callback = lambda { |changed_directories, options| self.on_change(changed_directories, options) }\n Adapter.select_and_initialize(directories, adapter_options, &callback)\n end",
"def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end",
"def load_watcher\n require 'doozer/watcher'\n \n puts \"=> Watching files for changes\"\n watcher = FileSystemWatcher.new()\n \n # watcher.addDirectory(File.join(File.dirname(__FILE__),'../doozer/'), \"*.rb\")\n watcher.addDirectory( app_path + '/app/', \"**/*\")\n watcher.addDirectory( app_path + '/app', \"**/**/*\")\n watcher.addDirectory( app_path + '/config/', \"*.*\")\n watcher.addDirectory( app_path + '/lib/', \"*.*\")\n watcher.addDirectory( app_path + '/static/', \"*.*\")\n watcher.addDirectory( app_path + '/static/', \"**/**/*\")\n\n watcher.sleepTime = 1\n watcher.start { |status, file|\n if(status == FileSystemWatcher::CREATED) then\n puts \"created: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n elsif(status == FileSystemWatcher::MODIFIED) then\n puts \"modified: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n Doozer::Configs.clear_static_files\n elsif(status == FileSystemWatcher::DELETED) then\n puts \"deleted: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n Doozer::Configs.clear_static_files\n end\n }\n #don't join the thread it messes up rackup threading watcher.join()\n # p watcher.isStarted?\n # p watcher.isStopped?\n # p watcher.foundFiles.inspect\n end",
"def configure\n return if @configured\n @configured = true\n\n @callbacks ||= {}\n @directories.each do |dir|\n unless dir.is_a?(Pathname)\n fail ArgumentError, \"not a Pathname: #{dir.inspect}\"\n end\n\n callback = @callbacks[dir] || lambda do |event|\n _process_event(dir, event)\n end\n @callbacks[dir] = callback\n _configure(dir, &callback)\n end\n end",
"def start\n puts \"Watcher RUNNING------------------->\"\n loop do\n unless (diff = build_file_list - @org_file_list).empty?\n # sleep 0.5\n diff.each do |meta|\n @callbacks[:new_file_created].call(meta[0])\n end\n exit\n end\n sleep 0.5\n end\n end",
"def listen_for_changes\n @semaphore.synchronize do\n @files_alive = []\n\n paths = initialize_paths(@paths, @dirs)\n directories = handle_paths(paths)\n if @opts[:recurse]\n update_changed_files(directories)\n end\n\n deleted_files = @file_cache.keys - @files_alive.uniq\n deleted_files.each do |filename|\n @file_cache.delete(filename)\n push_changes(filename, :removed)\n end\n end\n end",
"def initialize(dir=nil, expression=\".*\")\r\n @sleepTime = 5\r\n @priority = 0\r\n @stopWhen = nil\r\n\r\n @directories = Array.new()\r\n @files = Array.new()\r\n\r\n @foundFiles = nil\r\n @firstLoad = true\r\n @watchThread = nil\r\n \r\n initializeState()\r\n\r\n if dir then\r\n addDirectory(dir, expression)\r\n end\r\n end",
"def initialize(watchers, notify_targets)\n @watchers = watchers\n @notify_targets = notify_targets\n\n @fd = nil\n @thread = nil\n end",
"def setup_watcher!(watch_type, opts)\n return yield unless opts.delete(:watch)\n\n @setup_watcher_mutex.synchronize do\n path = opts[:path]\n added, set = nil, nil\n\n synchronize do\n set = @outstanding_watches.fetch(watch_type)\n added = set.add?(path)\n end\n\n if added\n logger.debug { \"adding watcher #{watch_type.inspect} for #{path.inspect}\"}\n\n # if we added the path to the set, blocking further registration of\n # watches and an exception is raised then we rollback\n begin\n # this path has no outstanding watchers, let it do its thing\n opts[:watcher] = watcher_callback(watch_type)\n\n yield opts\n rescue Exception\n synchronize do\n set.delete(path)\n end\n raise\n end\n else\n logger.debug { \"watcher #{watch_type.inspect} already set for #{path.inspect}\"}\n\n # we did not add the path to the set, which means we are not\n # responsible for removing a block on further adds if the operation\n # fails, therefore, we just yield\n yield opts\n end\n end\n end",
"def create_threaded_fsevent(watch_path, options, &action_block)\n fsevent = FSEvent.new\n running_jobs = Set.new\n\n fsevent.watch watch_path, options do |paths|\n paths.delete_if {|path| ignored?(path) }\n log.warn \"Detected change inside: #{paths.inspect}\" unless paths.empty?\n\n if running_jobs.length > 0\n log.warn \"A job is currently running for this watcher, killing...\"\n running_jobs.each {|thread| thread.kill }\n else\n log.warn \"Phew, no running jobs: #{running_jobs}\"\n end\n\n job = Thread.new do\n action_block.call(paths)\n Thread.exit\n end\n\n track_job_on_list(job, running_jobs)\n end\n\n fsevent\n end",
"def directories_to_watch\n []\n end",
"def worker\n @fsevent\n end",
"def watch\n paths = [ Rails.root.join('app'), Rails.root.join('lib') ]\n @worker.log \"Watching files in #{paths}\"\n\n reloader = ActiveSupport::FileUpdateChecker.new(paths) { rework }\n Rails.application.reloaders << reloader\n\n ActionDispatch::Reloader.to_prepare do\n reloader.execute_if_updated\n end\n\n true\n end",
"def start_watch_files\n coffee_files.each do |file|\n @notifier.watch(file, :modify) do\n CoffeeCompiler.compile_file(file, true, true)\n end\n end\n end",
"def setup!\n Patches::Queue.apply!\n\n Sidekiq.configure_server do |config|\n config.on(:startup) { start_watcher }\n config.on(:quiet) { stop_watcher }\n\n @communicator.receive(PAUSE_MESSAGE, &method(:add))\n @communicator.receive(RESUME_MESSAGE, &method(:delete))\n @communicator.ready { sync! }\n end\n end",
"def initialize(adapter_factory, options={})\n @adapter_factory = adapter_factory\n options = @@default_options.merge(options)\n @stopped = false\n @name = options[:name] || Qwirk::DEFAULT_NAME\n @poll_time = options[:poll_time] || 3.0\n @stop_time = options[:stop_time]\n @worker_configs = []\n @env = options[:env]\n @worker_options = parse_worker_file(options[:worker_file])\n @persist_file = options[:persist_file]\n @persist_options = (@persist_file && File.exist?(@persist_file)) ? YAML.load_file(@persist_file) : {}\n\n BaseWorker.worker_classes.each do |worker_class|\n worker_class.each_config(adapter_factory.worker_config_class) do |config_name, extended_worker_config_class, default_options|\n # Least priority is config default_options defined in the Worker class, then the workers.yml file,\n # highest priority is persist_file (ad-hoc changes made manually)\n options = {}\n options = options.merge(@worker_options[config_name]) if @worker_options[config_name]\n options = options.merge(@persist_options[config_name]) if @persist_options[config_name]\n worker_config = extended_worker_config_class.new(adapter_factory, config_name, self, worker_class, default_options, options)\n bean_add_child(config_name, worker_config)\n @worker_configs << worker_config\n end\n end\n\n start_timer_thread\n at_exit { stop }\n end",
"def run_all\n #run_on_changes(Watcher.match_files(self, Dir.glob(\"**/*.*\")))\n @builder.notify(true)\n end",
"def watcher_callback\n @callback ||= Proc.new do |event|\n # Set new watcher\n watch\n # Rediscover\n discover\n end\n end",
"def start_watches(paths)\r\n for path in paths\r\n # Get or create a Position object for the file path.\r\n pos_file = @pos != nil ? @pos.get_position(path) : Position.new(path)\r\n # Create a LogState to track the log.\r\n log_state = LogState.new(pos_file, method(:emit_lines))\r\n # Start a timer to check for changes in the log and emit new lines.\r\n log_state.timer = timer_execute(:iis_file_watchers, @read_log_entires, repeat: false, &log_state.method(:emit_lines))\r\n @watched_files[path] = log_state\r\n end\r\n end",
"def watch\n @listener ||= Listen.to(\n File.dirname(PATH),\n only: /\\A#{File.basename(PATH)}\\z/\n ) do |modified, added, removed|\n next if modified.empty? && added.empty? && removed.empty?\n\n reload\n end\n\n @listener.start\n end",
"def sync\n callback = Proc.new do |modified, added, removed|\n added && added.each do |add_file|\n @store.add(@local_directory + \"/\" + add_file)\n end\n modified && modified.each do |modified_file|\n @store.modify(@local_directory + \"/\" + modified_file)\n end\n removed && removed.each do |remove_file|\n @store.remove(@local_directory + \"/\" + remove_file)\n end\n end\n @listener.change(&callback) # convert the callback to a block and register it\n @listener.start! # have to use !\n end",
"def watchable_dirs; end",
"def add_watch(m, params)\n path = params[:path ]\n event = params[:event]\n type = params[:type ]\n m.reply \"no such file or directory: #{path}\" and return if not File.exists? path\n\n # tries to find watch with specified path and skip if found\n watch = watch_lookup path\n if watch\n debug \" [+] watch existing skipping\"\n return\n end\n \n debug \" [+] create new Watch\"\n watch = Watch.new(path, event, type, @watch_thread.fd)\n @watchers << watch\n \n m.reply \"add event listener for #{path} do not add channel/nickname to watchlist.\"\n end",
"def watch(directory)\n worker.watch(directory) do |modified_dirs|\n files = modified_files(modified_dirs)\n @callback.call(files) unless files.empty?\n end\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob(File.join('**', '*.*'))))\n end",
"def start_watcher\n Thread.new{ loop{ watcher_cycle }}\n end",
"def register_worker\n super\n\n puts \"Fifo Startup - Updating worker list\"\n manager.request_refresh\n end",
"def initialize(*args, &block)\n @options = _init_options(args.last.is_a?(Hash) ? args.pop : {})\n @directories = args.flatten.map { |path| Pathname.new(path).realpath }\n @changes = []\n @block = block\n @registry = Celluloid::Registry.new\n _init_debug\n end",
"def run_all\n run_on_change(\n Watcher.match_files(\n self, \n Dir.glob(File.join(::Guard.listener.directory, '**', '*.s[ac]ss')).\n map {|f| f[::Guard.listener.directory.size+1..-1] }.\n reject {|f| partial?(f) }\n )\n )\n end",
"def run\n evq = Queue.new\n\n if @config.file_path\n dir = File.dirname @config.file_path\n filter = %r{#{File.basename @config.file_path}$}\n @cfg_listener = Listen.to dir do |*args|\n next unless args.reduce(&:+).include? @config.file_path\n if @listener\n puts statusbar \"Re-loading Config File...\", &:yellow\n @listener.stop\n evq.push true\n end\n end\n @cfg_listener.start\n end\n\n # on C-c tell all listeners to stop\n Signal.trap \"INT\", \"DEFAULT\"\n\n # loop forever listening, each time the above block causes the listener\n # to stop it will re-start listening with the new config.\n while true\n do_listening\n break unless evq.pop\n @config.reload\n end\n end",
"def run_all\n run_on_additions(Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq))\n end",
"def file_watcher; end",
"def file_watcher; end",
"def watcher_cycle\n return unless @watcher.wait_for_events(POLL_INTERVAL)\n\n @watcher.each_event do |event|\n @changed.push(event.watch_descriptor)\n end\n end",
"def watch!(*globs)\n @watchlist.accept!(globs)\n end",
"def start\n return if @thread\n @thread = Thread.start do\n @fd = Inotify.init\n \n @watchers.each do |watch|\n watch.add_watch(@fd)\n end\n\n @filePtr = FFI::IO.for_fd(@fd)\n while true\n debug \" [+] @watch_thread listening for inotify events\"\n \n buffer = FFI::Buffer.alloc_out(Inotify::Event.size + 4096, 1, false)\n event = Inotify::Event.new buffer\n ready = IO.select([@filePtr], nil, nil, nil)\n n = Inotify.read(@fd, buffer, buffer.total)\n\n event_wd = event[:wd]\n event_mask = event[:mask]\n event_len = event[:len]\n\n debug \" [+] meta event message ignored.\" and next if event_len == 0\n \n # the filename is set after the event datastructure(16 bytes fixed)\n event_file = buffer.get_string(16) # 16 bytes offset\n\n debug \" [+] raw event notification wd(#{event_wd.inspect}) \" + \n \"len(#{event[:len]}) mask(#{event_mask}) \" +\n \"subject(#{event_file.inspect})\"\n\n @watchers.each do |watch|\n # process only if watch descriptor matches\n if event_wd == watch.wd\n watch.process(event_mask, event_file, @notify_targets)\n end\n end\n end\n debug \" [+] the watch thread is terminated.\"\n end # end thread\n end",
"def initialize\n @daemon_workers = Hash.new{ |h, k| h[k] = [] }\n\n after_initialize if respond_to?(:after_initialize)\n end",
"def setup\n logger.info 'setup workers'\n\n setup_refresh_timer\n setup_analyze_timer\n end",
"def listen(monitored_paths)\n @monitored_paths = monitored_paths\n attach\n @loop.run\n end",
"def watchable_files; end",
"def add_watch(fd)\n @fd = fd\n @wd = Inotify.add_watch(@fd, @path, @event)\n debug \" [+] add inotify watch fd(#{@fd})=>path(#{path})\" +\n \"=>wd(#{@wd})\"\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.coffee')))\n end",
"def start(&block)\r\n if isStarted? then\r\n raise RuntimeError, \"already started\"\r\n end\r\n\r\n setState(STARTED)\r\n\r\n @firstLoad = true\r\n @foundFiles = Hash.new()\r\n\r\n # we watch in a new thread\r\n @watchThread = Thread.new {\r\n # we will be stopped if someone calls stop or if someone set a stopWhen that becomes true\r\n while !isStopped? do\r\n if (!@directories.empty?) or (!@files.empty?) then \r\n # this will hold the list of the files we looked at this iteration\r\n # allows us to not look at the same file again and also to compare\r\n # with the foundFile list to see if something was deleted\r\n alreadyExamined = Hash.new()\r\n \r\n # check the files in each watched directory\r\n if not @directories.empty? then\r\n @directories.each { |dirObj|\r\n examineFileList(dirObj.getFiles(), alreadyExamined, &block)\r\n }\r\n end\r\n \r\n # now examine any files the user wants to specifically watch\r\n examineFileList(@files, alreadyExamined, &block) if not @files.empty?\r\n \r\n # see if we have to delete files from our found list\r\n if not @firstLoad then\r\n if not @foundFiles.empty? then\r\n # now diff the found files and the examined files to see if\r\n # something has been deleted\r\n allFoundFiles = @foundFiles.keys()\r\n allExaminedFiles = alreadyExamined.keys()\r\n intersection = allFoundFiles - allExaminedFiles\r\n intersection.each { |fileName|\r\n # callback\r\n block.call(DELETED, fileName)\r\n # remove deleted file from the foundFiles list\r\n @foundFiles.delete(fileName)\r\n } \r\n end\r\n else\r\n @firstLoad = false\r\n end\r\n end\r\n \r\n # go to sleep\r\n sleep(@sleepTime)\r\n end\r\n }\r\n \r\n # set the watch thread priority\r\n @watchThread.priority = @priority\r\n\r\n end",
"def initialize(files: nil, directory: default_path, dev: adapter.development?)\n @path = directory.is_a?(Pathname) ? directory : Pathname.new(directory)\n\n list = Filter.create(files: files, dev: dev, wip_list: wip_list)\n @files = @path.glob(\"*#{RecordFile::EXTENSION}\")\n .select { |child| list.include?(RecordFile.new(child)) }\n load_config\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact))\n end",
"def watch(opts)\n @watcher.set_files(opts[:files]) if opts[:files]\n @watcher.watch(method(:files_changed))\n end",
"def listen\n daemonize if @background\n @logger.log \"GIT FYNCY: Listening @ #{Time.now.ctime}\"\n relpath = method :relative_path\n files_to_remove = Set.new\n begin\n Listen.to!('.') do |modified, added, removed|\n begin\n self.sync\n rel_removed = removed.map(&relpath)\n files_to_remove.merge rel_removed\n files_to_remove.clear if @remote.rm files_to_remove\n rescue => e\n @logger.log e.inspect\n end\n end\n rescue SignalException\n exit 42\n ensure\n @logger.log \"\\n\"\n end\n end",
"def initialize (service_name, application_context)\n\n super # necessary since we're extending MonitorMixin\n\n @buckets = {}\n\n @workdir = get_work_directory + '/journal'\n @donedir = @workdir + '/done'\n\n FileUtils.makedirs(@donedir) unless File.exist?(@donedir)\n\n get_expression_pool.add_observer(:all) do |event, *args|\n #ldebug { \":#{event} for #{args[0].class.name}\" }\n queue_event(event, *args)\n end\n\n @thread_id = get_scheduler.schedule_every(FREQ) do\n flush_buckets()\n end\n end",
"def watch_files(files)\n @files.concat files\n self\n end",
"def run_on_changes(paths)\n if options[:all_on_change]\n paths = Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact)\n end\n paths = paths.select {|path| not options[:exclude] =~ path and File.file? path}\n\n directories = detect_nested_directories(watchers, paths, options)\n written = []\n\n directories.each do |directory, files|\n files.each do |file|\n begin\n act_on(directory, file)\n written << file\n rescue Exception => e\n error(e.message, file)\n throw :task_has_failed\n end\n end\n end\n if written.length > 0\n notify(written)\n end\n end",
"def initialize(watchers = [], options = {})\n options = DEFAULTS.merge(options)\n super(watchers, options)\n end",
"def init_workers(servers)\n @w = []\n servers.each{|s|\n @w << Worker.new(s)\n }\n end",
"def initialize(*args)\n super(*args)\n self.class.event_hooks.each do | sym, handler |\n listen(self, sym, handler)\n end\n end",
"def _for(*keywords)\n @watchers.each do |watcher|\n watcher._for(*keywords)\n end\n self\n end",
"def run_all\n targets = Watcher.match_files(self, Dir.glob(\"**/*.*\"))\n run_on_changes targets\n end",
"def initialize(mailboxes)\n self.watchers = []\n\n mailboxes.each {|box| self.watchers << MailboxWatcher.new(box)}\n end",
"def file_watcher=(_arg0); end",
"def file_watcher=(_arg0); end",
"def listen(monitored_paths)\n raise AbstractMethod\n end",
"def run\n watchers.each(&:run)\n \n self.running = true\n \n sleep_while_running\n ensure\n quit\n end",
"def initialize(*args, &block)\n @options = _init_options(args.last.is_a?(Hash) ? args.pop : {})\n @directories = args.flatten.map { |path| Pathname.new(path).realpath }\n @changes = []\n @block = block\n _init_debug\n end",
"def watch_src\n Dispatch::Queue.concurrent.async do\n raise \"$project_src_dir undefined.\" if ! $project_src_dirs\n\n dirs = $project_src_dirs.map { |dir| dir.stringByExpandingTildeInPath }\n options = FSEvent::CLI.parse(dirs.dup << '--file-events')\n format = options[:format]\n\n notifier = FSEvent::Notifier.new\n options[:urls].each do |url|\n puts \"watching #{url.path} with options #{options}\"\n notifier.watch(url.path, *options[:create_flags], options) do |event_list|\n event_list.events.each do |event|\n puts \"reload #{event.path}\"\n self.load_src File.basename(event.path.to_s)\n\n if block_given?\n puts \"yield to block\"\n yield\n end\n end\n end\n end\n notifier.run\n end\n end",
"def initialize\n @logger = Logging::Logger[self]\n\n @builder = Builder.new\n ::Webby.load_files\n\n @watcher = DirectoryWatcher.new '.', :interval => 2\n @watcher.add_observer self\n\n glob = []\n glob << File.join(::Webby.site.layout_dir, '**', '*')\n glob << File.join(::Webby.site.content_dir, '**', '*')\n @watcher.glob = glob\n\n @web_server = ::Webby.site.use_web_server ? WebServer.new : nil\n\n @launchy = ::Webby.site.autobuild_launch_url\n unless @launchy\n @launchy = \"http://localhost:#{::Webby.site.web_port}\" if @web_server\n end\n end",
"def watch(*globs)\n @watchlist.accept(globs) unless globs.empty?\n @watchlist\n end",
"def run(&block)\n watch_recursive @project_dir\n\n while true\n if IO.select([@notifier.to_io], [], [], @frequency)\n @notifier.process\n elsif @events.size > 0\n if block_given?\n yield @events\n else\n check @events\n end\n @events = []\n end\n end\n end",
"def watch(&block)\n\n # Startup File Watcher\n script_changed = lambda { |modified, added, removed|\n\n @log.debug \"File(s) changed! - #{modified.join(\", \")}\" unless (modified.nil? || modified.empty?)\n @log.debug \"File(s) added! - #{added.join(\", \")}\" unless (added.nil? || added.empty?)\n @log.debug \"File(s) removed! - #{removed.join(\", \")}\" unless (removed.nil? || removed.empty?)\n\n block.call(modified, added, removed)\n }\n\n pig_listener = Listen.to(@project_root_path,\n :ignore => /(^\\..*$|logs.*)/)\n\n pig_listener.change(&script_changed)\n pig_listener.start\n\n\tend",
"def initialize(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n directories = args.flatten\n initialize_directories_and_directories_records(directories)\n initialize_relative_paths_usage(options)\n @block = block\n\n ignore(*options.delete(:ignore))\n filter(*options.delete(:filter))\n\n @adapter_options = options\n end",
"def create_watching\n @watching = Watching.add_watcher(owner, event.lesson)\n end",
"def initialize(*args)\n @queue = []\n @workdir = Pathname.new(Pathname.pwd)\n @env = {}\n super\n end",
"def run\n ## self.download_events\n files = prepare_files\n events = parse_events(files)\n save_events(events)\n end",
"def initialize(worker)\n @worker = worker\n end",
"def start\n puts \"** quick_serve: scanning for files... \"\n # build a file collection\n find_files\n puts \"** quick_serve: watching #{files.size} files for changes... \"\n wait \n end",
"def listen_for_changes\n Listen.to(input_dir.to_s) do\n sync\n end.start\n end",
"def initialize(*args)\n @folder = args.first[:folder] \n folder_handler(@folder) # create folder if necessary\n @logger = {}\n end",
"def initialize(app)\n @app = app\n @files = {}\n @watcher = Watcher.new\n options_reload\n end",
"def add_watcher\n email = args.shift\n create_watcher(email)\n puts \"Added #{email} as a watcher\"\n end",
"def initialize(*dirs)\n @dirs = dirs.flatten.map{|dir| dir.to_s}\n @known_files = []\n @last_mtime = {}\n end",
"def initialize(options = {})\n # fix options by DEFAULTS\n DEFAULTS.each { |k, v| options[k] = v unless options.key? k }\n @registry_path = options[:registry_path]\n if @registry_path.nil?\n @registry_path = \"#{options[:work_dir]}/registry\"\n end\n @history_path = options[:history_path]\n if @history_path.nil?\n @history_path = \"#{options[:work_dir]}/history\"\n end\n @max_eof_files = options[:max_eof_files]\n @paths = options[:paths]\n @eof_seconds = options[:eof_seconds]\n @batch_lines = options[:batch_lines]\n @host = options[:host]\n if @host.nil?\n require 'socket'\n @host = Socket.gethostname\n end\n @files = []\n @active_files = []\n @history = []\n if File.exist? @history_path\n @history = File.open(@history_path) { |io| JSON.parse(io.read) }\n else\n parent_dir = File.dirname @history_path\n Dir.mkdirs parent_dir unless Dir.exist? parent_dir\n end\n if File.exist? @registry_path\n @files = File.open(@registry_path) { |io| JSON.parse(io.read, {symbolize_names: true}) }\n @active_files = @files.select { |record| !record[:eof] }\n else\n parent_dir = File.dirname @registry_path\n Dir.mkdirs parent_dir unless Dir.exist? parent_dir\n end\n end",
"def watchers\n if args.empty?\n watchers_list\n return\n end\n\n case args.shift\n when \"add\"\n email = args.shift\n create_watcher(email)\n puts \"Added #{email} as a watcher\"\n return\n when \"remove\"\n email = args.shift\n delete_watcher(email)\n return\n when \"clear\"\n clear_all_watchers\n puts \"All watchers removed\"\n return\n end\n raise(CommandFailed, \"see: heroku help ranger\")\n end",
"def start_listening\n @continue_listening = true\n while @continue_listening\n listen_for_changes\n end\n end",
"def also_reload(*glob)\n Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) }\n end"
] | [
"0.8124498",
"0.78232884",
"0.7797833",
"0.7709866",
"0.73683584",
"0.73361504",
"0.7202465",
"0.7145659",
"0.6529733",
"0.65076244",
"0.6358155",
"0.61851114",
"0.6147244",
"0.61304307",
"0.6000078",
"0.5930538",
"0.58909774",
"0.58385676",
"0.58384943",
"0.5820677",
"0.58144677",
"0.578114",
"0.5743773",
"0.57425994",
"0.57367337",
"0.57360315",
"0.5697295",
"0.56886196",
"0.5685115",
"0.56782794",
"0.5629088",
"0.56275034",
"0.5611863",
"0.5582932",
"0.55547017",
"0.55428076",
"0.5522031",
"0.5514919",
"0.551005",
"0.549811",
"0.54892594",
"0.54856235",
"0.54696995",
"0.54611486",
"0.5440605",
"0.54149646",
"0.5384264",
"0.53815264",
"0.538016",
"0.5369532",
"0.53361845",
"0.53361845",
"0.5311031",
"0.53067523",
"0.52920496",
"0.52786404",
"0.52671033",
"0.5266335",
"0.5258062",
"0.5249092",
"0.5242095",
"0.5233198",
"0.5227914",
"0.5210164",
"0.5200836",
"0.51944524",
"0.51867825",
"0.51788896",
"0.51727855",
"0.5169906",
"0.5166544",
"0.51484185",
"0.5143366",
"0.5140275",
"0.5138233",
"0.5136203",
"0.5136203",
"0.5126146",
"0.51122016",
"0.51118416",
"0.51009846",
"0.5093684",
"0.509322",
"0.50678474",
"0.5057317",
"0.5051498",
"0.50482154",
"0.5026013",
"0.5015064",
"0.5014496",
"0.4990161",
"0.49850863",
"0.4983219",
"0.49813932",
"0.49746194",
"0.49737084",
"0.49670577",
"0.49462444",
"0.49357954",
"0.49293393"
] | 0.7931124 | 1 |
GET /providers GET /providers.json | def index
@providers = current_company.providers.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @providers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def providers\n url = url_with_api_version(@base_url, 'providers')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def providers_get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProvidersApi.providers_get_providers ...\"\n end\n # resource path\n local_var_path = \"/api/Providers\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].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', 'text/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 => 'ProviderListItemPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProvidersApi#providers_get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def providers_get(opts = {})\n data, _status_code, _headers = providers_get_with_http_info(opts)\n data\n end",
"def get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PricesApi.get_providers ...'\n end\n # resource path\n local_var_path = '/v1/providers'\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 = ['oauth2']\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 => 'Providers')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PricesApi#get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def get_providers(opts = {})\n data, _status_code, _headers = get_providers_with_http_info(opts)\n data\n end",
"def show\n @title = t('view.providers.show_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_get ...'\n end\n # resource path\n local_var_path = '/providers'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20020')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @providers = Provider.all\n end",
"def index\n @title = t('view.providers.index_title')\n @searchable = true\n @providers = Provider.filtered_list(params[:q]).order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def index\n @providers = Provider.all\n \n respond_to do |format|\n format.json {render json: @providers}\n format.xml {render xml: @providers}\n end\n end",
"def index\n @providerservices = Providerservice.all\n end",
"def providers\n @providers.keys\n end",
"def show\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to provider_readme_url(@provider) } \n format.json { render json: @provider }\n end\n end",
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def data_providers_get(opts = {})\n data, _status_code, _headers = data_providers_get_with_http_info(opts)\n data\n end",
"def index\n @email_service_providers = EmailServiceProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_service_providers }\n end\n end",
"def index\n @data_providers = DataProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_providers }\n end\n end",
"def providers\n @providers ||= {}\n end",
"def index\n @service_providers = ServiceProvider.all\n end",
"def providers\n @providers_manager\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def authentication_providers authenticator, account: Conjur.configuration.account\n JSON.parse(url_for(:authentication_providers, account, authenticator, credentials).get)\n end",
"def providers\n @providers ||= load_hash 'config/providers.yml'\n end",
"def provider\n get(PROVIDER)\n end",
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def data_providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataProvidersApi.data_providers_get ...'\n end\n # resource path\n local_var_path = '/data_providers'\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\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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<DataProvider>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataProvidersApi#data_providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"service_providers\", json_api_params, @service_providers).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"service_providers\", @service_providers).to_json }\n end\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def index\n @supplier_providers = Supplier::Provider.all\n end",
"def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def show\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @email_service_provider = EmailServiceProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_service_provider }\n end\n end",
"def populate_providers_hash\n # GET A LIST OF ALL PROVIDERS\n Rails.logger.info(\"Retrieving providers list from #{@ingest_providers_list_endpoint}\")\n response = RestClient::Request.execute :method => :get, :url => \"#{@ingest_providers_list_endpoint}\", :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n if (response.code != 200)\n Rails.logger.info(\"ERROR #{response.code} retrieving providers list\")\n # terminate task if we cannot validate the providers names\n exit(status=256)\n else\n list_of_providers_hashes = JSON.parse!(response.body)\n list_of_providers_hashes.each do |hash|\n provider_id = hash['provider-id']\n @all_providers[provider_id] = 'Y'\n end\n Rails.logger.info(\"RETRIEVED A LIST OF ALL PROVIDERS, SIZE: #{list_of_providers_hashes.size}, LOOKUP SIZE: #{@all_providers.size}\")\n end\n end",
"def index\n @q = Teleprovider.search(params[:q])\n @teleproviders = @q.result(distinct: true).page(params[:page])\n\n respond_with(@teleproviders)\n end",
"def get_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end",
"def show\n @payment_provider = PaymentProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end",
"def providers_get_providers(opts = {})\n data, _status_code, _headers = providers_get_providers_with_http_info(opts)\n return data\n end",
"def available_service_providers\n @providers = ServiceProvider.order(rating: :desc).order(rating_count: :desc)\n end",
"def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end",
"def formats\n providers.keys\n end",
"def search(connector, options={})\n if options.respond_to? :to_str\n return search(connector, :q=>options.to_str)\n end\n json = connector.prepare_and_invoke_api_call(\n 'profiles/v1/search/providers', :method=>:get,\n :auth=>false, :sign=>false, :params=>options)\n\n providers = []\n if json['providers']['provider']\n [json['providers']['provider']].flatten.each do |provider|\n providers << self.new(provider)\n end\n end\n return providers\n end",
"def index\n @providers = Provider.all\n @response = { :item => @providers }\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @providers }\n format.js { render :json => @response.to_json(), :callback => params[:callback]}\n end\n end",
"def providers\n authentication_strategies.pluck :provider\n end",
"def get_provider_collections(params = {})\n collection_params = {\n 'provider' => current_user.provider_id,\n 'page_size' => 25\n }.stringify_keys.merge(params.stringify_keys)\n\n Rails.logger.debug \"Provider Collection Request parameters: #{collection_params}\" unless request.xhr?\n\n if collection_params.key?('short_name')\n collection_params['short_name'].concat('*')\n\n # In order to search with the wildcard parameter we need to tell CMR to use it\n collection_params['options'] = {\n 'short_name' => {\n 'pattern' => true\n }\n }\n end\n\n # Adds wildcard searching\n collection_params['keyword'].concat('*') if collection_params.key?('keyword')\n\n # Retreive the collections from CMR, allowing a few additional parameters\n cmr_client.get_collections_by_post(collection_params, token).body\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def index\n presenters = ProviderOAuthFlowPresenter.wrap(self_authentication_providers, request, request.host)\n respond_with(presenters)\n end",
"def index\n @providers = User.where(provider: true).where.not(slug: [nil,''], provider_name: [nil,'']).page(params[:page]).per( 12 ).order(:provider_name)\n end",
"def providers\n providers = YARD::Registry.all(\"puppet_providers_#{name}\".to_sym)\n return providers if providers.empty?\n\n providers.first.children\n end",
"def index\n @providers = Provider.order('lName').all\n end",
"def providers(parameters = {}, invocation_options = {})\n exec(RubyTerraform::Commands::Providers,\n parameters, invocation_options)\n end",
"def index\n @v1_provider_operations = V1::ProviderOperation.all\n end",
"def index\n respond_to do |format|\n if params[:search]\n format.html { @provider_provider_types = Provider::ProviderType.search(params[:search]).order(\"created_at DESC\")}\n format.json { @provider_provider_types = Provider::ProviderType.search(params[:search]).order(\"created_at DESC\")}\n else\n format.html { @provider_provider_types = Provider::ProviderType.all.order('created_at DESC')}\n format.json { @provider_provider_types = Provider::ProviderType.all.order('created_at DESC')}\n end\n end\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def index\n @q = Provider.ransack(params[:q])\n @providers = @q.result.uniq\n @providers = @providers.paginate(:page => params[:page], :per_page => 10)\n end",
"def providers\n @title = 'Puppet Provider Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_provider)\n erb(:objects)\nend",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def index\n @healthcare_providers = HealthcareProvider.all\n end",
"def provider\n providers.first\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def base_uri\n \"#{api}/provider\"\n end",
"def index\n @provider_contacts = ProviderContact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_contacts }\n format.json {\n if params[:provider_id] != nil\n #The first int in the array for the provider id is the id of the selected provider and the second is the id for the unspecified provider so unspecified shous up in the list\n @provider_contacts = ProviderContact.select(\"id, name\").where(:provider_id => [params[:provider_id], Provider.find_by_name('unspecified').id])\n end\n render :json => @provider_contacts \n }\n end\n end",
"def show\n respond_to do |format|\n format.json {render json: @provider}\n format.xml {render xml: @provider}\n end\n end",
"def [](name)\n @providers[name]\n end",
"def index\n per_page = params[:per_page] || 100\n changed_since = params[:changed_since]\n ActiveRecord::Base.transaction do\n ActiveRecord::Base.connection.execute('LOCK provider, provider_enrichment, site IN SHARE UPDATE EXCLUSIVE MODE')\n @providers = Provider\n .opted_in\n .changed_since(changed_since)\n .limit(per_page)\n end\n\n last_provider = @providers.last\n\n # When we extract the changed_at from the last provider, format it with\n # sub-second timing information (micro-seconds) so that our incremental\n # fetch can handle many records being updated within the same second.\n #\n # The strftime format '%FT%T.%6NZ' is similar to the ISO8601 standard,\n # (equivalent to %FT%TZ) and adds micro-seconds (%6N).\n response.headers['Link'] = if last_provider\n next_link(last_provider.changed_at\n .utc\n .strftime('%FT%T.%6NZ'),\n per_page)\n else\n next_link(changed_since, per_page)\n end\n render json: @providers\n rescue ActiveRecord::StatementInvalid\n render json: { status: 400, message: 'Invalid changed_since value, the format should be an ISO8601 UTC timestamp, for example: `2019-01-01T12:01:00Z`' }.to_json, status: 400\n end",
"def to_json\n return {\n name: name,\n provider: provider\n }.to_json\n end",
"def authenticate_provider \n label = request_label(:authenticate_provider)\n \n @http_request_bundler.add(\n label, \n @url + \"/authenticate_provider\", \n :get,\n head: headers,\n query: { provider_id: provider_id }\n ).status!(label)\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def providers\n driver(current_driver).providers\n end",
"def index\n return provider_locator if params[:type] == 'cc_provider'\n\n facilities\n end",
"def index\n @payment_providers = PaymentProvider.all\n end",
"def index\n @content_providers = ContentProvider.find(:all, :order => \"name\")\n respond_to do |format|\n format.html # list.html.erb\n format.xml { render :layout => 'none' }\n format.json { render :json=> @content_providers }\n end\n end",
"def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def index\n @q = Provider.ransack(params[:q])\n\n @providers = @q.result.includes(:state, :city).accessible_by(current_ability).order(id: :desc).page params[:page]\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def index\n @provider_projects = ProviderProject.all\n end",
"def suitable_providers\n return @suitable_providers if @suitable_providers\n @suitable_providers = []\n [\n @resource.class.defaultprovider,\n @resource.class.suitableprovider,\n ].flatten.uniq.each do |provider_class|\n if service_provider_enabled? provider_class\n @suitable_providers << provider_class.name\n end\n end\n @suitable_providers\n end",
"def show_provider\n provider_app_detail_ids = ProviderAppDetail.where(fk_audit_trail_id: params[:id])\n @providers = Provider.where(\"fk_provider_app_detail_id in (?)\", provider_app_detail_ids)\n @audit_trail = AuditTrail.find(params[:id])\n end",
"def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end",
"def show\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @title = @name.titleize + \" Provider Insurance\"\n @show = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def index\n @provider_types = ProviderType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_types }\n end\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n prov_name = provider_name\n rv = browser.providers[prov_name.to_sym] if prov_name.present?\n rv ||= browser.first_provider\n # browser.providers[provider_name.to_sym] || browser.first_provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def lcr_providers\n\n @page_title = _('Providers_for_LCR') # + \": \" + @lcr.name\n @page_icon = \"provider.png\"\n\n @providers = @lcr.sms_providers(\"asc\")\n @all_providers = SmsProvider.find(:all)\n @other_providers = []\n for prov in @all_providers\n @other_providers << prov if !@providers.include?(prov)\n end\n flash[:notice] = _('No_providers_available') if @all_providers.empty?\n end",
"def provider_items\n @provider_items ||= ProviderItem.find(provider_items_ids)\n end",
"def provider\n @provider\n end",
"def load_used_providers\n Vmpooler::Providers.load_by_name(used_providers)\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend"
] | [
"0.7952771",
"0.76017314",
"0.72677416",
"0.7190118",
"0.706321",
"0.70238805",
"0.6972535",
"0.6780555",
"0.6780555",
"0.6702626",
"0.6662831",
"0.6654126",
"0.66216713",
"0.65760744",
"0.6559313",
"0.65415585",
"0.6507612",
"0.6411908",
"0.6400059",
"0.6364796",
"0.63533163",
"0.6311789",
"0.62972826",
"0.6263042",
"0.6177678",
"0.6166839",
"0.61501473",
"0.61501473",
"0.6100386",
"0.6041531",
"0.6014968",
"0.60108846",
"0.59820485",
"0.5975815",
"0.5959551",
"0.59592485",
"0.5958592",
"0.59478223",
"0.5946009",
"0.5944706",
"0.5942071",
"0.5912871",
"0.59028506",
"0.5882216",
"0.58472395",
"0.5834309",
"0.58048534",
"0.58039105",
"0.5791729",
"0.5778884",
"0.573383",
"0.5708849",
"0.56982833",
"0.5682607",
"0.5680191",
"0.5647166",
"0.56408167",
"0.5639055",
"0.5638941",
"0.5630059",
"0.56259966",
"0.5592616",
"0.55872345",
"0.55769026",
"0.55756825",
"0.5562289",
"0.55574405",
"0.55478567",
"0.55282044",
"0.5526319",
"0.5519658",
"0.550538",
"0.5501342",
"0.54872394",
"0.5482641",
"0.5479486",
"0.547724",
"0.54743505",
"0.54636717",
"0.54566866",
"0.5452219",
"0.54502636",
"0.54297835",
"0.5423487",
"0.541555",
"0.54136974",
"0.54115313",
"0.5410549",
"0.5396575",
"0.53951037",
"0.5387073",
"0.53791714",
"0.5361006",
"0.5354572",
"0.53531545",
"0.5347953",
"0.53460693",
"0.53452075",
"0.53201216",
"0.53201216"
] | 0.72843695 | 2 |
GET /providers/1 GET /providers/1.json | def show
@provider = current_company.providers.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @provider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @title = t('view.providers.show_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def providers\n url = url_with_api_version(@base_url, 'providers')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def providers_get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProvidersApi.providers_get_providers ...\"\n end\n # resource path\n local_var_path = \"/api/Providers\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].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', 'text/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 => 'ProviderListItemPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProvidersApi#providers_get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PricesApi.get_providers ...'\n end\n # resource path\n local_var_path = '/v1/providers'\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 = ['oauth2']\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 => 'Providers')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PricesApi#get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to provider_readme_url(@provider) } \n format.json { render json: @provider }\n end\n end",
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def index\n @providers = Provider.all\n end",
"def providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_get ...'\n end\n # resource path\n local_var_path = '/providers'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20020')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def index\n @providerservices = Providerservice.all\n end",
"def providers_get(opts = {})\n data, _status_code, _headers = providers_get_with_http_info(opts)\n data\n end",
"def index\n @providers = Provider.all\n \n respond_to do |format|\n format.json {render json: @providers}\n format.xml {render xml: @providers}\n end\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def index\n @title = t('view.providers.index_title')\n @searchable = true\n @providers = Provider.filtered_list(params[:q]).order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @payment_provider = PaymentProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end",
"def show\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def provider\n providers.first\n end",
"def index\n @data_providers = DataProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_providers }\n end\n end",
"def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def provider\n get(PROVIDER)\n end",
"def index\n @service_providers = ServiceProvider.all\n end",
"def show\n @email_service_provider = EmailServiceProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_service_provider }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"service_providers\", json_api_params, @service_providers).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"service_providers\", @service_providers).to_json }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end",
"def index\n @email_service_providers = EmailServiceProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_service_providers }\n end\n end",
"def index\n @v1_provider_operations = V1::ProviderOperation.all\n end",
"def provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n prov_name = provider_name\n rv = browser.providers[prov_name.to_sym] if prov_name.present?\n rv ||= browser.first_provider\n # browser.providers[provider_name.to_sym] || browser.first_provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def providers\n @providers.keys\n end",
"def show\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @title = @name.titleize + \" Provider Insurance\"\n @show = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def data_providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataProvidersApi.data_providers_get ...'\n end\n # resource path\n local_var_path = '/data_providers'\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\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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<DataProvider>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataProvidersApi#data_providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_providers(opts = {})\n data, _status_code, _headers = get_providers_with_http_info(opts)\n data\n end",
"def base_uri\n \"#{api}/provider\"\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def [](name)\n @providers[name]\n end",
"def index\n @supplier_providers = Supplier::Provider.all\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def data_providers_get(opts = {})\n data, _status_code, _headers = data_providers_get_with_http_info(opts)\n data\n end",
"def index\n @provider_contacts = ProviderContact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_contacts }\n format.json {\n if params[:provider_id] != nil\n #The first int in the array for the provider id is the id of the selected provider and the second is the id for the unspecified provider so unspecified shous up in the list\n @provider_contacts = ProviderContact.select(\"id, name\").where(:provider_id => [params[:provider_id], Provider.find_by_name('unspecified').id])\n end\n render :json => @provider_contacts \n }\n end\n end",
"def providers\n @providers ||= {}\n end",
"def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def show\n respond_to do |format|\n format.json {render json: @provider}\n format.xml {render xml: @provider}\n end\n end",
"def index\n redirect_to :controller => 'providers', :action => 'show', :id => params[:provider_id]\n end",
"def providers\n @providers_manager\n end",
"def index\n @providers = Provider.all\n @response = { :item => @providers }\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @providers }\n format.js { render :json => @response.to_json(), :callback => params[:callback]}\n end\n end",
"def index\n return provider_locator if params[:type] == 'cc_provider'\n\n facilities\n end",
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def index\n per_page = params[:per_page] || 100\n changed_since = params[:changed_since]\n ActiveRecord::Base.transaction do\n ActiveRecord::Base.connection.execute('LOCK provider, provider_enrichment, site IN SHARE UPDATE EXCLUSIVE MODE')\n @providers = Provider\n .opted_in\n .changed_since(changed_since)\n .limit(per_page)\n end\n\n last_provider = @providers.last\n\n # When we extract the changed_at from the last provider, format it with\n # sub-second timing information (micro-seconds) so that our incremental\n # fetch can handle many records being updated within the same second.\n #\n # The strftime format '%FT%T.%6NZ' is similar to the ISO8601 standard,\n # (equivalent to %FT%TZ) and adds micro-seconds (%6N).\n response.headers['Link'] = if last_provider\n next_link(last_provider.changed_at\n .utc\n .strftime('%FT%T.%6NZ'),\n per_page)\n else\n next_link(changed_since, per_page)\n end\n render json: @providers\n rescue ActiveRecord::StatementInvalid\n render json: { status: 400, message: 'Invalid changed_since value, the format should be an ISO8601 UTC timestamp, for example: `2019-01-01T12:01:00Z`' }.to_json, status: 400\n end",
"def index\n presenters = ProviderOAuthFlowPresenter.wrap(self_authentication_providers, request, request.host)\n respond_with(presenters)\n end",
"def populate_providers_hash\n # GET A LIST OF ALL PROVIDERS\n Rails.logger.info(\"Retrieving providers list from #{@ingest_providers_list_endpoint}\")\n response = RestClient::Request.execute :method => :get, :url => \"#{@ingest_providers_list_endpoint}\", :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n if (response.code != 200)\n Rails.logger.info(\"ERROR #{response.code} retrieving providers list\")\n # terminate task if we cannot validate the providers names\n exit(status=256)\n else\n list_of_providers_hashes = JSON.parse!(response.body)\n list_of_providers_hashes.each do |hash|\n provider_id = hash['provider-id']\n @all_providers[provider_id] = 'Y'\n end\n Rails.logger.info(\"RETRIEVED A LIST OF ALL PROVIDERS, SIZE: #{list_of_providers_hashes.size}, LOOKUP SIZE: #{@all_providers.size}\")\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end",
"def show\n @provider_type = ProviderType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider_type }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @q = Teleprovider.search(params[:q])\n @teleproviders = @q.result(distinct: true).page(params[:page])\n\n respond_with(@teleproviders)\n end",
"def show_provider\n provider_app_detail_ids = ProviderAppDetail.where(fk_audit_trail_id: params[:id])\n @providers = Provider.where(\"fk_provider_app_detail_id in (?)\", provider_app_detail_ids)\n @audit_trail = AuditTrail.find(params[:id])\n end",
"def formats\n providers.keys\n end",
"def show\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oauth_remote_service_provider }\n end\n end",
"def authenticate_provider \n label = request_label(:authenticate_provider)\n \n @http_request_bundler.add(\n label, \n @url + \"/authenticate_provider\", \n :get,\n head: headers,\n query: { provider_id: provider_id }\n ).status!(label)\n end",
"def new\n @provider_stat = ProviderStat.new\n @provider = Provider.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_stat }\n end\n end",
"def index\n @healthcare_providers = HealthcareProvider.all\n end",
"def index\n respond_to do |format|\n if params[:search]\n format.html { @provider_provider_types = Provider::ProviderType.search(params[:search]).order(\"created_at DESC\")}\n format.json { @provider_provider_types = Provider::ProviderType.search(params[:search]).order(\"created_at DESC\")}\n else\n format.html { @provider_provider_types = Provider::ProviderType.all.order('created_at DESC')}\n format.json { @provider_provider_types = Provider::ProviderType.all.order('created_at DESC')}\n end\n end\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def index\n @payment_providers = PaymentProvider.all\n end",
"def index\n @provider_projects = ProviderProject.all\n end",
"def index\n @providers = Provider.order('lName').all\n end",
"def index\n @providers = User.where(provider: true).where.not(slug: [nil,''], provider_name: [nil,'']).page(params[:page]).per( 12 ).order(:provider_name)\n end",
"def show\n @user = User.find(params[:id])\n\n begin\n @user.sync_all_provider_data\n flash[:notice] = \"API sources refreshed.\"\n rescue Exceptions::ApiError\n flash[:alert] = \"API error - please connected and reconnect.\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user }\n end\n end",
"def readme\n @provider = Provider.find(params[:provider_id])\n @readme=@provider.readme\n respond_to do |format|\n format.html\n format.json { render json: @readme }\n end\n end",
"def provider\n @provider\n end",
"def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end",
"def show\n @issuer = Issuer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issuer }\n end\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def show\n @provider_stat = ProviderStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider_stat }\n end\n end",
"def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_name\n @json['profile']['providerName'] rescue nil\n end",
"def show\n @appdotnet_social = AppdotnetSocial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appdotnet_social }\n end\n end",
"def authentication_providers authenticator, account: Conjur.configuration.account\n JSON.parse(url_for(:authentication_providers, account, authenticator, credentials).get)\n end",
"def provider\n\tend",
"def index\n @q = Provider.ransack(params[:q])\n @providers = @q.result.uniq\n @providers = @providers.paginate(:page => params[:page], :per_page => 10)\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def providers\n @title = 'Puppet Provider Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_provider)\n erb(:objects)\nend"
] | [
"0.7272243",
"0.71885544",
"0.7069674",
"0.7069674",
"0.7021322",
"0.7003939",
"0.6984918",
"0.69745284",
"0.6815935",
"0.68077725",
"0.6729551",
"0.663642",
"0.6533136",
"0.6529574",
"0.649691",
"0.649691",
"0.6464657",
"0.6430917",
"0.6402912",
"0.63958097",
"0.634581",
"0.6293196",
"0.62882555",
"0.6265689",
"0.62544274",
"0.623323",
"0.6232307",
"0.6198807",
"0.613392",
"0.61188936",
"0.610699",
"0.6104571",
"0.6078437",
"0.6029581",
"0.60130453",
"0.5948864",
"0.5889333",
"0.5885188",
"0.5877704",
"0.5874644",
"0.58660704",
"0.58612925",
"0.5828266",
"0.5783966",
"0.57802635",
"0.5766679",
"0.57603467",
"0.5755251",
"0.57456845",
"0.57296306",
"0.57232296",
"0.56956184",
"0.56887954",
"0.56883967",
"0.56876194",
"0.5662724",
"0.5662066",
"0.56560385",
"0.5650195",
"0.56369597",
"0.56254214",
"0.5624934",
"0.56145185",
"0.5611473",
"0.558488",
"0.5580298",
"0.5569447",
"0.55648655",
"0.556311",
"0.555085",
"0.5541119",
"0.553947",
"0.55265355",
"0.55209404",
"0.5520458",
"0.55132824",
"0.5507524",
"0.54997325",
"0.5497158",
"0.5495406",
"0.5494159",
"0.5489611",
"0.54760706",
"0.54715425",
"0.54680943",
"0.5467567",
"0.54585266",
"0.54577297",
"0.5454368",
"0.54444367",
"0.5438096",
"0.5434639",
"0.5430225",
"0.5428362",
"0.5426329",
"0.54155093",
"0.5415019",
"0.54061615",
"0.54061437",
"0.5396996"
] | 0.72955817 | 0 |
GET /providers/new GET /providers/new.json | def new
@provider = current_company.providers.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @provider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def new\r\n @provider = Provider.new\r\n render_new\r\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def new\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.new\n @title = @name.titleize + \" New Provider Insurance\"\n @all_insurance_company = InsuranceCompany.find(:all, :order => :name)\n @edit = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def new\n @provider_type = ProviderType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_type }\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n end",
"def new\n @provider_stat = ProviderStat.new\n @provider = Provider.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_stat }\n end\n end",
"def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end",
"def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @person = Person.new\n set_person_attribute_defaults(@person)\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n if @provider\n @person.person_provider_links.build(:psu_code => @psu_code,\n :provider => @provider,\n :person => @person,\n :is_active_code => 1)\n @person.sampled_persons_ineligibilities.build(:psu_code => @psu_code,\n :person => @person,\n :provider => @provider)\n end\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @person }\n end\n end",
"def new\n @email_service_provider = EmailServiceProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_service_provider }\n end\n end",
"def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def test_new\n %w(email address twitter facebook google linkedin xing).each do |provider|\n get :new, :provider => provider\n assert_response :success\n assert_template 'new'\n assert assigns(:identity).new_record?\n assert assigns(:identity).kind_of?(Identity.provider(provider.to_sym))\n end\n end",
"def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end",
"def new\n @project = Project.new\n\t@project.email = current_user.provider_email\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end",
"def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end",
"def new\n @provider_group = ProviderGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_group }\n end\n end",
"def new\n self.default_provider.new\n end",
"def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_admin\n @provider = Provider.new\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @store_policies_information = Store::Policies::Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_policies_information }\n end\n end",
"def new\n @issuer = Issuer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issuer }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @partner_type = PartnerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner_type }\n end\n end",
"def new\n @platform = Platform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @platform }\n end\n end",
"def new\n @pst = Pst.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pst }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end",
"def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end",
"def new\n @supplier = Supplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier }\n end\n end",
"def new\n @resource_info = ResourceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_info }\n end\n end",
"def new\n @grant = Grant.new\n\n respond_to do |format|\n format.html { render :layout => false } # new.html.erb\n format.json { render json: @grant }\n end\n end",
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end",
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n @snp = Snp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snp }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @provider_role = ProviderRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_role }\n end\n end",
"def new\n @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @social_network = SocialNetwork.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @social_network }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end",
"def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n @credito = Credito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credito }\n end\n end",
"def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\n end\n end",
"def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end",
"def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end",
"def new\n @vendor = Vendor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end",
"def new\n @pinit = Pinit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinit }\n end\n end",
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @pubtype = Pubtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pubtype }\n end\n end",
"def new\n @pinn = current_user.pinns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinn }\n end\n end",
"def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end",
"def new\n @community = Community.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @community }\n end\n end",
"def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @region = Region.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @region }\n end\n end"
] | [
"0.8272507",
"0.80500466",
"0.80500466",
"0.7682416",
"0.7482539",
"0.74049795",
"0.7310524",
"0.7274704",
"0.7225364",
"0.7138865",
"0.71240705",
"0.70831877",
"0.70654607",
"0.7050149",
"0.6999865",
"0.6998997",
"0.694804",
"0.6858532",
"0.6855384",
"0.68447495",
"0.6811392",
"0.67706895",
"0.67666066",
"0.66652286",
"0.6648898",
"0.66357744",
"0.6614552",
"0.6603",
"0.6582117",
"0.65780246",
"0.6572228",
"0.6566487",
"0.65616363",
"0.654925",
"0.65491396",
"0.65479344",
"0.653628",
"0.65129757",
"0.6506381",
"0.65025365",
"0.649926",
"0.6484949",
"0.6480889",
"0.6476021",
"0.64664835",
"0.6465264",
"0.6465264",
"0.6465264",
"0.64621747",
"0.64614826",
"0.6455155",
"0.64542043",
"0.6451789",
"0.644272",
"0.6439995",
"0.6439711",
"0.6435064",
"0.6434992",
"0.643483",
"0.64328283",
"0.64143485",
"0.6409604",
"0.64049715",
"0.639899",
"0.6398914",
"0.639583",
"0.6391778",
"0.63873374",
"0.63810444",
"0.63800675",
"0.6375848",
"0.63725764",
"0.63670105",
"0.6365453",
"0.6363047",
"0.6362433",
"0.63539535",
"0.6353743",
"0.6347569",
"0.63449764",
"0.6344853",
"0.6343342",
"0.6327545",
"0.632733",
"0.6325825",
"0.63239396",
"0.6317081",
"0.6311194",
"0.6308245",
"0.6305953",
"0.63059276",
"0.63059276",
"0.6303468",
"0.63018835",
"0.63004726",
"0.6299064",
"0.6299064",
"0.6299064",
"0.6299064",
"0.62887716"
] | 0.8236406 | 1 |
POST /providers POST /providers.json | def create
@provider = current_company.providers.new(params[:provider])
respond_to do |format|
if @provider.save
format.html { redirect_to @provider, notice: 'Provider was successfully created.' }
format.json { render json: @provider, status: :created, location: @provider }
else
format.html { render action: "new" }
format.json { render json: @provider.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @data_provider = DataProvider.new(params[:data_provider])\n\n respond_to do |format|\n if @data_provider.save\n format.html { redirect_to root_path, notice: 'Data provider was successfully created.' }\n format.json { render json: @data_provider, status: :created, location: @data_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :POST\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def register_new(provider_data)\n location = Location.find_or_create_by(zip_code: provider_data[:zip_code])\n competencies = provider_data[:competencies].select{|k, v| v == 1}.keys\n provider = location.providers.new(provider_data)\n if provider.save\n competencies.each do |competency|\n assessment = Assessment.find_by(word: competency)\n provider.competencies.create(assessment: assessment)\n end\n end\n end",
"def create\n @payment_provider = PaymentProvider.new(params[:payment_provider])\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully created.' }\n format.json { render json: @payment_provider, status: :created, location: @payment_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:provider, :uid, :nickname, :token, :secret)\n end",
"def provider_params\r\n params.require(:provider).permit(:app_id, :name)\r\n end",
"def create\n @providers_payment_type = Providers::PaymentType.new(providers_payment_type_params)\n\n respond_to do |format|\n if @providers_payment_type.save\n\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully created.' }\n format.json { render :show, status: :created, location: @providers_payment_type }\n else\n format.html { render :new }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:name, :active, :api_token, :api_token_required, :default, :shortened_links_count)\n end",
"def provider_params\n params.require(:provider).permit(:name,\n loans_attributes: [:id, :name, :principle, :interest,\n :months_remaining, :payment, :_destroy])\n end",
"def provider_params\n params.require(:provider).permit( :name, :manager, :phone, :komment, :address, \n :email, :url, :spec, :p_status_id, :city_id,\n :providers_group_id, :is_group, :group_id,\n budget_ids: [], style_ids: [], \n goodstype_ids: [], \n special_infos_attributes: [:id, :content, :_destroy])\n # goodstype_attributes: [],\n end",
"def create\n @provider_payment = ProviderPayment.new(provider_payment_params)\n\n respond_to do |format|\n if @provider_payment.save\n @provider_payment.provider.update(status: @provider_payment.provider.set_status)\n\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully created.' }\n format.json { render :show, status: :created, location: @provider_payment }\n else\n format.html { render :new }\n format.json { render json: @provider_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_provider = PaymentProvider.new(payment_provider_params)\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to settings_payments_path, notice: 'Payment provider was successfully created.' }\n format.json { render :show, status: :created, location: @payment_provider }\n else\n format.html { render :new }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n provider = Manage::Provider.find_by(login: manage_provider_params[:login])\n if provider\n flash_msg('danger', \"此账号已经存在\", 'new')\n else\n manage_provider = Manage::Provider.new(manage_provider_params)\n begin\n if manage_provider.save\n flash_msg('success', '添加供应商成功!', 'index')\n end\n rescue Exception => e\n flash_msg('danger', \"添加供应商失败!#{error_msg(manage_provider)}\", 'new')\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n ProviderAdmin.create(:member_id =>params[:member_id], :provider_id => @provider.id, :active=>true)\n format.html { redirect_to(@provider, :notice => 'Provider was successfully created.') }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def provider_provider_type_params\n params.require(:provider_provider_type).permit(:name)\n end",
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def create\n @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def create\n @teleprovider = Teleprovider.new(teleprovider_params)\n\n if @teleprovider.save\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully created.')\n else\n respond_with(@teleprovider)\n end\n end",
"def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def create\n @register_financeiro_provider = Register::Financeiro::Provider.new(register_financeiro_provider_params)\n\n respond_to do |format|\n if @register_financeiro_provider.save\n format.html { redirect_to @register_financeiro_provider, notice: 'Fornecedor Cadastrado com Sucesso!' }\n format.json { render :show, status: :created, location: @register_financeiro_provider }\n else\n format.html { render :new }\n format.json { render json: @register_financeiro_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def resource_params\n params.require(:provider).permit(:proveedor, :cgdvcode, :name)\n end",
"def provider_params\n params.require(:provider).permit(:fName, :middle, :lName, :addr1, :addr2, :city, :state, :zip, :phone, :email, :licenseCap, :sqOneCap, :licenseExpDate, :certLevel, :sqOneRepl)\n end",
"def provider_params\n params.require(:provider).permit(:name, :lowest_price, :rating, :max_speed, :description, :contact_no, :email, :image, :url)\n end",
"def providerservice_params\n params.require(:providerservice).permit(:name, :description, :providerprofile_id)\n end",
"def create\n @healthcare_provider = HealthcareProvider.new(healthcare_provider_params)\n\n respond_to do |format|\n if @healthcare_provider.save\n format.html { redirect_to @healthcare_provider, notice: 'Healthcare provider was successfully created.' }\n format.json { render json: @healthcare_provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @healthcare_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_type = ProviderType.new(params[:provider_type])\n\n respond_to do |format|\n if @provider_type.save\n format.html { redirect_to(@provider_type, :notice => 'Provider type was successfully created.') }\n format.xml { render :xml => @provider_type, :status => :created, :location => @provider_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:user_id, :alias, :rfc, :razon_social, :direccion, :encargado, :telefono_encargado, :correo_encargado, :codigo_proveedor)\n end",
"def provider_params\n params.require(:provider).permit(:company_name, :fantasy_name, :cpf, :cnpj, :street, :number, :neighborhood, :cep, :ie, :bank, :ag, :cc, :variation, :state_id, :city_id, :phone1, :phone2)\n end",
"def create_new_admin\n @provider = Provider.new\n end",
"def create\n @email_service_provider = EmailServiceProvider.new(params[:email_service_provider])\n\n respond_to do |format|\n if @email_service_provider.save\n format.html { redirect_to @email_service_provider, notice: 'Email service provider was successfully created.' }\n format.json { render json: @email_service_provider, status: :created, location: @email_service_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def healthcare_provider_params\n params.require(:healthcare_provider).permit(:name, :provider_type)\n end",
"def create\n @providerable, @name = find_polymorphic\n @provider = @providerable.provider_insurances.build(params[:provider_insurance])\n @provider.created_user = current_user.login_name\n @all_insurance_company = InsuranceCompany.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to polymorphic_path([@providerable, @provider]), notice: 'Provider insurance was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cloud_provider = params[:cloud_provider][:type].constantize.new(params[:cloud_provider])\n respond_to do |format|\n begin\n @cloud_provider.save\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully created.' }\n format.json { render json: @cloud_provider, status: :created, location: @cloud_provider }\n rescue\n flash[:error] = \"Check the credentials again\"\n format.html { render action: \"new\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @care_provider = CareProvider.new(care_provider_params)\n\n respond_to do |format|\n if @care_provider.save\n format.html { redirect_to @care_provider, notice: 'Care provider was successfully created.' }\n format.json { render :show, status: :created, location: @care_provider }\n else\n format.html { render :new }\n format.json { render json: @care_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_providers\n begin\n file = File.open('providers.text', 'w')\n\n @all_providers.each do |provider|\n file.write(provider[:name] + \"\\n\")\n file.write(provider[:id] + \"\\n\")\n file.write(provider[:website] + \"\\n\")\n file.write(provider[:number] + \"\\n\")\n file.write(provider[:email] + \"\\n\")\n file.write(\"\\n\")\n end\n ensure\n file.close unless file.nil?\n end\n end",
"def providers\n url = url_with_api_version(@base_url, 'providers')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def addservice\n\n @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]);\n permitted = params[:serviceprovider].permit( :description, :category_id);\n @service.services.create(permitted);\n\n render json: @service\n\n\nend",
"def create\n @provider_patient = ProviderPatient.new(provider_patient_params)\n\n respond_to do |format|\n if @provider_patient.save\n format.html { redirect_to @provider_patient, notice: 'Provider patient was successfully created.' }\n format.json { render :show, status: :created, location: @provider_patient }\n else\n format.html { render :new }\n format.json { render json: @provider_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def index\n @providers = Provider.all\n \n respond_to do |format|\n format.json {render json: @providers}\n format.xml {render xml: @providers}\n end\n end",
"def create\n @utility_provider = UtilityProvider.new(utility_provider_params)\n\n respond_to do |format|\n if @utility_provider.save\n format.html { redirect_to @utility_provider, notice: 'Utility provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @utility_provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @utility_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend",
"def providify\n newparam(:provider)\n nil\n end",
"def find_or_create_provider!(attrs)\n provider = Provider.find_by(name: attrs[:name])\n if provider.blank?\n provider = Provider.create!(\n name: attrs[:name],\n firm_agfs_supplier_number: attrs[:firm_agfs_supplier_number],\n api_key: attrs[:api_key],\n provider_type: attrs[:provider_type],\n vat_registered: attrs[:vat_registered],\n roles: attrs[:roles],\n lgfs_supplier_numbers: attrs[:lgfs_supplier_numbers] || []\n )\n end\n provider\n end",
"def populate_providers_hash\n # GET A LIST OF ALL PROVIDERS\n Rails.logger.info(\"Retrieving providers list from #{@ingest_providers_list_endpoint}\")\n response = RestClient::Request.execute :method => :get, :url => \"#{@ingest_providers_list_endpoint}\", :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n if (response.code != 200)\n Rails.logger.info(\"ERROR #{response.code} retrieving providers list\")\n # terminate task if we cannot validate the providers names\n exit(status=256)\n else\n list_of_providers_hashes = JSON.parse!(response.body)\n list_of_providers_hashes.each do |hash|\n provider_id = hash['provider-id']\n @all_providers[provider_id] = 'Y'\n end\n Rails.logger.info(\"RETRIEVED A LIST OF ALL PROVIDERS, SIZE: #{list_of_providers_hashes.size}, LOOKUP SIZE: #{@all_providers.size}\")\n end\n end",
"def providers_payment_type_params\n params.require(:providers_payment_type).permit(:payment_type)\n end",
"def register(*providers)\n providers.each do |provider|\n provider.urls.each do |url|\n @@urls[url] ||= []\n @@urls[url] << provider\n end\n end\n end",
"def create\n @providers_branch = Providers::Branch.new(providers_branch_params)\n\n respond_to do |format|\n if @providers_branch.save\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully created.' }\n format.json { redirect_to providers_branches_path, status: :created, location: @providers_branch }\n else\n format.html { render :new }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @providerservices = Providerservice.all\n end",
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def create\n @informal_care_provider = @senior.informal_care_providers.create(informal_care_provider_params)\n redirect_to senior_path(@senior)\n # # respond_to do |format|\n # # if @informal_care_provider.save\n # # format.html { redirect_to senior_path(@senior), notice: 'informal_care_provider was successfully created.' }\n # # format.json { render :show, status: :created, location: @informal_care_provider }\n # # else\n # # format.html { render :new }\n # # format.json { render json: @informal_care_providers.errors, status: :unprocessable_entity }\n # # end\n # end\n end",
"def index\n @providers = Provider.all\n end",
"def new\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.new\n @title = @name.titleize + \" New Provider Insurance\"\n @all_insurance_company = InsuranceCompany.find(:all, :order => :name)\n @edit = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def provider_params\n params.require(:provider).permit(:id,:last_name, :first_name, :preferred_name, :middle_name, :salutation, :address, :email, :phone_number, :status, :ssn, :date_birth, :gender, :spouse_name, :place_birth, :superviser, :hiredate, :termination_date, :regidency, :regidency_address, :regidency_degree, :regidency_dates, :medical_education, :medical_education_city, :pre_med_education, :pre_med_education_city, :pre_med_degree, :pre_med_dates, :initial_contact_date, :application_received_date, :cv_received_date, :interview_date, :date_verification, :verification_completion_date, :recertification_request_date, :recertification_completion_date, :active_referral_options, :date_hired, :referredby, :first_shift_date, :referral_paid_date, :amount, :notes, :referral_code, :access_id, :microstaffer_id)\n end",
"def create\n @provider_project = ProviderProject.new(provider_project_params)\n\n respond_to do |format|\n if admin? and @provider_project.save\n format.html { redirect_to @provider_project, notice: 'Provider project was successfully created.' }\n format.json { render :show, status: :created, location: @provider_project }\n else\n format.html { render :new }\n format.json { render json: @provider_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def to_json\n return {\n name: name,\n provider: provider\n }.to_json\n end",
"def api_register\n creator = Creator.new(submits: 0, name: request.headers['name'],password: request.headers['password'],password_confirmation: request.headers['password'])\n if creator.save\n encode = encodeJWT(creator)\n selected_format({jwt: encode,creator_id: creator.id,name: creator.name,submits:creator.submits},:ok)\n else\n error = create_error_message\n error[:developerMessage] = creator.errors\n selected_format(error, :bad_request)\n end\n end",
"def payment_provider_params\n params.require(:payment_provider).permit(:label, :connected, :provider_type, :api_key)\n end",
"def service_provider_params\n params.require(:service_provider).permit(:name, :name_abreviation, :contact_email, :contact_name)\n end",
"def providers_get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProvidersApi.providers_get_providers ...\"\n end\n # resource path\n local_var_path = \"/api/Providers\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].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', 'text/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 => 'ProviderListItemPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProvidersApi#providers_get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def provider_params\n params.require(:provider).permit(:active)\n end",
"def new\r\n @provider = Provider.new\r\n render_new\r\n end",
"def create\n @modal = false\n @provider = Provider.new(provider_params)\n if params[:modal] == 'true'\n @modal = true\n @provider.save\n else\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Fornecedor criado com sucesso.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def provider_payment_params\n params.require(:provider_payment).permit(:provider_id, :cantidad, :fecha)\n end",
"def create\n @provider_stat = ProviderStat.new(params[:provider_stat])\n\n respond_to do |format|\n if @provider_stat.save\n flash[:notice] = 'ProviderStat was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider_stat, :status => :created, :location => @provider_stat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider_stat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @data_providers = DataProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_providers }\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n build_authentication_provider\n authorize_authentication_provider\n authentication_provider.save\n respond_with authentication_provider_presenter\n end",
"def provider_params\n params.require(:provider).permit(:user_id, :nombre, :foto, :productos, :anticipacion, :telefono, :correo, :info_general, :servicios, :domicilio, :tags, :color, :servicio_list, :icon, :domicilio_list, :cover_photo, provider_attachments_attributes: [:id, :provider_id, :image2])\n end",
"def create\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new(params[:oauth_remote_service_provider])\n\n respond_to do |format|\n if @oauth_remote_service_provider.save\n flash[:notice] = 'OauthRemoteServiceProvider was successfully created.'\n format.html { redirect_to(@oauth_remote_service_provider) }\n format.xml { render :xml => @oauth_remote_service_provider, :status => :created, :location => @oauth_remote_service_provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @oauth_remote_service_provider.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7196066",
"0.6896307",
"0.6886106",
"0.6805139",
"0.67927444",
"0.6713015",
"0.6592217",
"0.65495884",
"0.64063054",
"0.63403493",
"0.6326314",
"0.63182",
"0.6274265",
"0.62492526",
"0.6234781",
"0.6211055",
"0.6205681",
"0.618968",
"0.61692774",
"0.61692774",
"0.6157692",
"0.6143396",
"0.60708827",
"0.6068316",
"0.5998912",
"0.5998791",
"0.5949059",
"0.5875534",
"0.58689755",
"0.5854166",
"0.58292365",
"0.579059",
"0.5775001",
"0.57507604",
"0.57474315",
"0.57358325",
"0.5729637",
"0.57176024",
"0.56543154",
"0.5615235",
"0.5610458",
"0.5592034",
"0.55846393",
"0.55845064",
"0.5584137",
"0.5553205",
"0.55466527",
"0.55438757",
"0.5520977",
"0.550615",
"0.5497582",
"0.54880714",
"0.5480437",
"0.5476693",
"0.54673696",
"0.5461001",
"0.5453637",
"0.54131097",
"0.54080045",
"0.54058915",
"0.54030204",
"0.54030204",
"0.54030204",
"0.54030204",
"0.53688496",
"0.5365231",
"0.5358045",
"0.53537375",
"0.5352232",
"0.53436005",
"0.53404844",
"0.53379357",
"0.5328592",
"0.53008854",
"0.52887243",
"0.52824867",
"0.52712554",
"0.5263077",
"0.5249517",
"0.5241369",
"0.5227623",
"0.5226182",
"0.52201784",
"0.52185524",
"0.52110493",
"0.5209786",
"0.5205378",
"0.519768",
"0.5192679",
"0.5171783",
"0.5161127",
"0.51555425",
"0.5145869",
"0.51454574",
"0.5142461",
"0.51408684",
"0.5139453",
"0.5110575",
"0.510716",
"0.50958097"
] | 0.69564795 | 1 |
PUT /providers/1 PUT /providers/1.json | def update
@provider = current_company.providers.find(params[:id])
respond_to do |format|
if @provider.update_attributes(params[:provider])
format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @provider.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @provider = Provider.find(params[:id])\n\n if @provider.update(provider_params)\n head :no_content\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def update_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: \"Provider was successfully updated.\" }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to provider_readme_url(@provider), notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to(@provider, :notice => 'Provider was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :resp=> \"ok\" }}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n format.json { render :json => { :resp=> \"error\" }}\n end\n end\n end",
"def update!(**args)\n @providers = args[:providers] if args.key?(:providers)\n end",
"def update\n if @manage_provider.update(manage_provider_params)\n flash[:success] = '添加成功'\n else\n flash[:error] = '修改失败'\n end\n redirect_to '/manage/providers'\n end",
"def update\n @provider = Provider.find(params[:id])\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n @providers = Provider.all\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n logger.debug(@provider)\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Fornecedor atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to providers_path, notice: 'As informacoes foram atualizadas com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @info_provider.update(info_provider_params)\n format.html { redirect_to @info_provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_provider }\n else\n format.html { render :edit }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Order.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n flash[:notice] = 'Provider was successfully updated.'\n format.html { redirect_to(@provider) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t('view.providers.edit_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: t('view.providers.correctly_updated') }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_provider_url(@provider), alert: t('view.providers.stale_object_error')\n end",
"def update\n respond_to do |format|\n if @providerservice.update(providerservice_params)\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @providerservice }\n else\n format.html { render :edit }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n if @cloud_provider.update_attributes(params[:cloud_provider])\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @v1_provider_operation.update(v1_provider_operation_params)\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_provider_operation }\n else\n format.html { render :edit }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_v1_provider_operation\n @v1_provider_operation = V1::ProviderOperation.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @provider.update(check_params)\n #@provider = Provider.find(params[:id])\n #if @provider.update_attributes(params[:provider])\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно обновлен.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_provider.update(service_provider_params)\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully updated.\" }\n format.json { render :show, status: :ok, location: @service_provider }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end",
"def update\n current_account.update(provider_params, without_protection: true)\n respond_with current_account\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def update!(**args)\n @provider_info = args[:provider_info] if args.key?(:provider_info)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end",
"def update\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @provider.updated_user = current_user.login_name\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider_insurance])\n format.html { redirect_to polymorphic_path([@providerable, @provider]), notice: 'Provider insurance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider_provider_type.user_updated_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.update(provider_provider_type_params)\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.update')}\n format.json { render :show, status: :ok, location: @provider_provider_type }\n else\n format.html { render :edit }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_provider\r\n @provider = Provider.find(params[:id])\r\n end",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n\n if @provider.update_attributes(params[:provider])\n redirect_to(@provider, :success => 'Provider was successfully updated.')\n\n else\n\t\trender :action => \"edit\" \n \n end\n\n end",
"def update\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n if @data_provider.update_attributes(params[:data_provider])\n format.html { redirect_to @data_provider, notice: 'Data provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id]) if params[:id].present?\n @providers = Goodstype.find(params[:goodstype_id]).providers if params[:goodstype_id].present?\n end",
"def update\n @provider_type = ProviderType.find(params[:id])\n\n respond_to do |format|\n if @provider_type.update_attributes(params[:provider_type])\n format.html { redirect_to(@provider_type, :notice => 'Provider type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @supplier_provider.update(supplier_provider_params)\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @supplier_provider }\n else\n format.html { render :edit }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :POST\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end",
"def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def provider_params\r\n params.require(:provider).permit(:app_id, :name)\r\n end",
"def update!(**args)\n @provider = args[:provider] if args.key?(:provider)\n @provider_uri = args[:provider_uri] if args.key?(:provider_uri)\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @payment_provider = PaymentProvider.find(params[:id])\n\n respond_to do |format|\n if @payment_provider.update_attributes(params[:payment_provider])\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_providerservice\n @providerservice = Providerservice.find(params[:id])\n end",
"def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n\n respond_to do |format|\n if @oauth_remote_service_provider.update_attributes(params[:oauth_remote_service_provider])\n flash[:notice] = 'OauthRemoteServiceProvider was successfully updated.'\n format.html { redirect_to(@oauth_remote_service_provider) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oauth_remote_service_provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def set_provider\n @provider = Provider.friendly.find(params[:id])\n end",
"def update\n @email_service_provider = EmailServiceProvider.find(params[:id])\n\n respond_to do |format|\n if @email_service_provider.update_attributes(params[:email_service_provider])\n format.html { redirect_to @email_service_provider, notice: 'Email service provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider_service.update(provider_service_params)\n format.js { flash.now[:notice] = \"Provider Service was successfully updated.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider_service }\n else\n format.js { render :edit }\n format.html { render :edit }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @provider_id = args[:provider_id] if args.key?(:provider_id)\n @type = args[:type] if args.key?(:type)\n end",
"def set_provider_service\n @provider_service = ProviderService.find(params[:id])\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def provider_params\n params.require(:provider).permit(:name, :active, :api_token, :api_token_required, :default, :shortened_links_count)\n end",
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def update\n respond_to do |format|\n if @providers_payment_type.update(providers_payment_type_params)\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @providers_payment_type }\n else\n format.html { render :edit }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(name,&block)\n build_resource(name, :put, &block)\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :ok }\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update_provider_type(params)\n unless params[:type].blank?\n self.provider_type = 0\n params[:type].each do|e|\n self.provider_type |= e.to_i\n end\n else\n self.provider_type = 1\n end\n self.save\n end",
"def update\n @provider_stat = ProviderStat.find(params[:id])\n\n respond_to do |format|\n if @provider_stat.update_attributes(params[:provider_stat])\n flash[:notice] = 'ProviderStat was successfully updated.'\n format.html { redirect_to providers_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider_stat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_provider_provider_type\n @provider_provider_type = Provider::ProviderType.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @provider_payment.update(provider_payment_params)\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider_payment }\n else\n format.html { render :edit }\n format.json { render json: @provider_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_update\n @provider.attributes = params[:provider].each_value(&:strip!)\n if params[:provider][:wait_for_good_email]\n @provider.wait_for_good_email = params[:provider][:wait_for_good_email]\n else\n @provider.wait_for_good_email = 0\n end\n @provider.email_good_keywords = params[:provider][:email_good_keywords] if params[:provider][:email_good_keywords]\n if params[:provider][:wait_for_bad_email]\n @provider.wait_for_bad_email = params[:provider][:wait_for_bad_email]\n else\n @provider.wait_for_bad_email = 0\n end\n if @provider.api? \n @provider.login = params[:api_string].to_s\n @provider.email_good_keywords = params[:api_good_keywords].to_s\n end\n if @provider.save\n flash[:status] = _('Sms_provider_updated')\n redirect_to :action => 'providers' and return false\n else\n flash_errors_for(_('Sms_provider_not_updated'), @provider)\n @api_string = @provider.login.to_s\n @api_keywords = @provider.email_good_keywords\n @tariffs = current_user.sms_provider_tariffs\n render :action => :provider_edit and return false\n end\n end",
"def provider_params\n params.require(:provider).permit(:provider, :uid, :nickname, :token, :secret)\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def create_method\n :put_json\n end",
"def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end",
"def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @healthcare_provider.update(healthcare_provider_params)\n format.html { redirect_to @healthcare_provider, notice: 'Healthcare provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @healthcare_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_provider(file, owner, repo)\n # It looks like the last version is always at the end\n # This saves one HTTP request to owner/repo\n last_version_data = http_get(\"#{owner}/#{repo}/versions\")[\"versions\"].last\n\n version = last_version_data[\"version\"]\n\n archSrc = last_version_data[\"platforms\"].inject({}) do |sum, data|\n arch = data[\"arch\"]\n os = data[\"os\"]\n nix_arch = ARCH_TO_NIX[arch]\n nix_os = OS_TO_NIX[os]\n if nix_arch && nix_os then\n sum[\"#{nix_arch}-#{nix_os}\"] = get_version(owner, repo, version, os, arch)\n end\n sum\n end\n\n data = {\n archSrc: archSrc,\n owner: owner,\n repo: repo,\n version: version,\n }\n\n File.write(file, <<NIX)\n{ mkTerraformProvider }:\nmkTerraformProvider #{to_nix data}\nNIX\nend",
"def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_provider\n @provider = Provider.unscoped.where(\"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM_LEAD' , 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER')\").where(deleted_at: nil).where(symbol: params[:id]).first\n fail ActiveRecord::RecordNotFound unless @provider.present?\n end",
"def put(*args)\n request, adapter = request_and_adapter_from(args)\n\n with_adapter :put, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end",
"def update\n respond_to do |format|\n if @payment_provider.update(payment_provider_params)\n format.html { redirect_to settings_payments_path, notice: 'Payment provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_provider }\n else\n format.html { render :edit }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end"
] | [
"0.69004023",
"0.6817214",
"0.6646538",
"0.6624912",
"0.6624912",
"0.6613555",
"0.6586571",
"0.644157",
"0.64100003",
"0.63752437",
"0.6365661",
"0.63542736",
"0.6322013",
"0.6146228",
"0.61225057",
"0.6073541",
"0.6050184",
"0.6047935",
"0.60016364",
"0.5998813",
"0.5991263",
"0.5983349",
"0.59467596",
"0.5880348",
"0.585632",
"0.5846727",
"0.5842666",
"0.5840273",
"0.58377594",
"0.5825997",
"0.5825628",
"0.57870054",
"0.57859474",
"0.575359",
"0.5725276",
"0.5725276",
"0.5725276",
"0.5725276",
"0.5725276",
"0.5725276",
"0.5725276",
"0.56998783",
"0.56854576",
"0.56694275",
"0.5666396",
"0.5649071",
"0.56339514",
"0.5612211",
"0.56002903",
"0.5597993",
"0.5595788",
"0.55867964",
"0.5551053",
"0.5549025",
"0.55317175",
"0.55268604",
"0.55261064",
"0.55140156",
"0.5506696",
"0.5505977",
"0.55053246",
"0.54985756",
"0.549576",
"0.5494696",
"0.5481065",
"0.54764116",
"0.5475159",
"0.5474921",
"0.54729885",
"0.54214966",
"0.5403171",
"0.53834677",
"0.5380883",
"0.5379881",
"0.5362654",
"0.53435403",
"0.53413934",
"0.53304756",
"0.5325125",
"0.53204966",
"0.53167033",
"0.53123623",
"0.53031665",
"0.5299407",
"0.5299407",
"0.5299407",
"0.5296581",
"0.52961177",
"0.5283002",
"0.52706105",
"0.52702194",
"0.52702194",
"0.5257397",
"0.52459013",
"0.52432126",
"0.523517",
"0.52319044",
"0.5217872",
"0.52177024",
"0.52161807"
] | 0.68262064 | 1 |
DELETE /providers/1 DELETE /providers/1.json | def destroy
@provider = current_company.providers.find(params[:id])
@provider.destroy
respond_to do |format|
format.html { redirect_to providers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Fornecedor apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n\n head :no_content\n end",
"def destroy\n @v1_provider_operation.destroy\n respond_to do |format|\n format.html { redirect_to v1_provider_operations_url, notice: 'Provider operation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(providers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @data_provider = DataProvider.find(params[:id])\n @data_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to data_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_provider = PaymentProvider.find(params[:id])\n @payment_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n redirect_to providers_url\n end",
"def destroy\n @service_provider.destroy\n respond_to do |format|\n format.html { redirect_to service_providers_url, notice: \"Service provider was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider_service.destroy\n respond_to do |format|\n format.html { redirect_to provider_services_url, notice: 'Provider service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n @cloud_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to cloud_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Order.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @providerservice.destroy\n respond_to do |format|\n format.html { redirect_to providerservices_url, notice: 'Providerservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @info_provider.destroy\n respond_to do |format|\n format.html { redirect_to info_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if active_client_count(provider_id: @provider.symbol).positive?\n message = \"Can't delete provider that has active clients.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @provider.update(is_active: nil, deleted_at: Time.zone.now)\n unless Rails.env.test?\n @provider.send_delete_email(responsible_id: current_user.uid)\n end\n head :no_content\n else\n # Rails.logger.error @provider.errors.inspect\n render json: serialize_errors(@provider.errors, uid: @provider.uid),\n status: :unprocessable_entity\n end\n end",
"def destroy\n @healthcare_provider.destroy\n respond_to do |format|\n format.html { redirect_to healthcare_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @providers_payment_type.destroy\n respond_to do |format|\n format.html { redirect_to providers_payment_types_url, notice: 'Payment type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger = Logger.new(STDOUT)\n if active_client_count(provider_id: @provider.symbol) > 0\n message = \"Can't delete provider that has active clients.\"\n status = 400\n logger.warn message\n render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status\n elsif @provider.update_attributes(is_active: nil, deleted_at: Time.zone.now)\n @provider.send_delete_email unless Rails.env.test?\n head :no_content\n else\n logger.warn @provider.errors.inspect\n render json: serialize_errors(@provider.errors), status: :unprocessable_entity\n end\n end",
"def destroy\n @provider_payment.destroy\n respond_to do |format|\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n member_id = @provider.member_id\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to member_url(member_id) }\n format.xml { head :ok }\n format.json {render :json=> {\"resp\" => \"ok\"} }\n end\n end",
"def destroy\n @utility_provider.destroy\n respond_to do |format|\n format.html { redirect_to utility_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_provider.destroy\n respond_to do |format|\n format.html { redirect_to settings_payments_path, notice: 'Payment provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@providerable, :provider_insurances]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n delete(\"/2.0/oauth_providers/#@consumer_key\")['success']\n end",
"def destroy\n @provider_type = ProviderType.find(params[:id])\n @provider_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(provider_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @provider_stat = ProviderStat.find(params[:id])\n @provider_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(provider_stats_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @supplier_provider.destroy\n respond_to do |format|\n format.html { redirect_to supplier_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_service_provider = EmailServiceProvider.find(params[:id])\n @email_service_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to email_service_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n @oauth_remote_service_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(oauth_remote_service_providers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n @supplies_providers_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_providers_loans_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 @provider_patient.destroy\n respond_to do |format|\n format.html { redirect_to provider_patients_url, notice: 'Provider patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_prov_type.destroy\n respond_to do |format|\n format.html { redirect_to service_prov_types_url, notice: 'Service prov type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @care_provider.destroy\n respond_to do |format|\n format.html { redirect_to care_providers_url, notice: 'Care provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @register_financeiro_provider.destroy\n respond_to do |format|\n format.html { redirect_to register_financeiro_providers_url, warning: 'Fornecedor deletado com Sucesso!' }\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 @manage_provider.destroy\n respond_to do |format|\n format.html { redirect_to auction_providers_url, notice: 'Editor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n request(:delete)\n end",
"def provider_destroy\n unless @provider\n flash[:notice] = _('Sms_provider_not_found')\n redirect_to :action => 'providers' and return false\n end\n @provider.destroy\n flash[:status] = _('Sms_provider_deleted')\n redirect_to :action => 'providers'\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @provider_group = ProviderGroup.find(params[:id])\n @provider_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(provider_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @backend.destroy\n respond_to do |format|\n format.html { redirect_to backends_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 @platform.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @content_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_providers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\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 delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @teleprovider.destroy\n\n respond_with(@teleprovider, location: teleproviders_url)\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\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 conf.delete 'api'\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n @aws_platform.destroy\n respond_to do |format|\n format.html { redirect_to aws_platforms_url, notice: 'Aws platform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provincial.destroy\n respond_to do |format|\n format.html { redirect_to admin_provincials_url, notice: 'Provincial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if admin?\n @provider_project.destroy\n respond_to do |format|\n format.html { redirect_to provider_projects_url, notice: 'Provider project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider_engaged_user.destroy\n respond_to do |format|\n format.html { redirect_to provider_engaged_users_url, notice: 'Provider engaged user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oauth_client = OauthClient.find(params[:id])\n @oauth_client.destroy\n\n respond_to do |format|\n format.html { redirect_to oauth_clients_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @client.delete(@name)\n end",
"def destroy\n @api_v1_resource.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @credit_provider_typology.destroy\n respond_to do |format|\n format.html { redirect_to credit_provider_typologies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @platform = Platform.find(params[:id])\n @platform.destroy\n\n respond_to do |format|\n format.html { redirect_to platforms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if @name.nil?\n delete_rest \"extra/#{@name}\"\n end",
"def destroy\n @devise = Devise.find(params[:id])\n @devise.destroy\n #API CALL GOES HERE\n\n respond_to do |format|\n format.html { redirect_to devises_url }\n format.json { head :no_content }\n end\n end",
"def deleteEntityPayment_type( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/payment_type\",params)\n end",
"def destroy\n @license.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Запись о лицензии удалена.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end",
"def destroy\n @grant = Grant.find(params[:id])\n @grant.destroy\n\n respond_to do |format|\n format.html { redirect_to grants_url }\n format.json { head :ok }\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 @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\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"
] | [
"0.7473128",
"0.74667734",
"0.74512416",
"0.74512416",
"0.74512416",
"0.73346823",
"0.72772837",
"0.72772837",
"0.72772837",
"0.7225288",
"0.7218178",
"0.7041858",
"0.7011474",
"0.69845635",
"0.6982556",
"0.6958283",
"0.6934727",
"0.6932733",
"0.6914863",
"0.6914221",
"0.6895894",
"0.6886113",
"0.684147",
"0.6773351",
"0.67351407",
"0.6705444",
"0.6678943",
"0.6675075",
"0.6646438",
"0.6642058",
"0.6623378",
"0.66071624",
"0.65624887",
"0.6512558",
"0.65027785",
"0.6498552",
"0.6440969",
"0.6434202",
"0.64097464",
"0.639694",
"0.6376215",
"0.6376215",
"0.6376215",
"0.6376215",
"0.6364045",
"0.6355391",
"0.6351846",
"0.6318229",
"0.6309898",
"0.63081896",
"0.63016796",
"0.6292644",
"0.62802476",
"0.6273493",
"0.6260261",
"0.6249439",
"0.6245735",
"0.6244312",
"0.6232946",
"0.6232538",
"0.62255836",
"0.6225282",
"0.62193793",
"0.6210129",
"0.62029916",
"0.6201557",
"0.6195948",
"0.61662847",
"0.61575943",
"0.6156947",
"0.6156947",
"0.6152952",
"0.61521244",
"0.61517423",
"0.61484444",
"0.6140433",
"0.6137232",
"0.6134781",
"0.6133343",
"0.61280024",
"0.6127968",
"0.61268604",
"0.61125475",
"0.6112423",
"0.61118954",
"0.6105654",
"0.6104041",
"0.6104016",
"0.6103375",
"0.61026406",
"0.610114",
"0.6092876",
"0.60919756",
"0.60881156",
"0.6087768",
"0.6087474",
"0.60871255",
"0.608503",
"0.608363",
"0.60834837"
] | 0.73810977 | 5 |
Use cssstyle padding declaration, i.e. 10 (all sides) 10 5 (top/bottom, left/right) 10 5 10 (top, left/right, bottom) 10 5 10 5 (top, right, bottom, left) | def parse_padding_string(str)
padding_parts = str.gsub('px','').split(/\s+/).map{|px| px.to_i}
case padding_parts.size
when 1
p = padding_parts.first
[p,p,p,p]
when 2
p,q = padding_parts
[p,q,p,q]
when 3
p,q,r = padding_parts
[p,q,r,q]
when 4
padding_parts
else raise ArgumentError, "Couldn't parse padding string '#{str}' - should be a css-style string"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_padding(value)\n values = Array(value)\n sides = %i[top right bottom left]\n\n # Treat :margin as CSS shorthand with 1-4 values.\n positions = {\n 4 => [0, 1, 2, 3], 3 => [0, 1, 2, 1],\n 2 => [0, 1, 0, 1], 1 => [0, 0, 0, 0],\n 0 => []\n }[values.length]\n\n top, right, bottom, left = sides.zip(positions).map do |side, pos|\n pos ? values[pos] : 0\n end\n\n OpenStruct.new(top: top, right: right, bottom: bottom, left: left)\n end",
"def padding\n paddings = {}\n CssStyle.directions.each do |dir| \n value = css_style.send :\"padding_#{dir}\"\n paddings[dir] = value if value\n end\n return nil if paddings == {} \n paddings\n end",
"def cell_padding\n @padding ||= if stylized? \n pad = 16\n pad -= 3 if background_color.nil?\n pad -= 2 if text_color.nil?\n pad -= 1 if background_color.nil? && text_color.nil?\n pad\n else\n 2\n end\n end",
"def padding(n)\n padding_left(n).padding_right(n).padding_top(n).padding_bottom(n)\n end",
"def padding; 3; end",
"def padding; end",
"def padding; end",
"def padding=(pad); end",
"def padding\n \"\\0\" * padding_size\n end",
"def standard_padding\n return PADDING\n end",
"def standard_padding\n return PADDING\n end",
"def standard_padding\n return PADDING\n end",
"def standard_padding\n return PADDING\n end",
"def padded(padding = 2, &block)\n r = bounds\n padding ||= 2\n bounding_box([padding, r.top - padding], width: r.width - (2 * padding), &block)\n end",
"def test_padding\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 100, 300, 50, @elements, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.padding = 5\n uc.draw()\n }\n return true\n end",
"def padding_size\n padding = renderer.padding\n (padding.left + padding.right) * table.columns_count\n end",
"def update_padding_bottom\n self.padding_bottom = padding\n end",
"def calc_width; padding * 2 + base_width; end",
"def calc_width; padding * 2 + base_width; end",
"def standard_padding; 0; end",
"def sox_pad(paddings)\n if paddings\n lpad, rpad = paddings\n if lpad > 0 || rpad > 0\n lpad, rpad = lpad.round(2).to_s.shellescape, rpad.round(2).to_s.shellescape\n \"pad #{lpad} #{rpad}\"\n end\n end\n end",
"def padding(values)\n values = build_padding_values(values)\n position = padding_position(values)\n width, height = padding_size(values)\n bounding_box(position, width: width, height: height) { yield }\n end",
"def pad_around(text, padding, fill: SPACE)\n fill * padding.left + text + fill * padding.right\n end",
"def calc_height; padding * 2 + base_height; end",
"def calc_height; padding * 2 + base_height; end",
"def padding\n @padding ||= all_changes.map { |change| change.status.size }.max + 5\n end",
"def standard_padding\n return 0\n end",
"def pad(depth = 0)\n \" \" * depth\n end",
"def padding; KP_Settings::PADDING; end",
"def padding(padding = nil)\n padding = Applitools::PaddingBounds::ZERO_PADDING unless padding\n Applitools::ArgumentGuard.is_a?(padding, 'padding', Applitools::PaddingBounds)\n @padding = padding\n self\n end",
"def padding=(_arg0); end",
"def padding(n, c = \"\\0\")\n m = n % 4\n c * (m == 0 ? 0 : 4 - m)\n end",
"def pad(value)\r\n return value unless @padding == :zero\r\n matcher = @alignment == :right ? /^ +/ : / +$/\r\n space = value.match(matcher)\r\n return value unless space\r\n value.gsub(space[0], '0' * space[0].size)\r\n end",
"def get_padding opt\n (opt[:padding] || opt[:cellpadding]).to_i\n end",
"def margins_in(top, left = top, bottom = top, right = left)\n margins_pt(in2pts(top), in2pts(left), in2pts(bottom), in2pts(right))\n end",
"def adjust_scroll_padding\n width, height = canvas_size\n original_pad_x, original_pad_y = @original_scroll_padding\n pad_x = (original_pad_x == -1) ? width / 2 : [original_pad_x, width / 2].min\n pad_y = (original_pad_y == -1) ? height / 2 : [original_pad_y, height / 2].min\n @scroll_padding = [pad_x, pad_y]\n end",
"def spacing\r\n return 8\r\n end",
"def clip_padding(val = nil)\n return @properties[\"clipPadding\"] if !val\n @properties[\"clipPadding\"] = val\n return self\n end",
"def unpadded_height\n height = 0\n padding = self.get_padding\n height = self.bounds.height - (padding[:top] + padding[:bottom])\n return height\n end",
"def spacing\n return 8\n end",
"def spacing\n return 8\n end",
"def outer_width; rect.width + @border_thickness * 2; end",
"def set_api_response_padding(padding)\n self.before_padding = \"<#{padding.pluralize}><#{padding}>\"\n self.after_padding = \"</#{padding}></#{padding.pluralize}>\"\n end",
"def calculate_plot_width(num_snps, right_padding)\n return num_snps * @box_size.to_f/97 + right_padding\n end",
"def spacing; 0; end",
"def label_with_padding\n padded_label = label[0..20].ljust(20) + ' | '\n Strainer.ui.set_color padded_label, color\n end",
"def calculate_spaces(space=32, height=22, rounds =1)\n unless rounds < 1 \n rounds = rounds- 1\n puts \"height: #{space}px;\"\n next_space = (2 * space) + (height/2)\n calculate_spaces(next_space, height, rounds)\n end\nend",
"def calc_padding(offset)\n align = required_alignment\n\n # If offset is not aligned...\n if (offset % align) != 0\n # Calculate padding needed to be aligned\n align - (offset & (align - 1))\n else\n 0\n end\n end",
"def draw_grid_square(x,y,color,z,padding=0,xmargin=@xmargin,ymargin=@ymargin)\n super\n end",
"def padding_size\n -total_payload_size % 64\n end",
"def unpadded_width\n width = 0\n padding = self.get_padding\n width = self.bounds.width - (padding[:left] + padding[:right])\n return width\n end",
"def padding=(value)\n raise TypeError, ':padding option must be a Padding instance or respond to #to_hash or #to_h' unless value.respond_to?(:to_hash) || value.respond_to?(:to_h)\n \n @padding = if value.is_a?(Padding)\n value\n else\n value = value.to_hash rescue value.to_h\n \n Padding.new(value)\n end\n end",
"def outer_height; rect.height + @border_thickness * 2; end",
"def test_add_padding()\n length_increment = 256 * 1024\n assert_equal(\n @batch_job_utils.add_padding('abcd').bytesize,\n length_increment)\n assert_equal(\n @batch_job_utils.add_padding(' ' * length_increment).bytesize,\n length_increment)\n assert_equal(\n @batch_job_utils.add_padding(' ' * (length_increment + 1)).bytesize,\n 2 * length_increment)\n end",
"def pad(text, padding, fill: SPACE, separator: nil)\n padding = Strings::Padder.parse(padding)\n text_copy = text.dup\n sep = separator || text[LINE_BREAK] || NEWLINE\n line_width = max_line_length(text, sep)\n output = []\n\n filler_line = fill * line_width\n\n padding.top.times do\n output << pad_around(filler_line, padding, fill: fill)\n end\n\n text_copy.split(sep).each do |line|\n line = line.empty? ? filler_line : line\n output << pad_around(line, padding, fill: fill)\n end\n\n padding.bottom.times do\n output << pad_around(filler_line, padding, fill: fill)\n end\n\n output.join(sep)\n end",
"def padding(num)\n num >= 10? num.to_s : \"0\" + num.to_s\n end",
"def margins_cm(top, left = top, bottom = top, right = left)\n margins_pt(cm2pts(top), cm2pts(left), cm2pts(bottom), cm2pts(right))\n end",
"def spacing\n @spacing ||= 1\n end",
"def process_field_padding(field)\n # Instanciate variable\n result = ''\n\n # Retrieve required variable\n max_i = field.at(\"length\").inner_html.to_i\n value = field.at(\"value\").inner_html.to_s\n\n max_i.times { result += value}\n\n result\n end",
"def set_pad_dimensions(t, l, h, w )\n @pad_h = h\n @pad_w = w\n @top = @orig_top = t\n @left = @orig_left = l\n create_pad\n end",
"def format_string(str, padding = DEFAULT_PADDING, max_pad = MAX_PADDING, leaderboards = true)\n # Compute maximum padding length\n max_pad = !max_pad.nil? ? max_pad : (leaderboards ? MAX_PADDING : MAX_PAD_GEN)\n\n # Compute actual padding length, based on the different constraints\n pad = DEFAULT_PADDING\n pad = padding if padding > 0\n pad = max_pad if max_pad > 0 && max_pad < padding\n pad = SCORE_PADDING if SCORE_PADDING > 0\n\n # Adjust padding if there are emojis or kanjis (characters with different widths)\n # We basically estimate their widths and cut the string at the closest integer\n # match to the desired padding\n widths = str.chars.map{ |s|\n s =~ Unicode::Emoji::REGEX ? WIDTH_EMOJI : (s =~ /\\p{Han}|\\p{Hiragana}|\\p{Katakana}/i ? WIDTH_KANJI : 1)\n }\n total = 0\n totals = widths.map{ |w| total += w }\n width = totals.min_by{ |t| (t - pad).abs }\n chars = totals.index(width) + 1\n pad = pad > width ? chars + (pad - width).round : chars\n\n # Truncate and pad string\n \"%-#{\"%d\" % [pad]}s\" % [TRUNCATE_NAME ? str.slice(0, pad) : str]\nend",
"def calculate_top_margin\n @border_top = 5\n @border_top += title_font_size if show_graph_title\n @border_top += 5\n @border_top += subtitle_font_size if show_graph_subtitle\n end",
"def compute_height(pad = 2, factor = 13)\n (max_actions + pad) * factor\n end",
"def pad\n truncate.center(truncate.size + 2)\n end",
"def pad!(min_size, value = nil)\n spaces = min_size - self.length\n spaces.times do \n self.push(value)\n end\n self\nend",
"def contents_width\n width - standard_padding * 2\n end",
"def pad(tensor, paddings, mode: 'CONSTANT', name: nil)\n _op(:pad, tensor, nil, paddings: paddings, mode: mode, name: name)\n end",
"def pad(tensor, paddings, mode: \"CONSTANT\", name: nil)\n _op(:pad, tensor, paddings, mode: mode, name: name)\n end",
"def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end",
"def padded_box(margin, &block)\n bounding_box [bounds.left + margin, bounds.top - margin],\n :width => bounds.width - (margin * 2), \n :height => bounds.height - (margin * 2), &block \n end",
"def string_format\n # Convert trim box parameters to string with syntax: \"<width>x<height>+<offset_x>+<offset_y>\":\n return \"#{@width}x#{@height}+#{@offset_x}+#{@offset_y}\"\n end",
"def action_padding(action)\n ' ' * [(max_action_length - action.to_s.length), 0].max\n end",
"def action_padding(action)\n ' ' * [(max_action_length - action.to_s.length), 0].max\n end",
"def GenPad(x1, y1, x2, y2, name, number, flags)\n if x1 > x2\n x1, x2 = x2, x1\n end\n if y1 > y2\n y1, y2 = y2, y1\n end\n if (x2 - x1) > (y2 - y1)\n thickness = (y2 - y1)\n y1 = y2 = (y1 + y2) / 2.0 # same value, no eps\n x1 += thickness / 2.0\n x2 -= thickness / 2.0\n else\n thickness = (x2 - x1)\n x1 = x2 = (x1 + x2) / 2.0\n y1 += thickness / 2.0\n y2 -= thickness / 2.0\n end\n PcbSmartPad(x1, y1, x2, y2, thickness, name, number, flags)\nend",
"def pad(element=nil,rows=true,cols=true,top=true,bottom=true,left=true,right=true)\n\t\tmatrix = self.clone\n\t\tinsert_count = 0\n\t\t\n\t\tif (rows)\n\t\t\tinsert_count = 1\n\t\t\tpadding_array = Array.new(matrix.width, element)\n\t\t\twhile (insert_count < matrix.height)\n\t\t\t\tmatrix = matrix.insert_row(padding_array,insert_count)\n\t\t\t\tinsert_count += 2\n\t\t\tend\n\t\tend\n\t\t\n\t\tif (cols)\n\t\t\tinsert_count = 1\n\t\t\tpadding_array = Array.new(matrix.height, element)\n\t\t\twhile (insert_count < matrix.width)\n\t\t\t\tmatrix = matrix.insert_col(padding_array,insert_count)\n\t\t\t\tinsert_count += 2\n\t\t\tend\n\t\tend\n\t\t\n\n\t\tif(top)\n\t\t\tpadding_array = Array.new(matrix.width, element)\n\t\t\tmatrix = matrix.insert_row(padding_array,0)\n\t\tend\n\t\t\n\t\tif(bottom)\n\t\t\tpadding_array = Array.new(matrix.width, element)\n\t\t\tmatrix = matrix.insert_row(padding_array,matrix.height)\n\t\tend\n\t\t\n\t\tif(left)\n\t\t\tpadding_array = Array.new(matrix.height, element)\n\t\t\tmatrix = matrix.insert_col(padding_array,0)\n\t\tend\n\t\t\n\t\tif(right)\n\t\t\tpadding_array = Array.new(matrix.height, element)\n\t\t\tmatrix = matrix.insert_col(padding_array,matrix.width)\n\t\tend\n\n\t\treturn matrix\n\tend",
"def outer_height\n height + offsets.height + padding.height\n end",
"def action_padding(action)\n ' ' * [(max_action_length - action.to_s.length), 0].max\n end",
"def calculate_bottom_margin\n @border_bottom = 7\n if key and key_position == :bottom\n @border_bottom += @data.size * (font_size + 5)\n @border_bottom += 10\n end\n if show_x_labels\n\t\t max_x_label_height_px = (not rotate_x_labels) ? \n x_label_font_size :\n get_x_labels.max{|a,b| \n a.to_s.length<=>b.to_s.length\n }.to_s.length * x_label_font_size * 0.6\n @border_bottom += max_x_label_height_px\n @border_bottom += max_x_label_height_px + 10 if stagger_x_labels\n end\n @border_bottom += x_title_font_size + 5 if show_x_title\n end",
"def contents_height\n height - standard_padding * 2\n end",
"def outer_width\n width + offsets.width + padding.width\n end",
"def pad(line, l, tw)\n # FIXME: Probably more efficient to pre-create\n # one. Wont this pass through the ANSI parser?\n # FIXME: The + 1 obscures cutoff indicators.\n c = tw - l + 1 #text_width #@out.w-line.length-6\n if c > 0\n line << \"\\e[48m\"+\" \"*c\n end\n end",
"def print_border_mb row, col, height, width, color, attr\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, ACS_VLINE, height-4)\n end",
"def p( colsizes, align = nil, padding = 3 )\n\t\t\t\tprint \"#{@color}\"\n\t\t\t\tidx = 0\n\t\t\t\t@cols.each do |item|\n\t\t\t\t\tif align and align[idx] == \"r\"\n\t\t\t\t\t\tprint \" \" * ( colsizes[ idx ] - item.to_s.length_utf8 )\n\t\t\t\t\tend\n\t\t\t\t\tprint item\n\t\t\t\t\tif align==nil or (align and align[idx] == \"l\")\n\t\t\t\t\t\tprint \" \" * ( colsizes[ idx ] - item.to_s.length_utf8 )\n\t\t\t\t\tend\n\t\t\t\t\tprint \" \"*padding if idx < colsizes.length - 1\n\t\t\t\t\tidx += 1\n\t\t\t\tend\n\t\t\t\tputs \"\\033[0m\"\n\t\t\tend",
"def margins_mm(top, left = top, bottom = top, right = left)\n margins_pt(mm2pts(top), mm2pts(left), mm2pts(bottom), mm2pts(right))\n end",
"def pad(s)\n s.to_s.rjust(3,\"0\")\nend",
"def print_border row, col, height, width, color, att=Ncurses::A_NORMAL\n $log.debug \" pad printborder #{row} - #{@top} , #{col} - #{@left}, #{height} , #{width} \"\n raise \"print_border: row < top, pls correct code #{row} #{@top}, #{col} #{@left} \" if row < @top or col < @left\n #$log.warn \"print_border: row < top, pls correct code #{row} #{@top} \" if row < @top\n super(row - @top, col - @left, height, width, color, att)\n end",
"def content_button_td_styles\n \"padding: 5px 10px; background: #08C; border: 1px solid #002A80; border-color: #3CF #002A80 #002A80 #3CF;\"\n end",
"def to_padded_coordinates\n w = @direction == :across ? @length : 1\n h = @direction == :across ? 1 : @length\n\n all = (@x - 1..@x + w + 1).map {|i| [i, @y - 1] } + # top\n (@x - 1..@x + w + 1).map {|i| [i, @y + 1] } + # bottom\n (@y - 1..@y + h + 1).map {|i| [@x - 1, i] } + # left\n (@y - 1..@y + h + 1).map {|i| [@x + 1, i] } # right\n\n all.select { |c|\n c[0] >= 0 && c[0] < Board::SIZE &&\n c[1] >= 0 && c[1] < Board::SIZE\n } + to_coordinates\n end",
"def center(p0, padstr=\"\") end",
"def pad(s)\n s.rjust(2, '0')\n end",
"def pad_image(image)\n\t\tdim = calc_side_length(image)\n\t\n\t\timage.background_color = @bg_color\n\t\t\n\t\tputs \"padding image\"\n\t\timage.extent(dim, dim)\n\tend",
"def draw_borders\n if borders.top > 0 # TODO: :none\n options = translate( x: margins.left, y: margins.top ).merge( width: width + margins.width, height: borders.top, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n \n if borders.bottom > 0 # TODO: :none\n options = translate( x: margins.left, y: offsets.top + padding.bottom ).merge( width: width + margins.width, height: borders.bottom, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n end",
"def padded(n)\n output = ''\n if (n < 10)\n output = '0' + n.to_s\n else\n output = n.to_s\n end\n output\n end",
"def auto(m)\n a = children - [self.inner, self.outer]\n return (@style[:margin_left] + @style[:margin_right] +\n @style[:border_left] + @style[:border_right] +\n @style[:padding_left] + @style[:padding_right] + \n (a.delete_if{|c| c.respond_to?(:style) && (c = c.style[:width]) != :auto && c.percent?\n }.map{|c| c.x + c.width }.max||0)\n ) if m == :width\n return (@style[:margin_top] + @style[:margin_bottom] +\n @style[:border_top] + @style[:border_bottom] +\n @style[:padding_top] + @style[:padding_bottom] +\n (a.delete_if{|c| c.respond_to?(:style) && (c = c.style[:height]) != :auto && c.percent?\n }.map{|c| c.y + c.height}.max||0)\n ) if m == :height\n end",
"def infoAreaLeftPadding\n LPADDING\n end",
"def pad\n 26 ** 3 # insure at least four digits\n end",
"def pad_number(n)\n n.to_s.rjust(self.field_width, ' ')\n end",
"def prefix(n, context=0, from=g_from_direction)\n mixin({\n \"padding-#{from}\" => column_percent(n, context) + gutter(context)\n })\n end",
"def setMargins(top, right, bottom, left)\n setMarginTop(top)\n setMarginRight(right)\n setMarginBottom(bottom)\n setMarginLeft(left)\n self\n end",
"def generate_white_spaces\n #Plain background\n if values_bits[Constants::V_Type_of_BG] > 4.5 \n if @vertical\n @white_space_w = @width - @sides_margin*2 \n @white_space_h = @height - (@main_image.height + @upper_img_margin + @upper_margin*2)\n @white_space_x = @sides_margin\n @white_space_y = values_bits[Constants::V_Image_position] < 4.5 ? @main_image.height+@upper_margin+@upper_img_margin : @upper_margin\n else\n @white_space_w = @width - (@main_image.width + @sides_img_margin + @sides_margin*2)\n @white_space_h = @height - @upper_margin*2\n @white_space_x = values_bits[Constants::V_Image_position] < 4.5 ? @main_image.width+2*@sides_margin : @sides_margin\n @white_space_y = @upper_margin\n end\n #Image as background\n else \n @white_space_w= @width - @sides_margin*2\n @white_space_h= @height - @upper_margin*2\n @white_space_x= @sides_margin\n @white_space_y= @upper_margin\n end\n \n @max_width = (@white_space_w.to_f * 0.60).to_i \n @max_width -= max_width%20 == 0 ? 0 : max_width%20\n # @groups.each do |g|\n # g.max_width = @max_width\n # end\n end"
] | [
"0.7250208",
"0.704926",
"0.6977006",
"0.6965564",
"0.68581045",
"0.6857524",
"0.6857524",
"0.6807115",
"0.67163956",
"0.66191053",
"0.66191053",
"0.66191053",
"0.66191053",
"0.6576584",
"0.6512658",
"0.6434529",
"0.6215733",
"0.61662763",
"0.61662763",
"0.6143774",
"0.6117302",
"0.6033865",
"0.5977862",
"0.59447324",
"0.59447324",
"0.5938325",
"0.59193933",
"0.5781196",
"0.5780601",
"0.5779699",
"0.57672757",
"0.57637453",
"0.56797844",
"0.5621528",
"0.55941296",
"0.5528798",
"0.55279464",
"0.54608345",
"0.54450697",
"0.5437536",
"0.5437536",
"0.54051155",
"0.53654563",
"0.53407466",
"0.5339278",
"0.5333521",
"0.5312522",
"0.53114575",
"0.52865875",
"0.52824366",
"0.5275187",
"0.52618563",
"0.52364737",
"0.5195467",
"0.51569504",
"0.51367706",
"0.51235825",
"0.51233184",
"0.5116673",
"0.5108032",
"0.51058215",
"0.50915056",
"0.5080927",
"0.50717336",
"0.50638103",
"0.50610954",
"0.5057062",
"0.505636",
"0.5045584",
"0.5042441",
"0.50274074",
"0.502474",
"0.502474",
"0.5019341",
"0.49955702",
"0.49825633",
"0.4970092",
"0.49678323",
"0.49656245",
"0.49633276",
"0.49631956",
"0.49521506",
"0.49286762",
"0.4918552",
"0.4914072",
"0.49102616",
"0.4900376",
"0.48990864",
"0.4891002",
"0.48897773",
"0.4883941",
"0.48596352",
"0.4857383",
"0.48305783",
"0.4816989",
"0.4813777",
"0.48110902",
"0.48079047",
"0.4806925",
"0.48024035"
] | 0.6174092 | 17 |
Use callbacks to share common setup or constraints between actions. | def set_ghost_log
@ghost_log = BattleLog.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 ghost_log_params
params.require(:ghost_log).permit(:battle_id, :description, :utility_type, :bMessage, :user_id, :pet_id, :item_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 valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def user_params
params.require(:user).permit(:email, :password, :name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\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 pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] | [
"0.7123669",
"0.7054077",
"0.69472784",
"0.6902165",
"0.6736001",
"0.671985",
"0.6687218",
"0.6676269",
"0.66602534",
"0.6556639",
"0.6527985",
"0.645892",
"0.645072",
"0.64494324",
"0.6445436",
"0.64350927",
"0.6415061",
"0.6415061",
"0.6393001",
"0.6378958",
"0.6378958",
"0.63741165",
"0.636044",
"0.63547933",
"0.6285727",
"0.6278816",
"0.6246161",
"0.6227885",
"0.6225383",
"0.622309",
"0.62118614",
"0.6209478",
"0.6176166",
"0.6172476",
"0.6169111",
"0.6158942",
"0.6143792",
"0.6136175",
"0.6123085",
"0.6108703",
"0.6100308",
"0.60760003",
"0.6054003",
"0.60426265",
"0.6036683",
"0.6029898",
"0.6020772",
"0.6020169",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.6019335",
"0.60176134",
"0.6006716",
"0.6003403",
"0.6001569",
"0.5995689",
"0.5994206",
"0.599406",
"0.5985532",
"0.59828365",
"0.5977637",
"0.59767246",
"0.5970349",
"0.59662646",
"0.5966073",
"0.5966073",
"0.5957612",
"0.5951802",
"0.5950822",
"0.59498274",
"0.5942674",
"0.59319496",
"0.5931201",
"0.59265846",
"0.59238476",
"0.5918484",
"0.59172106",
"0.59133804",
"0.59125537",
"0.59080327",
"0.59065026",
"0.5906122",
"0.59027356",
"0.59009796",
"0.589672",
"0.5895543",
"0.5893694"
] | 0.0 | -1 |
rule: each UUID consists of 32 hexademical characters, typically into 5 section like: "f65c57f6a6aa17a8faa1a67f2dc9fa91" | def generate_UUID
characters = []
(0..9).each { |digit| characters << digit.to_s }
('a'..'f').each { |digit| characters << digit }
uuid = ""
sections = [8, 4, 4, 4, 12] # integers representing the number of characters in each section
sections.each_with_index do |section, index|
section.times { uuid += characters.sample }
uuid += '-' unless index >= sections.size - 1 # index >= 4
end
uuid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid2\n hexchars = (('0'..'9').to_a).concat(('a'..'f').to_a)\n sections = [8, 4, 4, 4, 12]\n result = ''\n\n sections.each do |section|\n section.times do\n result << hexchars.sample.to_s\n end\n result << '-'\n end\n\n result.chop # to cut off trailing char\nend",
"def uuid_method\nhexadecimal_chars = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)\n\nfour_digit_array = []\nsecond_four_digit_array = []\nthird_four_digit_array = []\neight_digit_array = []\ntwelve_digit_array = []\n\nuntil four_digit_array.length == 4\nfour_digit_array << hexadecimal_chars.sample\nend\nuntil second_four_digit_array.length == 4\nsecond_four_digit_array << hexadecimal_chars.sample\nend\nuntil third_four_digit_array.length == 4\nthird_four_digit_array << hexadecimal_chars.sample\nend\nuntil eight_digit_array.length == 4\neight_digit_array << hexadecimal_chars.sample\nend\nuntil twelve_digit_array.length == 4\ntwelve_digit_array << hexadecimal_chars.sample\nend\n\"#{eight_digit_array.join}-#{four_digit_array.join}-#{second_four_digit_array.join}-#{third_four_digit_array.join}-#{twelve_digit_array.join}\"\nend",
"def uuid\n char = (0..9).collect { |n| n.to_s }\n char += ('a'..'f').to_a\n blocks = [8,4,4,4,12]\n \n uuid = ''\n blocks.each do |num|\n while num >= 0\n uuid << char.sample\n num -= 1\n end\n uuid += '-' \n end\n uuid.chop\nend",
"def get_uuid\n characters = ('0'..'9').to_a + ('a'..'f').to_a\n dash_positions = [8, 13, 18, 23]\n uuid = []\n\n 32.times do\n uuid.push(characters.sample)\n end\n uuid.each_with_index{ |char, ind| uuid.insert(ind, '-') if dash_positions.include?(ind) }\n uuid.join\nend",
"def uuid\n id = ''\n id << %w(0 1 2 3 4 5 6 7 8 9 a b c d e f).sample until id.size >= 32\n 4.times { |i| id.insert(8+i*5, '-') }\n id\nend",
"def make_uuid\n hex_arr = (0..9).to_a + ('a'..'f').to_a\n hex_arr = hex_arr.map!(&:to_s)\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12] \n sections.each_with_index do |section, index|\n section.times { uuid += hex_arr.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def create_uuid_2\n characters = []\n uuid = ''\n ('a'..'f').each { |char| characters << char}\n (0..9).each { |digit| characters << digit.to_s }\n \n sections = [8, 4, 4, 4, 12]\n\n sections.each_with_index do |section, index|\n section.times { uuid << characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def create_UUID\n characters =[]\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend",
"def new_uuid\n string_values = ['1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']\n uuid = \"\"\n 8.times {uuid += string_values.sample}\n uuid += \"-\"\n 3.times\n 4.times {uuid+= string_values.sample}\n uuid += \"-\"\n 12.times {uuid += string_values.sample}\n uuid\nend",
"def generate_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit.to_s}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= section.size - 1\n end\n\n uuid\nend",
"def create_uuid()\n characters = []\n ('a'..'z').each { |let| characters << let}\n ('0'..'9').each { |num| characters << num}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |num, index|\n num.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def create_uuid\n uuid = ''\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |section|\n section.times { uuid += HEX.sample }\n uuid += '-' unless section == 12\n end\n \n uuid\nend",
"def create_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n \n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n \n uuid\nend",
"def uuid(sequences = [8, 4, 4, 4, 12])\n hexadecimals = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\n uuid = ''\n counter = 0\n\n sequences.each do |sequence|\n sequence.times { uuid << hexadecimals.sample}\n\n counter += 1\n uuid << \"-\" unless counter >= sequences.length\n end\n\n uuid\nend",
"def generate_uuid\n hex = []\n (0..9).each { |i| hex << i.to_s }\n ('a'..'f').each { |l| hex << l }\n\n result = []\n sections = [8, 4, 4, 4, 12]\n\n sections.each do |num|\n num.times do \n result << hex[rand(16)]\n end\n result << '-'\n end\n\n result.join.chop\nend",
"def create_uuid\n hex = ('0'..'9').to_a + ('a'..'f').to_a\n uuid = ''\n sections = [8,4,4,4,12]\n sections.each_with_index do |section, index|\n section.times { uuid += hex.sample }\n uuid += '-' unless index == sections.size - 1\n end\n p uuid\nend",
"def build_UUID\n uuid = \"\"\n segment = \"\"\n character_set = ('a'..'f').to_a + (0..9).to_a\n\n sections = [8, 4, 4, 4, 12]\n uuid = sections.map do |section|\n segment = \"\"\n section.times do \n segment += character_set.sample.to_s \n end\n segment\n end.join('-')\nend",
"def return_uuid\n possible = []\n possible << ('a'..'f').to_a\n possible << ('0'..'9').to_a\n possible.flatten!\n uuid = ''\n\n sample = [8, 4, 4, 4, 12]\n\n sample.each_with_index do | value, index |\n value.times { uuid += possible.sample }\n uuid += '-' unless sample.size <= index + 1\n end\n\n uuid\nend",
"def make_uuid()\n hex_set = %w(a b c d e f 1 2 3 4 5 6 7 8 9)\n uuid_string = ''\n counter = 1 \n 5.times do\n case counter\n when 1\n hex = 8\n when (2..4)\n hex = 4\n when 5\n hex = 12\n end \n hex.times { uuid_string << hex_set[rand(hex_set.size)] } \n uuid_string << '-' unless counter == 5\n counter += 1\n end\n uuid_string\nend",
"def another_generate_uuid\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |letter| characters << letter }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n uuid\nend",
"def uuid()\n 8.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 4.times.map { [*'0'..'9', *'a'..'f'].sample }.join + \"-\" + \\\n 12.times.map { [*'0'..'9', *'a'..'f'].sample }.join\nend",
"def uuid\n chars = ('a'..'z').to_a + (1..9).to_a\n p \"#{chars.sample(8).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(4).join}-#{chars.sample(12).join}\" \n \nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = []\n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def generate_UUID\n characters = [] \n (0..9).each { |digit| characters << digit.to_s }\n ('a'..'f').each { |digit| characters << digit }\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times { uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def create_uuid\n hex = (\"a\"..\"f\").to_a\n (0..9).each{|num| hex << num.to_s}\n \n uuid = \"\"\n uuid_format = [8,4,4,4,12]\n uuid_format.each do |num|\n num.times{ uuid += hex.sample}\n uuid += \"-\" if uuid.length < 36\n end\n uuid\nend",
"def uuid\n group_1 = 8.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"0a580bd3\"\n group_2 = 4.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"ad8e\"\n group_3 = 4.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"4aa1\"\n group_4 = 4.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"b825\"\n group_5 = 12.times.with_object(\"\") { |_, string| string << HEXADEMICAL.sample } # => \"6442e98450ac\"\n\n \"#{group_1}-#{group_2}-#{group_3}_#{group_4}-#{group_5}\" # => \"0a580bd3-ad8e-4aa1_b825-6442e98450ac\"\nend",
"def uuid_gen()\nslot_one = []\nslot_two = []\nslot_three = []\nslot_four = []\nslot_five = []\n counter_one = 0\n counter_two=0\n counter_three=0\n counter_four=0\n counter_five=0\n while counter_one < 8 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_one << val[rand(val.length)]\n counter_one += 1\n end\n while counter_two < 4 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_two << val[rand(val.length)]\n counter_two += 1\n end\n while counter_three < 4 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_three << val[rand(val.length)]\n counter_three += 1\n end\n while counter_four < 4 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_four << val[rand(val.length)]\n counter_four += 1\n end\n while counter_five < 12 do\n val = [('a'..'z'),(0..9)].map{|i| i.to_a}.join\n slot_five << val[rand(val.length)]\n counter_five += 1\n end\n return \"#{slot_one.join}-#{slot_two.join}-#{slot_three.join}-#{slot_four.join}-#{slot_five.join}\"\nend",
"def generate_UUID\n characters = [] # => []\n (0..9).each { |number| characters << number.to_s } # => 0..9\n ('a'..'f').each { |letter| characters << letter } # => \"a\"..\"f\"\n\n uuid = \"\" # => \"\"\n sections = [8, 4, 4, 4, 12] # => [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index| # => [8, 4, 4, 4, 12]\n section.times { uuid += characters.sample } # => 8, 4, 4, 4, 12\n uuid += '-' unless index >= sections.size - 1 # => \"98a0df48-\", \"98a0df48-5f8a-\", \"98a0df48-5f8a-aa68-\", \"98a0df48-5f8a-aa68-2057-\", nil\n end # => [8, 4, 4, 4, 12]\n\n uuid # => \"98a0df48-5f8a-aa68-2057-7dbc6e43c04e\"\nend",
"def create_uuid()\n possibles = ('a'..'z').to_a.concat((1..9).to_a)\n portions = [8, 4, 4, 4, 12]\n\n uuid = portions.map do |portion|\n uuid_string = ''\n portion.times { uuid_string += possibles.sample.to_s }\n uuid_string\n end\n\n uuid.join('-')\nend",
"def create_uuid\n characters = [*'a'..'f', *'0'..'9']\n \"#{characters.sample(8).join}-#{characters.sample(4).join}-#{characters.sample(4).join}-#{characters.sample(4).join}-#{characters.sample(12).join}\"\nend",
"def uuid\n hex = ((0..15).to_a).zip((('0'..'9').to_a).concat(('a'..'f').to_a)).to_h\n result = \"\"\n 32.times do\n result << hex[rand(0..15)]\n end\n result.insert(8, '-')\n result.insert(13, '-')\n result.insert(18, '-')\n result.insert(23, '-')\n result\nend",
"def new_uuid\n uuid_arr = []\n ('a'..'f').each {|char| uuid_arr << char}\n (0..9).each {|num| uuid_arr << num.to_s}\n\n uuid = \" \"\n uuid_arr.sample\n\nend",
"def uuid\n buffer = canonicalize_uuid random_bytes(16).bytes\n hex = buffer.map { |b| format('%02x', b) }.join\n [0..7, 8..11, 12..15, 16..19, 20..31].map { |r| hex[r] }.join('-')\n end",
"def generate_uuid\n hexadecimals = ('0'..'9').to_a.concat(('a'..'f').to_a)\n uuid = ''\n\n 32.times do\n uuid += hexadecimals.sample\n end\n uuid.insert(8, '-').insert(13, '-').insert(18, '-').insert(23, '-')\nend",
"def generate_UUID\n characters = []\n (0..9).each{ | digit | characters << digit.to_s}\n ('a'..'f').each{ | digit | characters << digit}\n\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times{ uuid += characters.sample }\n uuid += '-' unless index >= sections.size - 1\n end\n\n return uuid\n end",
"def gen_uuid\n arr = [('a'..'f'), (0..9)].map{|i| i.to_a}.flatten\n uuid = \"\"\n 8.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"\n 3.times {4.times {uuid << arr[rand(16)].to_s} ; uuid << \"-\"}\n 12.times {uuid << arr[rand(16)].to_s}\n uuid\nend",
"def format_uuid(raw)\n raise \"Uuid must be 10 digits\" unless 10 == raw.length\n \n \"#{raw[0..2]}-#{raw[3..5]}-#{raw[6..9]}\"\n end",
"def generate_UUID_1\n uuid = ''\n hex_index = (0..15)\n hex_values = ('0'..'9').to_a + ('a'..'f').to_a\n\n (0..8).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..4).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..4).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid << '-'\n (0..12).each do |num|\n uuid << hex_values[rand(hex_index)]\n end\n uuid\nend",
"def create_uuid\n options = ('a'..'f').to_a + (0..9).to_a\n uuid = \"\"\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do |section, index|\n section.times {uuid += options.sample.to_s}\n uuid += '-' unless index >= sections.size - 1\n end\n\n uuid\nend",
"def uuid_generator\n character_set = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)\n\n uuid = ''\n\n [8, 4, 4, 4, 12].each do |num|\n num.times { uuid << character_set.sample }\n uuid << '-' if num != 12\n end\n\n uuid\nend",
"def generate_uuid_for_string(string)\n ary = Digest::SHA256.hexdigest(string).unpack(\"NnnnnN\")\n ary[2] = (ary[2] & 0x0fff) | 0x4000\n ary[3] = (ary[3] & 0x3fff) | 0x8000\n sprintf \"%08x-%04x-%04x-%04x-%04x%08x\", *ary\n end",
"def short_uuid\n uuid[0..7]\n end",
"def generate_uuid\n characters = []\n ('a'..'z').each { |letter| characters << letter}\n (0..9).each { |integer| characters << integer}\n sections = [8, 4, 4, 4, 12]\n uuid = []\n sections.each do |digit_quantity|\n uuid << characters.flatten.sample(digit_quantity).join\n end\n uuid.join('-')\nend",
"def generate_UUID\n # build hex string to randomly pick from:\n uuid = \"\"\n hex_array = []\n (0..9).each { |num| hex_array << num.to_s }\n ('a'..'f').each { |char| hex_array << char }\n\n sections = [8, 4, 4, 4, 12]\n sections.each_with_index do | section, index|\n section.times { uuid << hex_array.sample }\n uuid << '-' unless index >= sections.size-1\n end\n uuid\nend",
"def make_uuid()\n uuid = \"\"\n 8.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n 3.times do\n 4.times { uuid << rand(16).to_s(16) }\n uuid << \"-\"\n end\n 12.times { uuid << rand(16).to_s(16) }\n \n uuid\nend",
"def rand_uuid\n values = [\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x1000000),\n rand(0x1000000),\n ]\n \"%04x%04x%04x%04x%04x%06x%06x\" % values\n end",
"def rand_uuid\n values = [\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x1000000),\n rand(0x1000000),\n ]\n \"%04x%04x%04x%04x%04x%06x%06x\" % values\n end",
"def rand_uuid\n values = [\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x0010000),\n rand(0x1000000),\n rand(0x1000000),\n ]\n \"%04x%04x%04x%04x%04x%06x%06x\" % values\n end",
"def uuid_generator\n uuid = []\n \n segments = [8, 4, 4, 4, 12]\n segments.each do |num|\n uuid << CHARS.sample(num).join\n end \n \n p uuid.join('-')\nend",
"def uuid?(str)\n !!(str && str.size == 36 && str.match(/\\A\\h{8}-\\h{4}-\\h{4}-\\h{4}-\\h{12}\\z/))\n end",
"def olduuid uuid\n\trf = uuid\n\trf.insert(8, \"-\")\n\trf.insert(13, \"-\")\n\trf.insert(18, \"-\")\n\trf.insert(23, \"-\")\n\treturn rf\nend",
"def from_uuid_old_to_csharp_legacy_uuid(hex)\n hex.sub(/\\A(..)(..)(..)(..)(..)(..)(..)(..)(.{16})\\z/, '\\4\\3\\2\\1\\6\\5\\8\\7\\9')\n end",
"def uuid_format?(str)\n return false unless 36 == str.length\n UUID_REGEX === str\n end",
"def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\nend",
"def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\nend",
"def gen_small_uuid()\n %x[/usr/bin/uuidgen].gsub('-', '').strip\n end",
"def gen_small_uuid\n %x[/usr/bin/uuidgen].gsub('-', '').strip\n end",
"def short_uuid\n rand(36**8).to_s(36)\n end",
"def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end",
"def normalize_uuid(key)\n norm_key = key.downcase.gsub(/[-\\s]/, '')\n if 10 == norm_key.length\n \"#{norm_key[0..2]}-#{norm_key[3..5]}-#{norm_key[6..9]}\"\n else\n key\n end\n end",
"def parse_uuids(raw_dwarfdump)\n lines = raw_dwarfdump.split(\"\\n\")\n uuids = lines.map { |line| line[/^UUID: ([A-Z0-9\\-]+)\\s+\\(.*$/, 1] }\n uuids.compact\n end",
"def uuid length = 100\n key = keys.sample\n word = \"\"\n\n result = length.times.map do\n word = self[key].sample rescue nil\n key = new_key key, word\n word\n end.compact\n\n format result\n end",
"def valid_undashed_uuid?(value)\n value =~ /\\A[[:xdigit:]]{32}\\z/\n end",
"def frac2uuid frac\n val = (\"%030x\" % (0xffffffffffffffffffffffffffffffff * frac).to_i).chars\n \"00000000-00\\x0100-00\\x0200-0000-000000000000\".chars.map{|c|\n c != '0' ? c : val.shift\n }.join\nend",
"def UUID()\n uuid=SecureRandom.base64(32).gsub(\"/\",\"_\").gsub(/=+$/,\"\")\n end",
"def slug_candidates\n SecureRandom.uuid\n end",
"def to_formatted_uuid\n if size == 16 \n FAST_UUID.uuid_to_formatted(self)\n else\n self.freeze \n end \n end",
"def valid_uuid_format?(uuid)\n !!(uuid =~ /^[A-Za-z0-9_\\-]{16,}$/)\n end",
"def generate_uuid \n uuid_array = Array.new \n uuid_array << Array.new(8){rand(36).to_s(36)}.join\n 3.times do \n uuid_array << Array.new(4){rand(36).to_s(36)}.join\n end \n uuid_array << Array.new(12){rand(36).to_s(36)}.join\nputs uuid_array.join('-')\nend",
"def identifier\n SecureRandom.hex(16)\n end",
"def to_formatted_uuid\n size == 16 ? ::UUID.parse_raw(self).to_s : self.freeze\n end",
"def initialize(bytes = nil)\n if bytes.nil? then\n @bytes = Keybox::RandomDevice.random_bytes(16)\n elsif bytes.size == 36 and bytes.split(\"-\").size == 5 then\n if bytes =~ REGEX then\n # remove the dashes and make sure that we're all\n # lowercase\n b = bytes.gsub(/-/,'').downcase\n\n # convert to an array of hex strings\n b = b.unpack(\"a2\"*16)\n\n # convert the hex strings to integers\n b.collect! { |x| x.to_i(16) }\n\n # and pack those integers into a string\n @bytes = b.pack(\"C*\")\n\n # of course this could all be done in one line with\n # @bytes = bytes.gsub(/-/,'').downcase.unpack(\"a2\"*16\").collect {|x| x.to_i(16) }.pack(\"C*\")\n else\n raise ArgumentError, \"[#{bytes}] is not a hex encoded UUID\"\n end\n elsif bytes.kind_of?(String) and bytes.length >= 16\n @bytes = bytes[0..16]\n else\n raise ArgumentError, \"[#{bytes}] cannot be converted to a UUID\"\n end\n\n end",
"def rand_uuid\n [8,4,4,4,12].map {|n| rand_hex_3(n)}.join('-').to_s\n end",
"def uuid(s, path=nil)\n size = 0\n if path\n size = File.size(path)\n s = s + ':' + size.to_s if size > 0\n end\n Digest::SHA1.hexdigest(s)[0, 32]\nend",
"def uuid; end",
"def uuid; end",
"def from_uuid_old_to_java_legacy_uuid(hex)\n hex.sub(/\\A(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)(..)\\z/) do\n (::Regexp.last_match[1..8].reverse + ::Regexp.last_match[9..16].reverse).join\n end\n end",
"def generate_uuid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n self.uuid = (0..UUID_LEN-1).collect { chars[Kernel.rand(chars.length)] }.join\n end",
"def convert_uuid!(comment=nil)\n v = get(16).bytes.map{|x| \"%02x\" % x}\n vv = [\n v[0,4].join,\n v[4,2].join,\n v[6,2].join,\n v[8,2].join,\n v[10,6].join,\n ].join(\"-\")\n out_with_comment! \"<uuid>#{vv}</uuid>\", comment\n end",
"def uuid\n time = Time.now.to_i.to_s(16)\n second = rand(10000..99999).to_s(16)\n third = rand(10000..99999).to_s(16)\n fourth = rand(10000..99999).to_s(16)\n fifth = rand(10000000000000..99999999999999).to_s(16)\n\n \"#{time}-#{second}-#{third}-#{fourth}-#{fifth}\"\nend",
"def add_dashes(uuid)\n return uuid if uuid =~ /\\-/\n [uuid[0..7], uuid[8..11], uuid[12..15], uuid[16..19], uuid[20..-1]].join(\"-\")\n end",
"def assign_uid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n uid = ''\n 1.upto(8) {\n i = rand(62)\n uid += chars[i]\n }\n self.uid = uid\n end",
"def uuid?(uuid)\n uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/\n uuid_regex.match?(uuid.to_s.downcase)\nend",
"def gen_uuid\n `uuidgen -t`.chomp.delete('-')\nend",
"def uuid\n SecureRandom.uuid\nend",
"def unique_id(len = 8)\n @uniq_id_disallowed ||= /[^abcdefhjkmnpqrtvwxyzABCDEFGHJKMNPQRTVWXY2346789]/\n candidate = SecureRandom.urlsafe_base64((len * 2.1).ceil).gsub(@uniq_id_disallowed, '')\n fail RangeError if candidate.size < len\n\n candidate[0...len]\n rescue RangeError\n retry\n end",
"def id_me_user_uuid\n if user_uuid && !user_uuid.length.in?([20, 21, 22, 23, 32])\n errors.add(:user_uuid, \"(#{user_uuid}) is not a proper length\")\n end\n end",
"def uuid() = @uuid ||= SecureRandom.uuid",
"def generate_uuid\n\t\t\t\tSecureRandom.hex(5)\n\t\t\tend",
"def is_uuid?(uuid)\n uuid =~ /[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}/i\n end",
"def hash #:nodoc:\n uuid.hash\n end",
"def create_uuid\n self.uuid = SecureRandom.hex(12)\n end",
"def generate_uid(io)\n SecureRandom.hex(30)\n end",
"def unique_id(slug)\n Zlib.crc32 slug\n end",
"def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end",
"def random_uid\n SecureRandom.hex 5\n end",
"def password\n Digest::MD5.hexdigest(uuid)[0..9]\n end"
] | [
"0.7799495",
"0.7649068",
"0.7612097",
"0.7478002",
"0.7441284",
"0.7414751",
"0.7398642",
"0.7385393",
"0.7306251",
"0.72930104",
"0.7287261",
"0.72737557",
"0.7272527",
"0.7268871",
"0.72629714",
"0.7260032",
"0.7249609",
"0.72369576",
"0.72293633",
"0.721839",
"0.7216759",
"0.7208683",
"0.7205823",
"0.7205823",
"0.7205823",
"0.7205823",
"0.71993506",
"0.71897876",
"0.71853375",
"0.7150866",
"0.7148388",
"0.71418184",
"0.71162707",
"0.71086764",
"0.7085662",
"0.70797145",
"0.7062409",
"0.70530856",
"0.699251",
"0.69513327",
"0.69488406",
"0.6942328",
"0.69411176",
"0.6936382",
"0.6933598",
"0.6876559",
"0.68569523",
"0.68539226",
"0.682141",
"0.682141",
"0.682141",
"0.68117535",
"0.67995274",
"0.67666274",
"0.67242265",
"0.6698662",
"0.6671598",
"0.6671598",
"0.66621155",
"0.66553587",
"0.6633226",
"0.6626895",
"0.66268724",
"0.660947",
"0.6596178",
"0.65856344",
"0.6551723",
"0.6547401",
"0.6530056",
"0.6500221",
"0.64939606",
"0.6447661",
"0.64468443",
"0.6445851",
"0.63894993",
"0.6386989",
"0.63351804",
"0.6333391",
"0.6333391",
"0.6332137",
"0.63207227",
"0.6302657",
"0.6301499",
"0.6275835",
"0.62527585",
"0.6234241",
"0.6222137",
"0.61825",
"0.6170851",
"0.615643",
"0.6152554",
"0.61484534",
"0.61402875",
"0.6132633",
"0.61324567",
"0.61184156",
"0.6116687",
"0.61161697",
"0.60696685",
"0.6047315"
] | 0.7324725 | 8 |
run state to perform validations for | def aasm_states_to_check
started? || aasm_event == 'start' || ignore_states
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_validations\n true\n end",
"def validate!\n # pass\n end",
"def validate\n \n \n end",
"def validate\r\n\r\n end",
"def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end",
"def do_validation \n return true if self.ok\n set_ok\n self.ok\n end",
"def valid; end",
"def run_validation(vmode)\n validate(vmode)\n self\n end",
"def eval_custom_validator_block(state, original_state = nil)\n yield(state, original_state)\n invalid!(state) if state.errors.present?\n state\n end",
"def validate\n end",
"def eval_validation_directives_block(state, &block)\n # each validate block should be a \"fresh start\" and not interfere with the\n # previous blocks\n state.singleton_class.clear_validators!\n state.singleton_class.class_eval(&block)\n\n state.validate || invalid!(state)\n state\n end",
"def validate\r\n @invalid=false\r\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate\n self._errors = {}\n self.run_hook :validate\n not self.errors?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_states!\n self.class.state_managers.each do |name, klass|\n # Simply ensuring that all of the state managers have been\n # instantiated will make the corresponding states valid\n unless state_managers[name]\n state_managers[name] = klass.new(self)\n end\n end\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n @invalid=false\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_state(state = {}); end",
"def validate_state(state = {}); end",
"def validate\n raise RuntimeError.new( 'only terminated workflows can be validated' ) unless @terminated\n @validation_errors = 0\n puts\n puts \"Start Validation of WorkFlow '#{ label }\"\n validate_workflow\n validate_reachability\n puts \"Validation of WorkFlow '#{ label }' #{\n @validation_errors > 0 ? 'FAILED' : 'successfully completed' }.\"\n puts\n end",
"def run_validations(context)\n __run_validations__(context)\n end",
"def validation; end",
"def validation; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\r\n validate! rescue false\r\n end",
"def run_validations!\n run_callbacks(:validation) do\n super\n end\n end",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def verify(state) ; end",
"def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end",
"def validate\n\n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def validate\n original_status = self.validation_status\n self.transaction do\n self.validation_status = :validating\n self.validation.clear_errors\n bagit = BagIt::Bag.new(self.path)\n unless bagit.complete? and bagit.consistent?\n self.validation.be_invalid_with_errors(bagit.errors)\n return\n end\n self.validation_status = :valid\n end\n rescue Exception\n self.validation_status = original_status\n raise\n end",
"def perform\n\n r = validate\n return r unless r.success?\n\n process_hook\n\n end",
"def validated; end",
"def run!\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n end",
"def with_validations(state = true)\n @validations = state\n @connection.offline_db(@db_name)\n @connection.set_db_options(@db_name, \"icv.enabled\" => @validations)\n @connection.online_db(@db_name, 'WAIT')\n\n self\n end",
"def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n valid?\n end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def validate\n # add errors if not validate\n end",
"def validates?\n reset\n @passed = catch :validation_done do\n validate\n pass\n end\n end",
"def _always_valid!\n @always_valid = true\n self\n end",
"def set_accounting_validation_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"def validate\n errors.clear\n self.class.validator.invoke self\n end",
"def validate!\n\t\t\t\treturn true\n\t\t\tend",
"def doValidation\r\n\t\tprepare if ! @machine\r\n\t\ti = 0 \r\n\t\twhile i < @trainTestStruct.testSetCount\r\n\t\t\ttrainTestDataSplit = getTargets @trainTestStruct.testSets(i)\r\n\t\t\t@trainTestStruct.pushResult @machine.validateSet(trainTestDataSplit.first, trainTestDataSplit.last, @predictionType)\r\n\t\t\ti += 1\r\n\t\tend\r\n\tend",
"def validate!\n true\n end",
"def check_validity!\n # nothing\n end",
"def validate_state\n errors.add(:state, \"must be yes, no or don't care\") unless state_changed? and %w(yes no dont_care).include? changes['state'][1]\n end",
"def valid\n @valid\n end",
"def valid?\n validate\n end",
"def accounting_validation_state\n super\n end",
"def is_valid; end",
"def check\n \n end",
"def check\n \n end",
"def validate_settings\n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Group name is blank\", :created_user => self.created_user) if self.group_name.blank?\n @s.push self.dataerrors.build(:message => \"Office phone number is required\", :created_user => self.created_user) if self.office_phone.blank?\n @s.push self.dataerrors.build(:message => \"EIN number is required\", :created_user => self.created_user) if self.ein_number.blank?\n @s.push self.dataerrors.build(:message => \"NPI is required for group\", :created_user => self.created_user) if self.npi.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_billings.each { |billing| billing.validate_claim }\n #self.balance_bills.each { |balance| balance.validate_balance_bill }\n end\n return @state\n end",
"def validate!\n ensure_valid_tick\n end",
"def validate_around\n validate_down\n validate_up\n end",
"def validate_data\n @state = true\n #store the original error count, if there is a chnage to the count, then we want to update all associated insurance_billings and balance_bills\n @original_count = self.dataerrors.count\n #first remove any old errors from the table\n self.dataerrors.clear\n\n @s = []\n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n @s.push self.dataerrors.build(:message => \"Provider first name is blank\", :created_user => self.created_user) if self.first_name.blank?\n @s.push self.dataerrors.build(:message => \"Provider last name is blank\", :created_user => self.created_user) if self.last_name.blank?\n @s.push self.dataerrors.build(:message => \"Provider NPI is required\", :created_user => self.created_user) if self.npi.blank?\n #either the ein or ssn is required\n @s.push self.dataerrors.build(:message => \"EIN or SSN is required\", :created_user => self.created_user) if self.ssn_number.blank? && self.ein_number.blank?\n @s.push self.dataerrors.build(:message => \"Office phone is required\", :created_user => self.created_user) if self.office_phone.blank?\n\n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s)\n @state = false\n end\n #if the error counts changed, then update all insurance_bill & balance bills\n if @original_count != @s.count\n self.insurance_billings.each { |billing| billing.validate_claim }\n # need to rethink the validate\n # self.balance_bill_sessions.each { |balance| balance.validate_balance_bill }\n end\n return @state\n end",
"def run\n @state.run(self)\n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def validate\n show\n return\n\n # Check the variables:\n steps = []\n variables = all_variable.sort_by{|var| var.ordinal}\n variables.each_with_index do |variable, i|\n raise \"Variable #{i} should have ordinal #{variable.ordinal}\" unless variable.ordinal == i\n raise \"Variable #{i} has missing object_type\" unless variable.object_type\n variable.all_play do |play|\n raise \"Variable for #{object_type.name} includes role played by #{play.object_type.name}\" unless play.object_type == object_type\n end\n steps += variable.all_step\n end\n steps.uniq!\n\n # Check the steps:\n steps.each do |step|\n raise \"Step has missing fact type\" unless step.fact_type\n raise \"Step has missing input node\" unless step.input_play\n raise \"Step has missing output node\" unless step.output_play\n if (role = input_play).role.fact_type != fact_type or\n (role = output_play).role.fact_type != fact_type\n raise \"Step has role #{role.describe} which doesn't belong to the fact type '#{fact_type.default_reading}' it traverses\"\n end\n end\n\n # REVISIT: Do a connectivity check\n end",
"def validated?; end",
"def set_validate_checksum_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"def test_invalid_state\n owner = people(:valid_person)\n rule = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"aaaactive\",\n :logic=>\"and\")\n assert !rule.valid?\n # The state field should have validation errors\n assert rule.errors[:state].any?\n end",
"def validate\n validate_summary\n validate_duration\n validate_kind\n validate_state\n validate_created_at\n\n super\n end",
"def pre_validation\n\n\n end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def valid?\n return validate\n end",
"def valid?\n run_validation\n @errors.empty?\n end",
"def validate_event; end",
"def validate!\n return @valid if !@valid.nil? # only need to run this once per config\n\n # ensure all user and plugin configs/settings are applied\n self.init_procs.each(&:call)\n [:name, :ip, :port].each do |a|\n if self.send(a).nil?\n raise InvalidError, \"a name, ip and port must be configured\"\n end\n end\n\n # validate the worker class\n if !self.worker_class.kind_of?(Class) || !self.worker_class.include?(Sanford::Worker)\n raise InvalidError, \"worker class must include `#{Sanford::Worker}`\"\n end\n\n # validate the router\n self.router.validate!\n\n @valid = true # if it made it this far, it's valid!\n end",
"def validate\n true\n end",
"def valid?\n end"
] | [
"0.6959219",
"0.6887224",
"0.68273747",
"0.6814786",
"0.68040824",
"0.67583615",
"0.6722753",
"0.6713828",
"0.668381",
"0.66754466",
"0.6671527",
"0.66414136",
"0.66309375",
"0.66309375",
"0.66309375",
"0.6621335",
"0.66170293",
"0.6614299",
"0.66137165",
"0.660946",
"0.660946",
"0.6600882",
"0.660033",
"0.6595999",
"0.6590334",
"0.6590334",
"0.6590334",
"0.6590334",
"0.657648",
"0.65395916",
"0.6525748",
"0.6508468",
"0.6508468",
"0.64750135",
"0.6468451",
"0.6460049",
"0.6460049",
"0.6432076",
"0.641396",
"0.6413222",
"0.6394738",
"0.63660324",
"0.63660324",
"0.63660324",
"0.63484436",
"0.6327338",
"0.6315315",
"0.62926584",
"0.62926584",
"0.62926584",
"0.62926584",
"0.62926584",
"0.62858236",
"0.6284958",
"0.6281921",
"0.62610495",
"0.62573254",
"0.6226391",
"0.62252456",
"0.62252456",
"0.62252456",
"0.62216353",
"0.62196726",
"0.6218276",
"0.6214117",
"0.6214082",
"0.61961204",
"0.6159027",
"0.6158364",
"0.6136251",
"0.6134166",
"0.6130318",
"0.6080618",
"0.60779655",
"0.60640913",
"0.6056094",
"0.60491616",
"0.60420257",
"0.60420257",
"0.6019064",
"0.60153395",
"0.601396",
"0.600271",
"0.5997703",
"0.5991298",
"0.59912676",
"0.59912676",
"0.59837586",
"0.59710246",
"0.5947127",
"0.5935432",
"0.5915605",
"0.58951557",
"0.5894673",
"0.5894673",
"0.5891953",
"0.58756673",
"0.5869733",
"0.5864196",
"0.5854703",
"0.5853997"
] | 0.0 | -1 |
it can start if all requests are valid | def validate_can_start
if aasm_states_to_check
cannot_start! if requests_have_notices?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_requests\n if requests.empty?\n errors.add('requests', 'there were no requests')\n return\n end\n\n requests.each do |request|\n next if request.valid?\n\n request.errors.each do |k, v|\n errors.add(k, v)\n end\n end\n end",
"def start_accepting_requests\n\t\tself.log.info \"Starting the request loop.\"\n\t\tself.reactor.start_polling( ignore_interrupts: true )\n\tend",
"def requests?\n return requests.any?\n end",
"def consider_all_requests_local; end",
"def consider_all_requests_local; end",
"def request_until_valid\n wait = Wait.new(attempts: 10, delay: 5)\n\n wait.until do\n response = request\n valid?(response) ? response : next\n end\n end",
"def each_request(options = {}, &block) # :yields: request\n return true\n end",
"def wait_for_sinatra_to_startup!\n 10.times do\n Net::HTTP.get(URI.parse(\"http://#{@host}:#{@port}/up_and_running\"))\n return\n rescue Errno::ECONNREFUSED => e # rubocop:todo Lint/UselessAssignment\n sleep(1)\n end\n\n raise StandardError, \"Our dummy webservice did not start up in time!\"\n end",
"def start\n prepare_parser\n perform_request\n end",
"def hasRequest?\n !requests.empty?\n end",
"def start_accepting_requests\n\t\tself.start_heartbeat\n\t\tsuper\n\tend",
"def start\n true\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"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\t@request.join if @request.alive?\n\t\t@response.join if @response.alive?\n\tend",
"def can_start?\n true\n end",
"def validate!\n Server.config.validate!\n Server.config.workers.each { |w| w.validate! }\n end",
"def validrequest?(req)\n @stats.validated\n return true\n end",
"def consider_all_requests_local=(_arg0); end",
"def consider_all_requests_local=(_arg0); end",
"def masterrun\n self.workersrun \n self.serverrun \n end",
"def run_all\n true\n end",
"def run_all\n true\n end",
"def run_all\n true\n end",
"def run_all\n true\n end",
"def retriable_requests\n requests.select do |request|\n response = response_for(request)\n !response || response.retriable?\n end\n end",
"def wait_to_startup\n begin\n Timeout.timeout(5) do\n loop do\n begin\n sleep 1; Net::HTTP.new(@host, @port).head(\"/\"); return true\n rescue Errno::ECONNREFUSED; end\n end\n end\n rescue Timeout::Error\n l \"Error\", \"failed to start benchmark script\"; return false\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 #@sock=@server.accept_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",
"def start\n run_all if @options[:all_on_start]\n end",
"def start\n run_all if options[:all_on_start]\n end",
"def start\n run_all if options[:all_on_start]\n end",
"def start\n run_all if options[:all_on_start]\n end",
"def working?\n return true if @httpserv and @httpserv.working_count > 0\n return false\n end",
"def set_request_start\n # byepassing to active admin's own\n # authentication process\n return true if request_from_admin?\n\n super\n end",
"def check_request(svc,request)\n request_state=request.request_state.downcase\n request.miq_request_tasks.each do |task|\n $evm.log(:info,\"CC- checking #{task.destination}\")\n unless task.destination.nil?\n if (task.destination_type.downcase rescue nil)==\"service\"\n $evm.log(:info,\"CC- setting parent for #{task.destination.name} to #{svc.name}\")\n task.destination.parent_service=svc\n task.destination.display=true\n end\n end\n end\n \n case request_state\n when \"error\"\n $evm.log(:info,\"CC- Ressource is in ERROR state\")\n $evm.root['ae_result']=\"error\"\n when \"finished\"\n if request.status.downcase==\"error\"\n then\n $evm.log(:info,\"CC- Ressource is finished with ERROR. Exiting\")\n $evm.root['ae_result']=\"error\"\n else\n $evm.log(:info,\"CC- Ressource is provisionned. Exiting\")\n $evm.root['ae_result']=\"ok\"\n end\n else\n $evm.log(:info,\"CC- Ressource is in #{request_state} state...retying\")\n $evm.root['ae_result']=\"retry\"\n $evm.root[\"ae_retry_interval\"]=\"10.seconds\"\n end\nend",
"def start\n run_all if options[:all_on_start]\n end",
"def start\n return if @started\n @started = true\n end",
"def start_api_services()\n # ejabberd uses uaserver for authentication\n # so start it after we find out the uaserver's ip\n threads = []\n if my_node.is_login?\n threads << Thread.new {\n start_ejabberd()\n }\n end\n\n @done_initializing = true\n\n # start zookeeper\n threads << Thread.new {\n if my_node.is_zookeeper?\n configure_zookeeper(@nodes, @my_index)\n start_zookeeper\n end\n\n ZKInterface.init(my_node, @nodes)\n }\n\n if my_node.is_memcache?\n threads << Thread.new {\n start_memcache()\n }\n end\n\n if my_node.is_db_master?\n threads << Thread.new {\n start_db_master()\n # create initial tables\n if my_node.is_db_master?\n prime_database\n end\n\n # Always colocate the Datastore Server and UserAppServer (soap_server).\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip, UserAppClient::SERVER_PORT)\n end\n\n # If we're starting AppScale with data from a previous deployment, we\n # may have to clear out all the registered app instances from the\n # UserAppServer (since nobody is currently hosting any apps).\n if not @creds['clear_datastore']\n erase_app_instance_info\n end\n }\n end\n\n if my_node.is_db_slave?\n threads << Thread.new {\n start_db_slave()\n\n # Currently we always run the Datastore Server and SOAP\n # server on the same nodes.\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip,\n UserAppClient::SERVER_PORT)\n end\n }\n end\n\n # All nodes have application managers\n threads << Thread.new {\n start_app_manager_server()\n }\n\n if my_node.is_appengine?\n threads << Thread.new {\n start_blobstore_server()\n }\n end\n\n if my_node.is_taskqueue_master?\n threads << Thread.new {\n start_taskqueue_master()\n }\n elsif my_node.is_taskqueue_slave?\n threads << Thread.new {\n start_taskqueue_slave()\n }\n end\n\n # App Engine apps rely on the above services to be started, so\n # join all our threads here\n Djinn.log_info(\"Waiting for all services to finish starting up\")\n threads.each { |t| t.join() }\n Djinn.log_info(\"API services have started on this node\")\n\n end",
"def start?\r\n start\r\n end",
"def run_check\n check_for_default_routes\n check_for_action_globs\n check_for_cve_2014_0130\n end",
"def process_request(request, response)\n apps.each do |app|\n app.call(:request => request, \n :response => response, \n :settings => settings,\n :logger => logger)\n end\n\n return true\n rescue StandardError => e\n if settings.service.raise_exceptions\n raise\n else\n logger.info(\"APP ERROR\") { e.inspect }\n logger.debug(\"APP ERROR\") { \"#{e.inspect}\\n\" + e.backtrace.join(\"\\n \") }\n\n return false\n end\n end",
"def outlet\n loop do\n http = Net::HTTP.new(@logplex_url.host, @logplex_url.port)\n http.set_debug_output($stdout) if ENV['DEBUG']\n http.use_ssl = true if @logplex_url.scheme == 'https'\n begin\n http.start do |conn|\n num_reqs = 0\n while num_reqs < @max_reqs_per_conn\n #Blocks waiting for a request.\n req = @request_queue.deq\n @req_in_flight += 1\n resp = nil\n begin\n Timeout::timeout(@conn_timeout) {resp = conn.request(req)}\n rescue => e\n $stdout.puts(\"at=req-error msg=#{e.message}\") if ENV['DEBUG']\n next\n ensure\n @req_in_flight -= 1\n end\n num_reqs += 1\n $stdout.puts(\"at=req-sent status=#{resp.code}\") if ENV['DEBUG']\n end\n end\n rescue => e\n $stdout.puts(\"at=req-error msg=#{e.message}\") if ENV['DEBUG']\n ensure\n http.finish if http.started?\n end\n end\n end",
"def run\n retrys = 0\n uri = URI(request_string)\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 1\n http.read_timeout = 1\n puts 'about to send pdf request'\n puts uri.request_uri\n begin\n http.get(uri.request_uri)\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNREFUSED => e\n raise e if retrys > 3\n if retrys == 1\n puts 'restarting shrimp server'\n Shrimp.server.restart\n end\n retrys += 1\n retry\n end\n true\n end",
"def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end",
"def start()\n raise ValidateError.new(\"#{full_name} not validated.\") unless @prepared\n @tasks.each_value { |task| task.start() }\n end",
"def valid?\n @hydra.queue(request('verify'))\n end",
"def launch_all\n @servers.each { |s|\n begin\n obj_behavior(s, :start)\n rescue Exception => e\n raise e unless e.message =~ /AlreadyLaunchedError/\n end\n }\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 conditional_requests; end",
"def conditional_requests; end",
"def started?; end",
"def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend",
"def start\n\t\tend",
"def initialize\n EM.add_periodic_timer(5) {\n check_expired_resources\n }\n check_expired_resources\n end",
"def deliver_requests(conn)\n num_reqs = 0\n\n while num_reqs < @requests_per_conn\n if @request_queue.size > 0\n Timber::Config.instance.debug { \"Waiting on next request, threads waiting: #{@request_queue.size}\" }\n end\n\n request_attempt = @request_queue.deq\n\n if request_attempt.nil?\n sleep(1)\n else\n request_attempt.attempted!\n @requests_in_flight += 1\n\n begin\n resp = conn.request(request_attempt.request)\n rescue => e\n Timber::Config.instance.debug { \"#deliver_requests error: #{e.message}\" }\n\n # Throw the request back on the queue for a retry if it has been attempted less\n # than 3 times\n if request_attempt.attempts < 3\n Timber::Config.instance.debug { \"Request is being retried, #{request_attempt.attempts} previous attempts\" }\n @request_queue.enq(request_attempt)\n else\n Timber::Config.instance.debug { \"Request is being dropped, #{request_attempt.attempts} previous attempts\" }\n end\n\n return false\n ensure\n @requests_in_flight -= 1\n end\n\n num_reqs += 1\n\n @last_resp = resp\n\n Timber::Config.instance.debug do\n if resp.code == \"202\"\n \"Logs successfully sent! View your logs at https://app.timber.io\"\n else\n \"Log delivery failed! status: #{resp.code}, body: #{resp.body}\"\n end\n end\n end\n end\n\n true\n end",
"def request_valid?(data)\n ln = 0\n data.each_line {|l|\n ln += 1\n }\n if ln > 1\n return true\n else\n puts \"\\e[1;31mCatch GET's without header information / Other \\e[0m\\ \"\n return false # Due to single GET Requests to no headers \n end\n end",
"def is_requesting?\n @lock.synchronize { !@batch.empty? }\n end",
"def start!\n http_server.start\n self\n end",
"def perform\n validate_data_from_requests\n end",
"def check_all_servers\n @key = ENV['SECRET_KEY']\n Check.run\n render :layout => false\n end",
"def started; end",
"def failed_requests\n requests.select do |request|\n response = response_for(request)\n !response || !response.success?\n end\n end",
"def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end",
"def start \n @Done = false \n end",
"def server_found!\n @not_found = false\n @requests.keys.each do |request_id|\n msg, blk = @requests.delete request_id\n @client.aquire_connection.send_command(msg, request_id, &blk)\n end\n end",
"def ready?\n RestClient::Request.execute(:method => :get, :url => ready_path, :payload => {}, :timeout => TIMEOUT, :open_timeout => TIMEOUT) do |response, request, result|\n response.code == 200\n end \n rescue\n false\n end",
"def loadAll()\n # Load the configuration from global.rb\n SHAREDPOOLS.each_key do |k|\n p = Pool.new(k, SHAREDPOOLS[k][:zone],\n SHAREDPOOLS[k][:allocateable_cpus],\n SHAREDPOOLS[k][:allocateable_mem],\n SHAREDPOOLS[k][:service_class])\n\n @poolList.push(p)\n end\n SERVICES.each_key do |k|\n s = Service.new(k, SERVICES[k][:authinfo],\n SERVICES[k][:maxcpus],\n SERVICES[k][:maxmemory],\n SERVICES[k][:priority])\n @svcList.push(s)\n end\n # Load the requests from redis\n @reqList = $eventProcessor.loadRequests()\n # Compute the free/used stats from state of requests\n @reqList.each { |req|\n if req.status == \"ALLOCATED\"\n pmatches = @poolList.select {|p| p.name == req.pool}\n if pmatches == nil || pmatches[0] == nil\n $Logger.error \"Unable to find pool #{req.pool} for ALLOCATED request #{req.reqid}\"\n next\n end\n smatches = @svcList.select {|s| s.name == req.service}\n if smatches == nil || smatches[0] == nil\n $Logger.error \"Unable to find service #{req.service} for ALLOCATED request #{req.reqid}\"\n next\n end\n pool = pmatches[0]\n pool.availvcpus = pool.availvcpus.to_i - req.vcpus.to_i\n pool.availmem = pool.availmem.to_i - req.mem.to_i\n service = smatches[0]\n service.vcpusallocated = service.vcpusallocated.to_i + req.vcpus.to_i\n service.memallocated = service.memallocated.to_i + req.mem.to_i\n end\n }\n end",
"def valid?\n return false if @_403.nil?\n return false if @_404.nil?\n return false if @_500.nil?\n return false if @_504.nil?\n return false if @start_timestamp.nil?\n return false if @end_timestamp.nil?\n return false if @start_datetime.nil?\n return false if @end_datetime.nil?\n return false if @total_requests.nil?\n return false if @cache_hits.nil?\n return false if @cache_hit_rate.nil?\n return false if @total_request_time.nil?\n return false if @avg_origin_response_time.nil?\n return false if @response_time_ms.nil?\n return false if @_100_x.nil?\n return false if @_20_x.nil?\n return false if @_30_x.nil?\n return false if @_40_x.nil?\n return false if @_50_x.nil?\n return false if @_50th.nil?\n return false if @_95th.nil?\n return false if @_99th.nil?\n true\n end",
"def can_start?\n status.in? [Status::NOT_STARTED, Status::IN_PROGRESS]\n end",
"def relaunch?\n errors.present? && ![\n 400, # Bad Request\n 401, # Unauthorized\n 403, # Forbidden\n # 404, Not Found\n 414, # URI Too Long\n # 500 Internal Server Error\n ].include?(http_status)\n end",
"def init\n success = false\n begin\n success = setup_redis(@configuration.redis_url) && set_api_base_uri(@configuration.instance_url)\n rescue => e #debug the error\n puts e.to_s\n end\n return success\n end",
"def start()\n\n\t\tend",
"def start_url_redirect\n puts \">> start_url_redirect...\"\n # UrlVerifier.new.delay.vu_starter\n UrlVerifier.new.vu_starter\n end",
"def can_serve_request?(req)\n false\n end",
"def start\n lock.synchronize do\n return if started.value\n\n started.value = true\n workers[:maintenance] = Thread.new { loop { check_timeouts } }\n workers[:listener] = Thread.new { loop { listen } }\n end\n end",
"def start!\n @log = CreateTwitterUserLog.create_by(request: request)\n\n # Regardless of whether or not the TwitterUser record is created, the TwitterDB::User record is updated.\n CreateTwitterDBUserWorker.perform_async([request.uid], user_id: request.user_id, force_update: true, enqueued_by: 'CreateTwitterUserTask request.uid')\n\n @twitter_user = request.perform!\n request.finished!\n @log.update(status: true)\n\n ([@twitter_user.uid] + @twitter_user.friend_uids + @twitter_user.follower_uids).each_slice(100) do |uids|\n CreateTwitterDBUserWorker.perform_async(CreateTwitterDBUserWorker.compress(uids), user_id: request.user_id, compressed: true, enqueued_by: 'CreateTwitterUserTask friends and followers')\n end\n\n self\n rescue Twitter::Error::TooManyRequests => e\n @log.update(error_class: e.class, error_message: e.message)\n if request.user\n TooManyRequestsUsers.new.add(request.user.id)\n ResetTooManyRequestsWorker.perform_in(e.rate_limit.reset_in.to_i, request.user.id)\n end\n raise CreateTwitterUserRequest::TooManyRequests\n rescue => e\n @log.update(error_class: e.class, error_message: e.message)\n raise\n end",
"def ready?\n QA::Runtime::Logger.debug 'Checking Smocker readiness'\n get(\"#{admin_url}/version\")\n true\n # rescuing StandardError because RestClient::ExceptionWithResponse isn't propagating\n rescue StandardError => e\n QA::Runtime::Logger.debug \"Smocker not ready yet \\n #{e}\"\n false\n end",
"def launch_all\n @servers.each { |s|\n begin\n object_behavior(s, :start)\n rescue Exception => e\n raise e unless e.message =~ /AlreadyLaunchedError/\n end\n }\n end",
"def start\n\t\tinit\n\t end",
"def is_running?\n Faraday.get(@base_url + \"/\").status == 200\n end",
"def run\n super\n\n # Base checklist\n to_check = [\n { :path => \"crossdomain.xml\", :signature => \"<?xml\" },\n { :path => \"elmah.axd\", :signature => \"Error Log for\" },\n { :path => \"phpinfo.php\", :signature => \"phpinfo()\" },\n { :path => \"robots.txt\", :signature => \"user-agent:\" },\n { :path => \"sitemap.xml\", :signature => \"<?xml\" },\n { :path => \"sitemap.xml.gz\", :signature => \"<?xml\" },\n ]\n\n # Add in un-sig'd checks \n unsig_checks = IO.readlines(\"#{Rails.root}/data/web.list\")\n unsig_check_list = unsig_checks.map { |x| { :path => x.chomp, :signature => \"\" } } \n to_check += unsig_check_list\n\n test_url = \"#{@entity.name}/there-is-no-way-this-exists-#{rand(10000)}\"\n missing_page_content = open_uri_and_return_content(test_url, @task_logger)\n\n # Run through the checks\n to_check.each do |check|\n\n # Concat the uri to create the check\n url = \"#{@entity.name}/#{check[:path]}\"\n @task_logger.log \"Connecting to #{url} for #{@entity}\" \n\n # Do the request\n content = open_uri_and_return_content(url,@task_logger)\n\n # Return if we didn't get anyting\n next unless content\n\n # Check to make sure this is a legit page, and create an entity if so\n # \n # Note that the signature is blank for unsig_checks\n #\n # TODO - improve the checking for wildcard page returns and 404-200's\n\n if content.include? check[:signature] and content != missing_page_content\n # create an entity if we match\n create_entity Entities::WebPage, { :name => \"#{url}\", :uri => \"#{url}\", :content => \"#{content}\" }\n end\n\n end\nend",
"def before_starting_workers\n end",
"def check_config_and_start_agent\n return unless monitoring? && has_correct_license_key?\n return if using_forking_dispatcher?\n\n setup_and_start_agent\n end",
"def start\n validate!\n start_message\n build_threads\n start_threads\n end",
"def begin!\n start_server\n end",
"def in_progress?\n started? && response.nil?\n end",
"def pre_connect(request); end",
"def check\n @task.log \"# #{@site.name}\"\n\n @base_url = @site.full_url.sub(/^(https?:\\/\\/.*?\\/).*/, '\\\\1')\n\n @urls = { @site.url => %w(Site) }\n @results = {}\n @errors = {}\n\n @html_request_timeout = SS.config.cms.check_links[\"html_request_timeout\"] rescue 10\n @head_request_timeout = SS.config.cms.check_links[\"head_request_timeout\"] rescue 5\n\n (10*1000*1000).times do |i|\n break if @urls.blank?\n url, refs = @urls.shift\n # @task.log url\n check_url(url, refs)\n @task.count\n end\n\n msg = [\"[#{@errors.size} errors]\"]\n @errors.map do |ref, urls|\n ref = File.join(@base_url, ref) if ref[0] == \"/\"\n msg << ref\n msg << urls.map do |url|\n url = File.join(@base_url, url) if url[0] == \"/\"\n \" - #{url}\"\n end\n end\n msg = msg.join(\"\\n\")\n\n @task.log msg\n\n if @email.present?\n ActionMailer::Base.mail(\n from: \"shirasagi@\" + @site.domain.sub(/:.*/, \"\"),\n to: @email,\n subject: \"[#{@site.name}] Link Check: #{@errors.size} errors\",\n body: msg\n ).deliver_now\n end\n\n unset_errors_in_contents\n @errors.map do |ref, urls|\n urls = urls.map { |url| (url[0] == \"/\") ? File.join(@base_url, url) : url }\n set_errors_in_contents(ref, urls)\n end\n head :ok\n end",
"def multi_workers_ready?\n true\n end",
"def multi_workers_ready?\n true\n end",
"def multi_workers_ready?\n true\n end",
"def start\n\n end",
"def wait_and_open\n info \"Attempting to connect to the web site...\"\n Http.head \"http://127.0.0.1:3000/\"\n rescue Errno::ECONNREFUSED\n sleep(0.5)\n retry if (self.try += 1) < max\n info \"Server not found, sorry.\"\n raise\n else\n Launchy.open(\"http://127.0.0.1:3000/\")\n end",
"def validate_request(call)\n call.validate_request\n end",
"def wait_for_server_start\n require 'socket'\n require 'net/http'\n tries = 1\n max_tries = 30\n successes = 0\n max_successes = 2\n wait = 5\n print \"Waiting for the server to start (max tries: #{max_tries} with a #{wait} second pause between tries): \"\n begin\n while tries <= max_tries\n tries += 1\n begin\n Net::HTTP.start(\"localhost\", \"3010\") do |http|\n response = http.get('/')\n if response.code == \"200\"\n print \"O\"\n successes += 1\n return true if successes >= max_successes\n else\n print \"o\"\n end\n end\n rescue SystemCallError => e\n successes = 0\n if tries == max_tries\n print \"!\"\n raise\n end\n print \".\"\n end\n $stdout.flush\n sleep(wait)\n end\n ensure\n puts # Ensure a newline gets added\n $stdout.flush\n end\n return false\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 !@memcache.cache[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 set_request_start\n @request_started_at = Time.now\n @used_auth_by_token = true\n end",
"def run_all()\n end",
"def request; end",
"def request; end",
"def request; end"
] | [
"0.6673162",
"0.61371994",
"0.60237217",
"0.5910861",
"0.5910861",
"0.58853775",
"0.58444864",
"0.58149236",
"0.5792667",
"0.5693341",
"0.56818587",
"0.5677432",
"0.5666639",
"0.5664971",
"0.5627509",
"0.5614598",
"0.5600875",
"0.5568299",
"0.5568299",
"0.5558949",
"0.5557413",
"0.5557413",
"0.5557413",
"0.5557413",
"0.55405784",
"0.5537436",
"0.5514405",
"0.5495507",
"0.5493269",
"0.5493269",
"0.5493269",
"0.54922396",
"0.5488726",
"0.5479537",
"0.5469108",
"0.5457894",
"0.54486436",
"0.54367954",
"0.5413108",
"0.54070336",
"0.540514",
"0.5402812",
"0.5382317",
"0.5378703",
"0.5371645",
"0.5369898",
"0.5368648",
"0.53661656",
"0.53661656",
"0.53533846",
"0.5342672",
"0.53179854",
"0.5306337",
"0.53008217",
"0.5292637",
"0.52866304",
"0.5285734",
"0.52838427",
"0.52756315",
"0.5269715",
"0.5267091",
"0.5266784",
"0.52666",
"0.52632326",
"0.526048",
"0.52583325",
"0.52560437",
"0.5250082",
"0.52458835",
"0.52451295",
"0.5241842",
"0.5241403",
"0.5236969",
"0.52362883",
"0.52249473",
"0.5224837",
"0.52193576",
"0.5213396",
"0.52133715",
"0.52034867",
"0.5200344",
"0.51978725",
"0.5193893",
"0.51910806",
"0.518324",
"0.5178267",
"0.5171608",
"0.51663864",
"0.51663864",
"0.51663864",
"0.51655537",
"0.5162988",
"0.51620185",
"0.5158182",
"0.5155359",
"0.51503664",
"0.5144679",
"0.51435316",
"0.51435316",
"0.51435316"
] | 0.6370992 | 1 |
it creates a random arrays of array of random numbers beetween the desviation and the points wishes. Also add a wish_ouput to use after in neuronal networs | def initialize(desviation, quantity, x, y, z, wish_output)
if !z
initialize_2d(desviation, quantity, x, y, wish_output)
else
initalize_3d(desviation, quantity, x, y, z, wish_output)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_population(n)\r\n\t\treturn Array.new(n) { Snek.new(@start_x,@start_y, Array.new(@nb_heuristic) { @random.rand(-5.0..5.0) }) }\r\n\tend",
"def prox\n\t\trandom_weighted @jugadas\n\t\t\n\tend",
"def generate\n #create random number generator\n rng = Random.new\n @points = Array.new\n\n #num_points times, make random value in ranges \n @num_points.times do\n @points << [rng.rand(@x_lims), rng.rand(@y_lims)]\n end\n end",
"def generate(size_x, size_y)\n @size_x = size_x\n @data = Array.new(size_x * size_y, 0)\n first_iteration = true\n\n number_of_passes.times do\n drops = create_drops\n\n # initial drop position is at the center of the map\n drop_point_x, drop_point_y = size_x / 2, size_y / 2\n\n drops.each do |drop|\n # drop particles\n drop.each { |particle| particle.drop(@data, drop_point_x, drop_point_y, size_x) }\n\n # move drop point for next drop\n if first_iteration\n drop_point_x = rand(size_x - 8) + 4 # make sure that particles\n drop_point_y = rand(size_y - 8) + 4 # aren't created near the edges\n else\n drop_point_x = rand(size_x / 2) + size_x / 4\n drop_point_y = rand(size_y / 2) + size_y / 4\n end\n end\n\n first_iteration = false\n change_variables_for_next_pass\n end\n\n @data\n end",
"def mutate\n @weights = (1..@size).map { Random.rand(-0.5..0.5) }\n end",
"def create_drops\n drops = []\n @number_of_drop_points.times do\n number_in_this_drop = rand(@max_particles - @min_particles) +\n @min_particles\n drops.push(Array.new(number_in_this_drop,\n Particle.new(@particle_stability_radius)))\n end\n\n drops\n end",
"def rand_point()\n \n end",
"def generate_boggle_board_hasbro(dim=4)\n shuffled = DICE_CONFIG.shuffle!()\n # shuffled = shuffled.shuffle!()\n (0...dim).map do |i|\n (0...dim).map{ |j|\n letters = shuffled[dim * i + j]\n letters[rand(letters.length)] # will append the alphabet in matrix\n # random_char = letters[rand(letters.length)]\n # if random_char == 'Q'\n # 'Qu'\n # else\n # random_char\n # end\n }\n end\n end",
"def generateCoups\n\tcoups = []\n\trand(2).times do\n\t\tcoups.push(COUPS.sample)\nend\n coups\nend",
"def generateCoups\n coups = []\n rand(2).times do\n coups.push(COUPS.sample)\n end\n coups\nend",
"def generate_call\n return board.sample + bingo.sample\n end",
"def generate_lands!\n\n resources = %w(wood brick metal stone)\n random_resource = resources.concat(resources.sample(2)).shuffle\n random_dice_points = %w(1 2 3 4 5 6).shuffle\n\n %w(0 1 2 3 4 5).shuffle.each.with_index do |position, index|\n game.lands.create(\n resource_type: random_resource[index],\n position: position,\n dice_point: random_dice_points[index]\n )\n end\n end",
"def generate_random_hypothesis( size )\n hypothesis = Hypothesis.new\n size.times do\n hypothesis << generate_random_rule\n end\n hypothesis\nend",
"def generate_random_hypothesis( size )\n hypothesis = Hypothesis.new\n size.times do\n hypothesis << generate_random_rule\n end\n hypothesis\nend",
"def generateCoups\n\t\t@coups = []\n\t\trand(2).times do\n\t\t\t@coups.push(COUPS.sample)\n\t\tend\n\t\t@coups\n\tend",
"def generate\n # Vælg et tilfældigt koordinat til at starte med.\n random_start = [@prng.rand(@width),@prng.rand(@height)]\n \n # Opret en stak og læg det tilfældige koordinat på stakken.\n stack = Array.new\n stack.push random_start\n until stack.empty?\n # Tag koordinaterne fra det øverste element på stakken.\n x,y = stack.last\n # Marker cellen som besøgt.\n @grid[y][x].visited = true\n # Gem alle cellens nabo-celler.\n neighbors = Array.new\n neighbors.push [x, y-1] unless y-1 < 0 # Nord\n neighbors.push [x+1, y] unless x+1 >= @width # Øst\n neighbors.push [x, y+1] unless y+1 >= @height # Syd\n neighbors.push [x-1, y] unless x-1 < 0 # Vest\n # Sorter de naboer fra der allerede er blevet besøgt af algoritmen.\n neighbors.delete_if {|x, y| @grid[y][x].visited }\n # tjek om der er nogle ubesøgte naboer.\n if neighbors.any?\n # Vælg en tilfældig ubesøgt nabo.\n random_neighbor = neighbors.sample(random:@prng)\n # Forbind denne celle med den tilfældige nabo.\n connect stack.last, random_neighbor\n # Læg den tilfældige nabo øverst på stakken.\n stack.push random_neighbor\n else\n # Hvis der ingen naboer er, så tager den en celle af stakken.\n stack.pop\n end\n end\n end",
"def random_typhoon_generator\n\t\t\n\t\t#Normal Typhoon\n\t\tr = rand(50) #Currently: 1/50 chance\n\t\tif(r%49 == 0)\n\t\tsz = rand(3)\n\t\tsX = rand(40-12) + 12\n\t\tsY = rand(12-1) + 1\n\t\tdX = rand(10-3) + 3\n\t\tdY = rand(2-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\t\tend\n\t\t#Strong Typhoon\n\t\tr = rand(90) #Currently: 1/90 chance\n\t\tif(r%89 == 0)\n\t\tsz = 3\n\t\tsX = rand(46-12) + 12\n\t\tsY = rand(12-1) + 1\n\t\tdX = rand(11-3) + 3\n\t\tdY = rand(2-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\t\tend\n\tend",
"def build\n Constant::RANKS.product(Constant::SUITS).shuffle\n end",
"def generateCoups\n\tcoups = []\n\trand(2).times do\n\t\tcoups.push(COUPS.sample)\n\tend\n\tcoups\nend",
"def initialize(x, y)\n\t\t@neurons = Array.new\n\t\tx.times do\n\t\t\tneuron = Array.new(y)\n\t\t\t\n\t\t\t#create random weights\n\t\t\tneuron.each_index do |weight|\n\t\t\t\tneuron[weight] = rand * 2.0 - 1.0\n\t\t\tend\n\t\t\t@neurons << neuron\n\t\tend\n\tend",
"def dice_results\r\n Array.new(number_of_dice) { rand(1..number_of_sides) }\r\n end",
"def initializePesos\r\n \t@cantNeuronas.times do\r\n\t patron = @patrones[rand(@patrones.count-1)]\r\n @neuronas << {:class=>rand(@cantClases), :pesos => initPesos}\r\n\tend\r\n end",
"def initializeWeights\n @matrixWeights = Array.new\n @umbral = Array.new\n for i in 0..@numNeuronas-1\n aux = Array.new\n for j in 0..@numEntradas-1\n aux << (2*0.05*rand-0.05)\n end\n @matrixWeights << aux\n @umbral << (2*0.05*rand-0.05)\n end\n end",
"def generate()\n\t\t# first generate at least one star\n\t\t\n\t\tcx = centerX\n\t\tcy = centerY\n\t\tstarPos = randomLocation(cx, cy, SolarSystemRadius)\n\t\tstar = generateNewCelestialBody(starPos[0], starPos[1], 'star')\n\t\t\n\t\t# possibly another star\n\t\tif rand < ProbabilitySecondStar\n\t\t\tstarPos2 = randomDistantPosition\n\t\t\tstar2 = generateNewCelestialBody(starPos2[0], starPos2[1], 'star')\n\t\tend\n\t\t\n\t\tnumPlanets = Random.rand(MedianNumPlanets-NumPlanetsVariation...MedianNumPlanets+NumPlanetsVariation)\n\t\tnumPlanets.times do\n\t\t\tplanetPos = randomDistantPosition\n\t\t\tplanet = generateNewCelestialBody(planetPos[0], planetPos[1], 'planet')\n\t\tend\n\tend",
"def seed_data\n\n target_isolates = rand(20) + 5\n shipment = shipments.new({:target_isolates => target_isolates})\n\n base_objective = BaseObjective.parent_objectives.to_a.sample\n if base_objective.first == \"objective_b\"\n bacteria_type = {:bacteria_type => ObjectiveB::bacteria_type_values.sample.last}\n code_prefix = bacteria_type.values.last\n end\n\n objective = base_objective.last\n\n starting_code = starting_code_for(objective, code_prefix ||= nil)\n\n shipment.target_isolates.times do |x|\n parent_objective = objective.new(bacteria_type ||= {})\n \n code_number = parent_objective.code_prefix+\"#{(starting_code + x + 1)}\"\n\n isolate = shipment.isolates.new({code_number: code_number})\n isolate.parent = parent_objective\n isolate.save\n end\n\n shipment.update_attribute(:objective_name, \"#{objective.name} #{objective.new(bacteria_type ||= {}).name}\")\n\n end",
"def distract_data\r\r\n \r\r\n $game_variables[PONY::TOTAL_BIT_VARIABLE_ID] = $game_variables[PONY::TOTAL_BIT_VARIABLE_ID].to_i\r\r\n $game_variables[PONY::TOTAL_XP_VARIABLE_ID] = $game_variables[PONY::TOTAL_XP_VARIABLE_ID].to_i\r\r\n\r\r\n distract_value = rand / 2\r\r\n $game_variables[PONY::TOTAL_BIT_VARIABLE_ID] += distract_value\r\r\n $game_variables[PONY::TOTAL_XP_VARIABLE_ID] += distract_value\r\r\n \r\r\n end",
"def guesses\n (three_guesses + [person]).shuffle\n end",
"def propose(x)\n y = x.clone\n two_pi_r = 2*GSL::M_PI*rand\n sqrt_n2_ln_phi = Math.sqrt(-2*log(rand))\n z1 = cos(two_pi_r) * sqrt_n2_ln_phi\n z2 = sin(two_pi_r) * sqrt_n2_ln_phi\n c1 = sqrt(1.0+@correlation)/2.0\n c2 = sqrt(1.0-@correlation)/2.0\n y[@indices[0]] = x[@indices[0]] + @stdev1*(c1*z1+c2*z2)\n y[@indices[1]] = x[@indices[1]] + @stdev2*(c1*z1-c2*z2)\n y\n end",
"def random_join\n union_disjoint_sets_carve_wall(skip_probability: [true, false] )\n end",
"def random(tg,faulty,replacements,n)\n get_mappings(faulty,replacements).sample\nend",
"def set_points(count,size)\n if count > size\n raise \"Whow there!\"\n end\n points = []\n x = (0..size-1).to_a.shuffle\n y = (0..size-1).to_a.shuffle\n begin\n points.push([x.shift,y.shift])\n end until points.size == count\n points\nend",
"def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end",
"def setup_castle\r\n randomnums = Random.new\r\n zero_out\r\n treasures_allot\r\n terrors_allot\r\n set_at_room(4,6, 100 + randomnums.rand(1...100))\r\n set_at_room(16,6, 100 + randomnums.rand(1...100))\r\nend",
"def insert_mines\n @random_spots = []\n @num_of_mine.times do\n\n while @random_spots.length < @num_of_mine\n rand_num = Random.rand(@num_of_tiles**2)\n\n if !@random_spots.include?(rand_num)\n @random_spots << rand_num\n end\n\n end\n end\nend",
"def mutate\n d=MyDriver.new\n d.clutch=@clutch.map {|c| \n c*(0.9+0.2*rand)\n }\n d.gas=@gas.map {|c| \n c*(0.9+0.2*rand)\n }\n d\n end",
"def santa_generator(num)\n\t@santas = []\n\texample_names = [\"Sarah\", \"Sting\", \"Sigmond\", \"Stella\", \"Stephen\", \"Sidney\", \"Singin\"]\n\texample_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n\texample_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n\t\n\tnum.times do |num|\n\n\tnew_santa = Santa.new(example_names.sample(example_names.length), example_genders.sample(example_genders.length), example_ethnicities.sample(example_ethnicities.length)) \n\t\t\t\t# name = example_names.rand(example_name.length)\n\t\t\t\t# gender = example_genders.rand(example_genders.length)\n\t\t\t\t# ethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t\t\t\n\t\t\t\t\t new_santa.age = (1..140).to_a.sample\n\n\n# Emmanual said these sage words otherwise there is no variable to accept the random number\n\n# [11:21] \n# if you had another method that created age and called it before this that would work too\n\n# [11:21] \n# basically, initialize sets all of the basic information for the class. What needs to exist for this class to exist\n\t@santas << new_santa\n\t\t# index = 0 do |num|\n\t\t# \tuntil num == index \n\t\t# \t\tname = example_names.rand(example_name.length)\n\t\t# \t\tgender = example_genders.rand(example_genders.length)\n\t\t# \t\tethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t# \t\tage = Random.rand(141)\n\t\t# \tsantas << Santa.new (name, gender,ethnicity)\n\t\t# \t# name = example_names(rand(example_name.length)\n\t\t# \t# gender = example_genders(rand(example_genders.length)\n\t\t# \t# ethnicity = example_ethnicities(rand(example_ethnicities.length)\n\t\t# \t# age = Random.rand(141)\n\n\t\t# index += 1\n\t\n\tend\nend",
"def generate\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n partner_a = @mating_pool[rand(0...@mating_pool.size)]\n partner_b = @mating_pool[rand(0...@mating_pool.size)]\n child = partner_a.crossover(partner_b)\n child.mutate(@mutation_rate)\n @population[i] = child\n end\n @generations += 1\n end",
"def generate\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n partner_a = @mating_pool[rand(0...@mating_pool.size)]\n partner_b = @mating_pool[rand(0...@mating_pool.size)]\n child = partner_a.crossover(partner_b)\n child.mutate(@mutation_rate)\n @population[i] = child\n end\n @generations += 1\n end",
"def realistic_random(n, wmin, wmax, pmin, pmax, c, seed)\n str = \"# realistic random -- n: #{n}; wmin: #{wmin}; wmax: #{wmax}; pmin: #{pmin}; pmax: #{pmax}; c: #{c}; seed: #{seed}\\n\"\n str << \"n: #{n}\\nc: #{c}\\n\"\n str << \"begin data\\n\"\n\n rng = Random.new(seed)\n w = (wmin..wmax).to_a.sample(n, random: rng).sort!\n p = (pmin..pmax).to_a.sample(n, random: rng).sort!\n wp = []\n n.times { |i| wp << \"#{w[i]} #{p[i]}\" }\n str << wp.shuffle!(random: rng).join(\"\\n\") << \"\\n\"\n str << \"end data\\n\"\n\n str\nend",
"def random_ship\n SHIPS[SHIPS.keys.sample]\n end",
"def santa_generator\r\n# Santa arrays\r\nsantas = []\r\nsanta_genders = [\"male\", \"female\", \"agender\", \"intersex\", \"N/A\", \"gender fluid\", \"bigender\", \"XXY\", \"XXX\", \"neuter\"]\r\nsanta_ethnicities = [\"Caucasian\", \"Latina\", \"Asian\", \"Unicorn\", \"N/A\", \"Black\", \"Middle-Eastern\", \"Native American\", \"Aboriginal\", \"Alien\"]\r\n\r\n#santa_genders.length.times do |i|\r\n#\tsantas << Santa.new(santa_genders[i], santa_genders[i])\r\n#end\r\n\r\ncount = 0\r\nwhile count < 100\r\n\tsantas << Santa.new(santa_genders[rand(10)], santa_ethnicities[rand(10)])\r\n\tcount += 1\r\nend\r\n\r\nsantas.each {|i|\r\n\ti.age = rand(141)\r\n\tputs \"Santa #{count} is #{i.gender}, #{i.ethnicity}, and #{i.age} years old.\"\r\n}\r\n\r\nend",
"def make_targets\n @targets = Array.new(8) { Vec2D.new(rand(width), rand(height)) }\nend",
"def random_typhoon_generator\n\n #Normal Typhoon\n r = rand(50) #Currently: 1/50 chance\n if (r%49 == 0)\n sz = rand(3)\n sX = rand(40-12) + 12\n sY = rand(12-1) + 1\n dX = rand(10-3) + 3\n dY = rand(2-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end\n #Strong Typhoon\n r = rand(90) #Currently: 1/90 chance\n if (r%89 == 0)\n sz = 3\n sX = rand(46-12) + 12\n sY = rand(12-1) + 1\n dX = rand(11-3) + 3\n dY = rand(2-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end\n end",
"def randomize_directions(directions)\n directions.shuffle\n end",
"def nostalgia; return rand end",
"def make_answer\n\tlist = (0..9).to_a\n\t(0..2).map{ list.delete_at( rand(list.size-1)) }\nend",
"def answers\n return (distractor + [correct]).shuffle\n end",
"def answers\n return (distractor + [correct]).shuffle\n end",
"def polya_urn_model(base_color_distribution, num_balls, alpha)\n return [] if num_balls <= 0\n\n balls_in_urn = []\n 0.upto(num_balls - 1) do |i|\n if rand < alpha.to_f / (alpha + balls_in_urn.size)\n # Draw a new color, put a ball of this color in the urn.\n new_color = base_color_distribution.call\n balls_in_urn << new_color\n else\n # Draw a ball from the urn, add another ball of the same color.\n ball = balls_in_urn[rand(balls_in_urn.size)]\n balls_in_urn << ball\n end\n end\n \n balls_in_urn\nend",
"def mutate_matingpool\n (0...@mating_pool.size).each do |i|\n j = rand 0...@num_genes\n chromosome = @mating_pool[i].clone\n gene = chromosome[j]\n gene = gene.zero? ? 1 : 0\n chromosome[j] = gene\n @new_generation << chromosome\n end\n end",
"def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend",
"def resample particles, weights\n\tw = weights\n\tp = particles\n\tn= weights.size\n\tp3 = [] \n\tindex = rand()*n\n\tbeta = 0.0\n\tmw = w.max()\n\tn.times do \n\t\tbeta += rand()*2*mw\n\t\twhile beta > w[index]\n\t\t\tbeta -= w[index]\n\t\t\tindex = (index + 1)% n\n\t\tend\n\t\tp3 << p[index]\n\tend\n\tp3\nend",
"def resample particles, weights\n\tw = weights\n\tp = particles\n\tn= weights.size\n\tp3 = [] \n\tindex = rand()*n\n\tbeta = 0.0\n\tmw = w.max()\n\tn.times do \n\t\tbeta += rand()*2*mw\n\t\twhile beta > w[index]\n\t\t\tbeta -= w[index]\n\t\t\tindex = (index + 1)% n\n\t\tend\n\t\tp3 << p[index]\n\tend\n\tp3\nend",
"def propose(x)\n y = x.clone\n y[@index] = x[@index] + @width*(rand-0.5)\n y\n end",
"def generate_random_guesses\n position1 = validate_ai_input\n guess1 = @board.reveal(position1)\n @board.render\n position2 = validate_ai_input\n guess2 = @board.reveal(position2)\n @board.render\n result = is_match?(guess1, guess2)\n if !result\n write_to_ai_memory(guess1.value, position1, guess2.value, position2)\n end\n end",
"def ship_random_cordinates(ship_size)\n ship = Ship.new ship_size\n ship_size = ship_size - 1\n flag = false\n while not flag\n cordinate_x = random_cordinate\n head_position = cordinate_x.split(//,2)\n cordinate_y = CORDINATES.map{|x| (head_position[0].ord + x[0]*ship_size).chr + (head_position[1].to_i+ x[1]*ship_size).to_s}\n cordinate_y = cordinate_y[rand(4)]\n if ship.set_position(cordinate_x,cordinate_y)\n flag = put_ship(ship)\n end\n end\n ship\n end",
"def coordinates\n [rand(50), rand(90)]\n end",
"def generateOres\r\n #For each tier populate the grid with that tier's ore.\r\n (0..@tiers-1).each do |tier|\r\n #Number of ores for the tier.\r\n oreCount = (@baseChance * (@nextTierChance**tier) * @rows * @columns).to_i #Calculates the number of ores for the tier based on the base chance and next tier chance.\r\n @oreTotal[tier] = oreCount\r\n @oreRemaining[tier] = oreCount\r\n @oreRemainingPara[tier].clear { para(@ore[tier].to_s + \" \" + @oreName[tier].to_s + \" \", strong(\"x\" + @oreRemaining[tier].to_s), @style_orecount) } #Displays the remaining number of ores for the tier.\r\n @tierExp[tier] = oreCount * (2**tier) #Calculates the total experience aquired by mining all of the tier's ore.\r\n\r\n count = 0 #Number of ores added so far.\r\n #Randomly selects a cell on the grid to populate the ore with.\r\n while count < oreCount\r\n x = rand(@rows) #Selects a random row.\r\n y = rand(@columns) #Selects a random column.\r\n if (@tile[y][x].tier == 0) #Checks if the tile is empty.\r\n @tile[y][x].tier = tier + 1 #Applies the tier to the tile.\r\n count+=1 #New ore has been added.\r\n end\r\n end\r\n end\r\nend",
"def shuffle()\n \n end",
"def verras_me\n @artworks = Kunstvoorwerp.random\n end",
"def generate_coords\n coords = [0,0]\n coords[0] = rand(9)\n coords[1] = rand(9)\n coords\n end",
"def place_random_ships\n ship_count = size / 4\n while ship_count.positive?\n row = rand(@grid.size)\n col = rand(@grid.size)\n if self[[row, col]] == :N\n self[[row, col]] = :S\n ship_count -= 1\n end\n end\n end",
"def create_nodes(shapes, data, source_list)\n\n\tCSV.foreach(\"network_links_final\", :headers=>true) do |row|\n\n\t\t# binding.pry\n\n\t\tshapes.shuffle\n\n\n\t\tdata[\"nodes\"] << {\"size\"=>10, \"score\"=> 0.6,\"id\"=> row[\"TAG\"], \"group\"=>row[\"Group\"], \"type\"=>shapes[row[\"Group\"].to_i]}\n\n\t\tsource_list << row[\"TAG\"]\n\n\n\tend\nend",
"def reproduction\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n # Sping the wheel of fortune to pick two parents\n m = rand(@mating_pool.size).to_i\n d = rand(@mating_pool.size).to_i\n # Pick two parents\n mom = @mating_pool[m]\n dad = @mating_pool[d]\n # Get their genes\n momgenes = mom.dna\n dadgenes = dad.dna\n # Mate their genes\n child = momgenes.crossover(dadgenes)\n # Mutate their genes\n child.mutate(@mutation_rate)\n # Fill the new population with the new child\n location = Vec2D.new(width / 2, height + 20)\n @population[i] = Rocket.new(location, child)\n end\n @generations += 1\n end",
"def initialize_deck\n SUITS.product(VALUES).shuffle\nend",
"def choose_two(array, neutral)\n #puts \"choose two\"\n one=choose_one(array, neutral)\n two=choose_one(array, neutral)\n if two['lightness']!=1 || one['lightness']!=5\n while one['lightness']>=two['lightness']\n one=choose_one(array, neutral)\n end\n else\n choose_two(array, neutral)\n end\n x = [\"Other-V\", \"Liner\"]\n puts \"Lid: \"+one['name'].to_s + \"\\n\" + x[rand(x.length)]+\": \"+two['name'].to_s\nend",
"def generate_scenario(difficulty) \r\n Logger.debug \"Difficulty: #{difficulty}\"\r\n @killer = @npcs.sample\r\n @victim = @killer\r\n @victim = npcs.sample while @victim == @killer\r\n @victim.die\r\n @victim.map_id = MANSION_MAP_ID\r\n Logger.log \"Victim: #{@victim.name}\"\r\n Logger.debug \"Killer: #{@killer.name}\"\r\n \r\n non_victims = @npcs - [@victim]\r\n non_killers = non_victims - [@killer] \r\n non_killers.shuffle!\r\n \r\n num_signals = 3 + (2 * difficulty)\r\n evidence_counts = {}\r\n generate_signals_and_profiles(num_signals, non_victims, difficulty)\r\n \r\n Logger.debug \"Initial distribution: #{non_victims} v=#{non_victims.collect { |n| n.evidence_count }.variance}\"\r\n initial_sum = 0\r\n non_victims.map { |n| initial_sum += n.evidence_count }\r\n \r\n non_victims.each { |n| n.augment_profile }\r\n @victim.evidence_count = rand(2) # 0 or 1 signal, just \"for fun\"\r\n @victim.augment_profile\r\n \r\n # Everyone needs an alibi. Weak alibis are a signal.\r\n generate_killers_alibi(non_killers)\r\n generate_alibis(non_killers)\r\n murder_weapon_in_whose_house = nil\r\n # 50% chance to put the murder weapon in the house of an NPC\r\n if rand(50) <= 100\r\n # Pick a suitable NPC first\r\n suitable_npcs = non_victims.select { |n| n.evidence_count >= 2 }\r\n if !suitable_npcs.empty?\r\n npc = suitable_npcs.sample\r\n npc.evidence_count -= 2\r\n # Pick something on their map as the murder weapon\r\n @murder_weapon = @potential_murder_weapons.select { |weapon, map| map == npc.map_id }.keys.sample\r\n Logger.debug \"Murder weapon (#{npc.name}'s house): #{@murder_weapon}\"\r\n murder_weapon_in_whose_house = npc\r\n end\r\n end\r\n \r\n if murder_weapon_in_whose_house.nil?\r\n # goes in the mansion\r\n @murder_weapon = @potential_murder_weapons.select { |weapon, map| map == MANSION_MAP_ID }.keys.sample\r\n Logger.debug \"Murder weapon (mansion): #{@murder_weapon}\"\r\n end\r\n \r\n raise \"Something went terribly wrong with murder weapon selection\" if @murder_weapon.nil?\r\n @evidences = EvidenceGenerator::distribute_evidence(non_victims, @victim, @npc_maps, MANSION_MAP_ID, @notebook, @potential_murder_weapons.keys, @murder_weapon, murder_weapon_in_whose_house) \r\n EvidenceGenerator::complete_profiles_with_criminology(non_victims)\r\n \r\n Logger.debug '-' * 80\r\n Logger.debug \"Final distribution: #{non_victims}\" \r\n final_sum = 0\r\n non_victims.map { |n| final_sum += n.evidence_count }\r\n Logger.debug \"Signals consumed: #{initial_sum - final_sum}\"\r\n end",
"def simulate i, n, tr\n unless tr[0].is_a?(Numeric) && tr[1].is_a?(Numeric)\n require 'pry'\n binding.pry\n end\n\n er = tr[0].to_f / (n-2)\n ps = i.to_f / n\n data = {prior_s: ps, prob_ex: er, total_queries: 0, kdist: []}\n\n # every peer (other than origins) might get to do a direct query and/or get extra responses\n know = Array.new(n - i) { false }\n data[:responses] = []\n\n k = i\n j = 0\n while k < n\n # pick a peer that doesn't know yet\n z = know.each_index.find { |l| !know[l] }\n\n resp = 0\n loop do\n # record current knowledge dist\n data[:kdist][data[:total_queries]] = k\n # make a new query\n data[:total_queries] += 1\n # how many peers responded?\n resp = k.times.count { rand < tr[1] }\n break if resp > 0\n end\n\n data[:responses][j] = {extra: [], queries: data[:total_queries] - 1}\n\n # how many non-origin peers responded?\n exres = 0\n if resp > i\n exres = resp - i\n end\n nonorg = 0\n\n # record responses\n extra = 0\n know.each_index do |l|\n # if this is the querying peer\n if l == z\n # they get a direct response\n data[:responses][j][:direct] = resp\n know[l] = true\n next\n end\n # else see how many extra responses we got\n\n # resp peers are sending extra responses\n exre_senders = resp\n # subtract 1 if this is one of the k peers\n if know[l] && nonorg < exres\n exre_senders -= 1\n nonorg += 1\n end\n\n reses = exre_senders.times.count { rand < er }\n\n # if we got respones\n if reses > 0\n # record it\n data[:responses][j][:extra] << reses\n\n # check if this spread knowledge\n if !know[l]\n know[l] = true\n extra += 1\n end\n end\n end\n\n k += 1 + extra\n j += 1\n end\n data[:kdist][data[:total_queries]] = n\n\n data\nend",
"def new_game\n my_board = EdenPlayer.new_board\n ships = [5, 4, 3, 3, 2]\n probs = positional_probabilities my_board\n ship_pos = ships.map do |ship|\n laid = nil\n until laid\n rand_branch = rand(999) % 3\n # 1/3rd of the time, don't lay the ship in lowest probability spot\n # near edge, this gives a grouping formation that gives a few ships\n # a great area that they may be found in\n pos = rand(999) % 3 == 1 ? [rand(10), rand(10)] : draw_next_min(probs)\n laid = lay_ship({ship_length: ship, board: my_board, pos: pos})\n end\n laid\n end\n end",
"def random_point_change\n if (@count % 2 == 0)\n @random_points = rand(100)\n else\n @random_points = @random_points\n end\n end",
"def generate_deck\n (1..3).to_a.product(@colors, @shapes, @textures).each{|arr| @deck.push(Card.new(arr[0], arr[1], arr[2], arr[3]))}\n @deck.shuffle!\nend",
"def valid_nums(randnums)\n# exclusions = [1, 4, 6, 7, 8, 14, 16, 18, 19, 20, 24, 25, 26, 30]\nship_arr = [2, 3, 5, 9, 10, 11, 12, 13, 15, 17, 21, 22,\n 23, 27, 28, 29, 31, 32]\n\nx = ship_arr.sample\nship_arr.delete(x)\ny = ship_arr.sample\n\nrandnums = randnums.fill(x.to_i, 3..3)\nrandnums = randnums.fill(y.to_i, 8..8)\nend",
"def shuffle()\n @x.shuffle\n \n end",
"def random(normal=false)\n p = new\n p.notename_i = NOTE_NAMES_TO_I.values.rand\n p.octave = 0\n\n accidentals = []\n if normal\n accidentals = case p.notename\n when 'c', 'f' \n [0, 1]\n when 'e', 'b'\n [-1, 0]\n else [-1, 0, 1]\n end\n else\n accidentals = [-1, 0, 1]\n end\n p.accidental = accidentals.rand\n p\n end",
"def create_random_Ant\n\n myAnt = Ant.new\n\n myAnt.x = @x\n myAnt.y = @y\n myAnt.anthill = self\n rand_number = rand(3)\n if rand_number == 0\n myAnt = create_Forager(myAnt)\n elsif rand_number == 1\n myAnt = create_Builder(myAnt)\n else\n myAnt = create_Warrior(myAnt)\n \n end\n\n Meadow.instance.add_AntToCell(myAnt, @x, @y)\n @food -= 1 \n end",
"def santa_creator(number_of_santas)\n example_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n example_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n number_of_santas.times do\n santa_instance = Santa.new(example_genders.sample, example_ethnicities. sample)\n p santa_instance.gender\n p santa_instance.age\n p santa_instance.ethnicity\n p santa_instance.reindeer_ranking\n end\nend",
"def gen_std_breqd_instance(n, c, wmax, pmax, seed)\n r = pmax/wmax # integer division\n r_2 = r**2\n pmax_2 = pmax**2\n rng = Random.new(seed)\n s = \"# bottom right ellipse quadrant distribution-- n: #{n}; c: #{c}; wmax: #{wmax}; pmax: #{pmax}; seed: #{seed}\\n\"\n s << \"n: #{n}\\nc: #{c}\\nbegin data\\n\"\n (1..wmax).to_a.sample(n, random: rng).each do | w |\n p = pmax - Math.sqrt(pmax_2 - (w**2 * r_2)).to_i\n s << \"#{w} #{p}\\n\"\n end\n s << \"end data\\n\"\n s\nend",
"def random_megazord\n megazords_arr = [\"Ninja Falcon Megazord\", \"Galaxy Megazord\", \"Thundersaurus Megazord\", \"Lightspeed Megazord\",\"DriveMax Megazord\", \"Wild Force Megazord\"]\n megazord = megazords_arr[rand(megazords_arr.length)]\nend",
"def generate_all(load_file)\n data = JSON.parse(File.open(\"#{load_file}\", \"r\").read) # Parse the json into an array\n deck_1_number_wins = 0.0\n deck_2_number_wins = 0.0 \n deck_1_win_rate = 0.0\n deck_2_win_rate = 0.0\n total_win_rate = 0.0\n deck_1_win_turn = 0.0\n deck_2_win_turn = 0.0\n total_win_turn = 0.0\n deck_1_win_damage = 0.0\n deck_2_win_damage = 0.0\n total_win_damage = 0.0\n winner_hp = 0.0\n looser_hp = 0.0\n winner_cid = 0.0 # cards in deck\n looser_cid = 0.0 # cards in deck\n total_cid = 0.0 # cards in deck\n winner_cih = 0.0 # cards in hand\n looser_cih = 0.0 # cards in hand\n total_cih = 0.0 # cards in hand\n \n # Get the total number of times each player won\n data.each do |item|\n if item['random_winner'] == 'Deck_1' \n deck_1_number_wins = deck_1_number_wins +1\n deck_1_win_turn = deck_1_win_turn + item['random_win_turn']\n total_win_turn = total_win_turn + item['random_win_turn']\n deck_1_win_damage = deck_1_win_damage + item['damge_dealt_on_final_turn']\n total_win_damage = total_win_damage + item['damge_dealt_on_final_turn']\n else\n deck_2_number_wins = deck_2_number_wins +1\n deck_2_win_turn = deck_2_win_turn + item['random_win_turn']\n total_win_turn = total_win_turn + item['random_win_turn']\n deck_2_win_damage = deck_2_win_damage + item['damge_dealt_on_final_turn']\n total_win_damage = total_win_damage + item['damge_dealt_on_final_turn']\n end\n winner_hp = winner_hp + item['winners_hp']\n looser_hp = looser_hp + item['losers_starting_hp']\n winner_cid = winner_cid + item['winner_cards_in_deck']\n looser_cid = looser_cid + item['looser_cards_in_deck']\n total_cid = total_cid + winner_cid + looser_cid\n winner_cih = winner_cid + item['winner_cards_in_hand']\n looser_cih = looser_cid + item['looser_cards_in_hand']\n total_cih = total_cid + winner_cid + looser_cid\n end\n \n # Calculate win % and convert that number to a float\n deck_1_win_rate = deck_1_number_wins/data.size.to_f * 100\n deck_2_win_rate = deck_2_number_wins/data.size.to_f * 100\n \n puts \"Deck 1 wins #{deck_1_number_wins}/#{data.size} which is #{deck_1_win_rate}%\"\n puts \"Deck 2 wins #{deck_2_number_wins}/#{data.size} which is #{deck_2_win_rate}%\" \n\n # Calculate win turn and convert that number to a float\n deck_1_avg_win_turn = deck_1_win_turn/deck_1_number_wins.to_f\n deck_2_avg_win_turn = deck_2_win_turn/deck_2_number_wins.to_f\n total_win_turn = total_win_turn/data.size.to_f\n\n puts \"Deck 1 on avgerage wins on turn #{deck_1_avg_win_turn}\"\n puts \"Deck 2 on avgerage wins on turn #{deck_2_avg_win_turn}\"\n puts \"On avgerage the game ends on turn #{total_win_turn}\" \n \n # Calculate win damage and convert that number to a float\n deck_1_avg_win_damage = deck_1_win_damage/deck_1_number_wins.to_f\n deck_2_avg_win_damage = deck_2_win_damage/deck_2_number_wins.to_f\n total_win_damage = total_win_damage/data.size.to_f\n\n puts \"Deck 1 on avgerage wins by dealing #{deck_1_avg_win_damage}\"\n puts \"Deck 2 on avgerage wins by dealing #{deck_2_avg_win_damage}\"\n puts \"On avgerage the game ends by dealing #{total_win_damage}\"\n \n # Calculate average hp and convert that number to a float\n winner_hp = winner_hp/data.size.to_f\n looser_hp = looser_hp/data.size.to_f\n\n puts \"On avgerage the winner has #{winner_hp} hp on the final turn\"\n puts \"On avgerage the looser has #{looser_hp} hp at the start of the final turn\"\n\n # Calculate average cards in deck and convert that number to a float\n winner_cid = winner_cid/data.size.to_f\n looser_cid = looser_cid/data.size.to_f\n total_cid = total_cid/data.size.to_f\n\n puts \"On avgerage the winner has #{winner_cid} cards in deck on the final turn\"\n puts \"On avgerage the looser has #{looser_cid} cards in deck on the final turn\"\n puts \"On avgerage the a player has #{total_cid} cards in deck on the final turn\"\n\n # Calculate average cards in hand and convert that number to a float\n winner_cih = winner_cih/data.size.to_f\n looser_cih = looser_cih/data.size.to_f\n total_cih = total_cih/data.size.to_f\n\n puts \"On avgerage the winner has #{winner_cih} cards in hand on the final turn\"\n puts \"On avgerage the looser has #{looser_cih} cards in hand on the final turn\"\n puts \"On avgerage the a player has #{total_cih} cards in hand on the final turn\"\n end",
"def generateValue()\n for player in @skater_data\n player.push(0)\n end\n for goalie in @goalie_data\n goalie.push(0)\n end\n indexs = [6,7,8,9,10,11]\n dStats = []\n fStats = []\n for index in indexs\n dStats = getAveragesForStat(index,@skater_data,\"0\")\n fStats = getAveragesForStat(index,@skater_data,\"1\")\n addStat(@skater_data,dStats,\"0\",index)\n addStat(@skater_data,fStats,\"1\",index)\n end\n indexs = [6,7,9,11,12]\n gStats = []\n for index in indexs\n gStats = getAveragesForStat(index,@goalie_data,\"G\")\n addStat(@goalie_data,gStats,\"G\",index)\n end\n \nend",
"def initialize_deck\n VALUES.product(SUITS).shuffle\nend",
"def tourDejeu()\n\t\t#partie Joueur\n\t\tif @type != \"ia\"\n\t\t\tputs \"A moi de jouer (#{nom})\"\n\t\t\tprint \"ligne :\"\n\t\t\tx = gets.chomp()\n\t\t\tprint \"colonne :\"\n\t\t\ty = gets.chomp()\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\telse\n\t\t\tsleep(0.5)\n\t\t\tx = rand(1..3)\n\t\t\ty = rand(1..3)\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\tend\n\tend",
"def powered_by\n random_and_sane [\n \"Diet Pepsi\",\n \"the funny voice he uses to talk to dogs\",\n \"the love of his life, <a href=\\\"http://thebluesunshine.com/\\\">Lizza</a>\",\n \"hoagies from <a href=\\\"https://foursquare.com/v/sarcones-deli/4a9b035ef964a520fc3320e3\\\">Sarcone's Deli</a>\",\n \"his sweet tooth for #{random_and_sane ['Nerds rope','Mike and Ikes','Peppermint Patties']}\",\n \"any and all potatoes\",\n \"rays of sunshine trickling through his backyard fig tree\"\n ]\n end",
"def init_stacks(corporations)\n dpr, *shuffled = corporations\n shuffled.sort_by! { rand }\n corps = [dpr, *shuffled]\n\n stacks = [4, 5]\n stacks.sort_by! { rand }\n size1, size2 = stacks\n\n [\n corps.slice(0, size1),\n corps.slice(size1, size2),\n ]\n end",
"def randomize_players(p1, p2)\n r = rand(2)\n a = []\n if r == 0\n a << p1\n a << p2\n else\n a << p2\n a << p1\n end\n a\n end",
"def breed(players)\n (0..4).each do |i|\n players[i].successor(0, players[(i + 1) % 5])\n players[i].successor(1, players[(i - 1) % 5])\n players[i].successor(2, players[(i + 2) % 5])\n end\n end",
"def twist_seed\n @seed.map {|x| twist(x)}\n end",
"def reproduce (animal)\n e = animal.energy\n if (animal.energy >= REPRODUCTION_ENERGY)\n animal.energy = animal.energy << -1\n animalNu = animal.clone\n genesNu = animal.genes.clone\n mutation = rand(8)\n genesNu[mutation] = [1, (animalNu.genes[mutation] + rand(3) - 1)].max\n animalNu.genes = genesNu\n $animals.push(animalNu)\n end\nend",
"def spawn_dragons therow, thecol\n\n\t\t# So, we'll loop until we have enough dragons\n\t\twhile @dragons.count{ |cell| cell >= DRAGON } < @dragon_count\n\n\t\t\t# Pick a new random location\n\t\t\tnew_row = rand( @height )\n\t\t\tnew_col = rand( @width )\n\n\t\t\t# And create a new dragon if it's allowable\n\t\t\tif ( new_row != therow || new_col != thecol ) && @dragons[(new_row*@width)+new_col] < DRAGON\n\n\t\t\t\t# Spawn the dragon itself\n\t\t\t\t@dragons[(new_row*@width)+new_col] = DRAGON\n\n\t\t\t\t# And increment the neighbour count all around\n\t\t\t\tif new_col > 0\n\t\t\t\t\tif new_row > 0\n\t\t\t\t\t\t@dragons[((new_row-1)*@width)+new_col-1] += 1\n\t\t\t\t\tend\n\t\t\t\t\t@dragons[((new_row)*@width)+new_col-1] += 1\n\t\t\t\t\tif new_row < @height-1\n\t\t\t\t\t\t@dragons[((new_row+1)*@width)+new_col-1] += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif new_row > 0\n\t\t\t\t\t@dragons[((new_row-1)*@width)+new_col] += 1\n\t\t\t\tend\n\t\t\t\tif new_row < @height-1\n\t\t\t\t\t@dragons[((new_row+1)*@width)+new_col] += 1\n\t\t\t\tend\n\t\t\t\tif new_col < @width-1\n\t\t\t\t\tif new_row > 0\n\t\t\t\t\t\t@dragons[((new_row-1)*@width)+new_col+1] += 1\n\t\t\t\t\tend\n\t\t\t\t\t@dragons[((new_row)*@width)+new_col+1] += 1\n\t\t\t\t\tif new_row < @height-1\n\t\t\t\t\t\t@dragons[((new_row+1)*@width)+new_col+1] += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\n\t\t# Now, I've been lazy with setting dragon counts, we we need to normalise\n\t\t# any overinflated dragons :-)\n\t\t@dragons.map! { |cell| cell > DRAGON ? DRAGON : cell }\n\n\t\t# Lastly, remember when we started playing properly\n\t\t@start_tick = $gtk.args.tick_count\n\t\t@spawned = true\n\t\t@burniation = -1\n\t\t@burn_size = 1\n\n\tend",
"def randomizer\n output = []\n max = (@size * @size) - 1\n i = 0\n while i < @num_mines\n num = Random.new.rand(max)\n unless output.include?(num)\n output << num\n i += 1\n end\n end\n output.sort\n end",
"def remix(ingredient_arrays)\n \n mixers = []\n \n ingredient_arrays.each do |array|\n mixers << array[1]\n end\n \n ingredient_arrays.each do |array|\n idx = rand(mixers.length)\n array[1] = mixers[idx]\n mixers.delete_at(idx)\n end\n \n return ingredient_arrays\n \nend",
"def generate\n (0..@horizontal_size-1).each do |column|\n (0..@vertical_size-1).each do |row|\n val = Settings.get_random.rand(0..10)\n @map[column][row] = val > 3 ? 1 : 2\n end\n end\n end",
"def create_joiners(person)\n plants_number = rand(1..4)\n plants_number.times do \n PlantParenthood.create(\n plant_id: Plant.all.sample.id, \n person_id: person.id, \n affection: rand(101), \n favorite?: [true, false].sample\n )\n end\nend",
"def fourth_puzzle\n rng = Random.new\n ret = []\n 10.times { ret.push(rng.rand(55..100)) }\n return ret\nend",
"def srand(seed)\n @prng = Mtwist.new(seed)\n end",
"def draw(number_of_elements = 1)\n return [] if empty?\n (1..number_of_elements).to_a.map { random_element }\n end",
"def simulatedAnnealing(is,cS,cC,bSolution,bCost,temp,final_temp,alpha)\n #membuat array untuk menampung setiap solusi\n solusiTemp = {}\n solusiBestSolution = {}\n solusiBestCost= {}\n j=1 #insisialisasi\n while temp > final_temp do\n\n for i in 1..100\n #memunculkan bilangan random untuk perbandingan sekarang dengan yang baru\n x11 = fungsiRandom()\n x22 = fungsiRandom()\n nS = [x11,x22] #state baru\n nC = cost(nS) #perhitungan fungsi dari state baru\n end\n if nC < cC then #membandingkan costBaru dengan costSekarang\n cS = nS\n cC = nC\n if cC < bCost then #jika costBaru lebih kecil dari costSekarang maka bandingkan dengan bestCost\n bSolution = cS\n bCost = cC\n end\n else #jika tidak maka diliat nilai probab\n #ilitasnya lalu bandignkan dengan nilai random(0,1)\n if (prob(nC,cC,temp) > fungsiRandom01()) then\n cS = nS\n cC = nC\n end\n #menampung solusi\n solusiTemp[j] = temp\n solusiBestSolution[j] = bSolution\n solusiBestCost[j] = bCost\n end\n j = j+1\n temp = temp * alpha #Menghitung penentu iterasi temperatur\n end\n xx = solusiTemp[solusiTemp.length]\n y = bSolution\n z = bCost\n #mengembalikan nilai solusi\n return solusiTemp,solusiBestSolution,solusiBestCost,xx,y,z\n\nend",
"def create_random_array(size=5)\n Array.new(size) { Array.new(size) { [\"Yes\", \"No\", \"Maybe\"].sample } }\n end",
"def techno_percussion len\n self << len.Dist # bass drum\n mapee_last.clear_hits\n mapee_last << 4.eqly_spaced\n # max len is full, min quarter\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len*0.666/h_num, len*0.11/h_num) \n\n self << len.Dist # snare\n mapee_last.clear_hits\n mapee_last << [0.25,0.75]\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len/h_num, len/h_num/2) \n \n self << len.Dist # hi\n mapee_last.clear_hits\n mapee_last << 4.eqly_spaced\n mapee_last.hits.move(0.125) # offbeats\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len*0.666/h_num, len*0.666/h_num/2) \n \n self\n end",
"def tirar_dado\r\n\trand 1..6\r\nend",
"def permutation_rnd(x,y,ordre,miniter)\n d = longueur(x,y,ordre)\n d0 = d+1\n it = 1\n while d < d0 or it < miniter\n it += 1\n d0 = d\n for i in 1...(ordre.length-1)\n for j in i+2...(ordre.length + 1)\n k = rand(1..(ordre.length-1))\n l = rand(k+1..ordre.length)\n r = Array(ordre[k...l])\n r = r.reverse\n ordre2 = ordre[0...k] + r + ordre[l..-1]\n t = longueur(x,y,ordre2)\n if t < d\n d = t\n ordre = ordre2\n end\n end\n end\n end\n return ordre\nend"
] | [
"0.6243649",
"0.59217685",
"0.5893277",
"0.5856784",
"0.5776432",
"0.5721965",
"0.56852",
"0.5674304",
"0.56340545",
"0.5625456",
"0.55678463",
"0.5542437",
"0.55388623",
"0.55388623",
"0.5529226",
"0.55228037",
"0.545155",
"0.54489034",
"0.54425913",
"0.5438104",
"0.54278755",
"0.53975093",
"0.5391811",
"0.5348765",
"0.53466755",
"0.5343705",
"0.53400683",
"0.53367823",
"0.5321697",
"0.53118104",
"0.5308861",
"0.53007644",
"0.5293888",
"0.5291976",
"0.5259562",
"0.5255429",
"0.5252495",
"0.5252495",
"0.5251093",
"0.5247012",
"0.5241072",
"0.52362686",
"0.52361506",
"0.523021",
"0.5226276",
"0.5223882",
"0.5201423",
"0.5201423",
"0.51854223",
"0.5174956",
"0.51700616",
"0.5154699",
"0.5154699",
"0.5153562",
"0.5153551",
"0.513235",
"0.51207334",
"0.51170987",
"0.5116856",
"0.51126474",
"0.51097",
"0.5105799",
"0.5099247",
"0.5097836",
"0.5090401",
"0.50888467",
"0.5086245",
"0.5086235",
"0.50855845",
"0.50812835",
"0.507209",
"0.5069549",
"0.5065415",
"0.5063253",
"0.5054677",
"0.5054189",
"0.50504166",
"0.5048319",
"0.5048166",
"0.50466204",
"0.50390977",
"0.5039065",
"0.50390166",
"0.5039014",
"0.503763",
"0.5036655",
"0.5036468",
"0.50351655",
"0.5032869",
"0.5030546",
"0.50281763",
"0.5025144",
"0.50244844",
"0.5024123",
"0.50233805",
"0.5021055",
"0.5018383",
"0.5015247",
"0.5008239",
"0.50015485",
"0.50009924"
] | 0.0 | -1 |
Function for 2d points, x and y | def initialize_2d(desviacion, cantidad, xpos, ypos, yd)
@matrix = []
cantidad.times do
@matrix << ([xpos + 2 * desviacion * rand - desviacion, ypos + 2 * desviacion * rand - desviacion, yd])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point(x,y)\n [x,y]\nend",
"def to_xy\n [x, y]\n end",
"def Point2dFromXY(arg0, arg1)\n ret = _invoke(1610743822, [arg0, arg1], [VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def draw_points(x0, y0, x1, y1)\n\t\t# Get array of points on line\n\t\tpoints = get_line(x0,x1,y0,y1)\n\t\t\n\t\tpoints.each do |point|\n\t\t\tx = point[:x]\t\n\t\t\ty = point[:y]\t\n\t\t\n\t\t\t# Convert cartesian coordinates\n\t\t\trow = convert_y_to_row(y)\n\t\t\tcolumn = convert_x_to_column(x)\n\n\t\t\t# Turn pixel on\n\t\t\tif(in_image(row,column)) then\n\t\t\t\t@image[row][column] = 1\n\t\t\tend\n\t\tend\n\n\tend",
"def vector_to(point2)\n end",
"def points_n2\n result = [:infinity]\n (0...@p).each do |x|\n (0...@p).each do |y|\n point = [x,y]\n result << point if valid?(point)\n end\n end\n result\n end",
"def to_xy\n a = self\n a = [a[0].x, a[0].y] if length == 1\n return *a\n end",
"def to_a\n [x_point,y_point]\n end",
"def points; end",
"def loc2(x,y)\n TwoDGridLocation.new x, y\nend",
"def point(x, y)\n primitive 'point ' + sprintf('%g,%g', x, y)\n end",
"def coords; {:x => @x, :y => @y} end",
"def draw2d(opengl_primitive, *points)\n end",
"def point?(x)\n x.int? || x.point2d?\nend",
"def carve_walls_from_point(x, y, grid)\n \nend",
"def Point2dOne\n ret = _invoke(1610743821, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def neighbor_points point\n validate_point(point)\n row, col, height = point[0], point[1], point[2]\n offsets = [[-1,-1,0], [-1,0,0], [0,-1,0], [0,1,0], [1,0,0], \\\n [1,1,0], [0,0,1], [0,0,-1]]\n offsets.map do |r,c,h|\n [row+r, col+c, height+h]\n end\n end",
"def coordinates\n [@y_location, @x_location]\n end",
"def coords\n [x, y]\n end",
"def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end",
"def points\n [top_left, top_right, bottom_left, bottom_right]\n end",
"def point\n x = []\n y = []\n case geometry.type\n when 'MultiPolygon'\n coordinates.each { |list| append_list list, x, y }\n when 'LineString'\n append coordinates, x, y\n when 'Point'\n x << coordinates.first\n y << coordinates.last\n else\n append_list coordinates, x, y\n end\n lon = x.reduce(&:+) / x.size\n lat = y.reduce(&:+) / y.size\n [lon.round(7), lat.round(7)]\n end",
"def obstructed?(new_x, new_y); end",
"def calculate_coordinates\n (\n egde(@x1, @y1, @x2, @y1) +\n egde(@x2, @y1, @x2, @y2) +\n egde(@x2, @y2, @x1, @y2) +\n egde(@x1, @y2, @x1, @y1)\n ).uniq\n end",
"def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end",
"def get_arr_x(x, y) \n x # this coordinate doesn't change\nend",
"def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend",
"def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end",
"def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end",
"def\n\t\tprint_point\n\t\tp \"(#{x}, #{y})\"\t\n\tend",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def plot_points(points = [])\n x = []\n y = []\n points << [(@parameters[:xhigh]-@parameters[:xlow])*2 + @parameters[:xhigh],\n (@parameters[:yhigh]-@parameters[:xlow])*2 + @parameters[:xhigh]] if points.empty?\n points.each do |p|\n x << p[0]\n y << p[1]\n end\n\n plot_generic(x, y, \"points pt 7\")\n end",
"def coordinates\n row_values.product(col_values)\n end",
"def initialize(*args)\n if args.size == 1\n arg = args.first\n if arg.is_a?(Point)\n @x, @y = arg.x, arg.y\n elsif arg.is_a?(Array) && arg.size == 2\n @x, @y = arg[0, 2]\n end\n elsif args.size == 2\n @x, @y = args[0, 2]\n end\n unless @x && @y && @x.numeric? && @y.numeric?\n raise 'arguments must be two numbers, or an array of two numbers'\n end\n end",
"def to_p\n Point2.new(@x, @y)\n end",
"def xy_to_spot(x, y)\n spot = x + (y * @columns_size)\n end",
"def petunin(points)\n\tif points.size() < 4\n\t\tputs \"Error on #{__LINE__} in #{__FILE__}\"\n\t\texit(1)\n\tend\n\t#return [x,x0,y,y0]\n\trect = find_rect(points)\n\tdx, phi, coef = get_transf_coef(rect)\n\tdx.each {}\n\t#rect = translate(rect, -dx[0], -dx[1])\n\trect = rotate(rect, phi)\n\trect = scale(rect, 1.0, coef)\n\n\t#points = translate(points, -dx[0], -dx[1])\n\tpoints = rotate(points,phi)\n\tpoints = scale(points, 1, coef)\n\n\tcentre = rect[0].zip(rect[2]).to_a.map { |u,v| (u+v)/2 }\n\trs = []\n\tpoints.each do |p|\n\t\trs << [dist(p, centre), p]\n\tend\n\trs = rs.sort\n\n\tres = []\n\n\trs.each do |r,p|\n\t\tel = Ellipse.new\n\t\tel.centre = centre\n\t\tel.axes = [r]*2\n\n\t\t#back\n\t\tel.scale(1, 1/coef)\n\n\t\tel.rotate(-phi)\n\t\tres << [el,p]\n\tend\n\n\treturn res\n\n\t# For testing reasons only\n\n\t#rect = scale(rect, 1, 1/coef)\n\t#points = scale(points, 1, 1/coef)\n\t#rect = rotate(rect, -phi)\n\t#points = rotate(points, -phi)\n\t#points.map! { |x| [x] }\n\n\t#points + [rect] + res.inject([]) { |sum,el| sum + [el.get_draw_data] }\nend",
"def map(points)\n points\n end",
"def Point2dInterpolate(arg0, arg1, arg2)\n ret = _invoke(1610743815, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def corner_points_of_entity(x, y)\n [\n [x, y],\n [x + Entity::WIDTH - 1, y],\n [x, y + Entity::HEIGHT - 1],\n [x + Entity::WIDTH - 1, y + Entity::HEIGHT - 1],\n ]\n end",
"def to_point\n CGPoint.new(first, second)\n end",
"def get_real_point\n pos_x = x * get_scale(:x)\n pos_y = y * get_scale(:y)\n return Point.new(pos_x, pos_y) unless (has_layer?)\n real_point = get_layer.get_real_point\n return Point.new(\n (real_point.x + pos_x),\n (real_point.y + pos_y)\n )\n end",
"def y_points\n points = []\n (0...width).each do |x|\n (0...height).reverse_each do |y|\n if (array[y][x]).nonzero? && (y + 1 >= height || (array[y + 1][x]).zero?)\n points << Point.new(x, y + 1) + @position\n end\n end\n end\n\n points\n end",
"def pt___x(n, y); ptdist(n, 1.0 - y); end",
"def matte_point(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n pixel = f.pixel_color(x, y)\n pixel.alpha = TransparentAlpha\n f.pixel_color(x, y, pixel)\n f\n end",
"def xy=(coords)\n raise ArgumentError unless is_point?(coords)\n @xy = coords\n end",
"def line(x, y)\n [x.value, y.value]\n end",
"def perpendicular_bisector(x1, y1, x2, y2)\n [\n x2 - x1,\n y2 - y1,\n 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1)\n ]\n end",
"def *(other)\n case other\n when Point\n x * other.x + y * other.y\n when Numeric\n Point.new(x * other, y * other)\n when Array\n self * Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end",
"def points_on_a_line(x0, y0, x1, y1)\n raise NotImplementedError\n dx = (x1 - x0).abs\n dy = -(y1 - y0).abs\n step_x = x0 < x1 ? 1 : -1\n step_y = y0 < y1 ? 1 : -1\n err = dx + dy\n coords = Array.new\n coords << [x0, y0]\n (\n begin\n e2 = 2 * err\n\n if e2 >= dy\n err += dy\n x0 += step_x\n end\n\n if e2 <= dx\n err += dx\n y0 += step_y\n end\n\n coords << [x0, y0]\n end\n\n ) until (x0 == x1 && y0 == y1)\n coords\n end",
"def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end",
"def get_hatch_points_y(points, y)\r\n plane = [Geom::Point3d.new(0, y, 0), Geom::Vector3d.new(0,1,0)]\r\n pts = []\r\n for i in 0..points.length-1 do\r\n y1 = points[i-1].y\r\n y2 = points[i].y\r\n # very small differences in Y values will cause the following tests to 'next' when they should not\r\n # ie Y might display as 2.9mm but be 1e-17 different than the point.y, and y < y1 so you get no point\r\n # where you want a point\r\n # rather use signed differences\r\n# next if (y1 == y2)\r\n# next if ((y1 > y2) && ((y > y1) || (y < y2)))\r\n# next if ((y1 < y2) && ((y < y1) || (y > y2)))\r\n#puts \"y1 #{y1} y2 #{y2}\" \r\n# dif = (y1-y2).abs\r\n if ((y1 - y2).abs < 0.001) # small enough?\r\n next\r\n end\r\n d1 = y - y1\r\n d2 = y - y2\r\n if ((y1 > y2) && ((d1 > 0.0001) || (d2 < -0.0001)))\r\n next\r\n end\r\n if ((y1 < y2) && ((d1 < -0.0001) || (d2 > 0.0001)))\r\n next\r\n end\r\n\r\n line = [points[i-1], points[i]]\r\n pt = Geom::intersect_line_plane(line, plane)\r\n# if ((pt.x < 237.0) || (pt.x > 366.0))\r\n# puts \"y1#{y1} y2#{y2} dif#{dif.to_mm} pt #{pt} Y #{y.to_mm} line #{line}\"\r\n# end\r\n if (pt)\r\n pts << pt\r\n end\r\n end #for\r\n pts.uniq!\r\n return pts.sort{|a,b| a.x <=> b.x}\r\n end",
"def dist (x1, y1, x2, y2)\n return (x1 - x2) ** 2 + (y1 - y2) ** 2\nend",
"def points_for_circle(x, y, r)\n cur_page.points_for_circle(x, y, r)\n end",
"def distance2d(x = 0, y = nil)\n if !y && x.respond_to?(:x)\n x, y = x.x, x.y\n else\n y ||= 0\n end\n\n Math.sqrt((x - self.x)**2 + (y - self.y)**2)\n end",
"def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end",
"def [](x, y)\n @pole[x][y]\n end",
"def collect_adjacent_points(coords)\n\t\tpoints = []\n\t\tx = coords[:x]\n\t\ty = coords[:y]\n\t\tx_range = ([0, x-1].max..[$dimensions[:x], x+1].min)\n\t\ty_range = ([0, y-1].max..[$dimensions[:y], y+1].min)\n\t\tx_range.each do |i|\n\t\t\ty_range.each do |j|\n\t\t\t\tpoints << {:x => i, :y => j} unless ( (i == x && j == y ) || occupied?(i, j))\n\t\t\tend\n\t\tend\n\t\tpoints\n\tend",
"def identity_y\r\n new_point = identity\r\n new_point.x = 0\r\n return new_point\r\n end",
"def point_to_index(x,y)\n return (x*(bpp >> 3))+(y*((bpp >> 3)*(width)))\n end",
"def calculate_coordinates\n bresenham(@x1, @y1, @x2, @y2)\n end",
"def get_points(x_point, y_point, slope, x_bound = 6, y_bound = 5)\n y_int = y_intercept(x_point, y_point, slope)\n x_values = [*0..x_bound]\n possible_y = [*0..y_bound]\n\n x_values.each_with_object([]) do |x, points|\n y = (slope*x) + y_int\n points << [x, y] if possible_y.include?(y)\n end\n end",
"def equal?(point)\r\n return true if @x == point.x and @y == point.y\r\n return false\r\n end",
"def curveto(cp1x, cp1y, cp2x, cp2y, x, y)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x, y)\n end",
"def responds_like_a_point?\n respond_to?(:x) && respond_to?(:y)\n end",
"def *(coef)\n Point.new(@x * coef, @y * coef)\n end",
"def get_point(pos)\n @grid[pos[0]][pos[1]]\n end",
"def in?(x, y)\n ((x-@x)**2) + ((y-@y)**2) <= (@r**2)\n end",
"def [](x, y)\n pixel2color(get_pixel(x, y))\n end",
"def contains?(point)\n contains_xy?(point.x, point.y)\n end",
"def dir_from_points(x1, y1, x2, y2)\n VECTOR_DIRECTIONS[[x2-x1, y2-y1]].first\n end",
"def get_line_coords(x, y)\n line = [[x,y]]\n loop do\n next_x, next_y = yield x, y\n @box[next_x] && @box[next_x][next_y] ? line << [next_x, next_y] : break\n x, y = next_x, next_y\n end\n line\n end",
"def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end",
"def node\n [@x, @y]\n end",
"def coords(x, y)\n return [x % WIDTH, y % HEIGHT]\n end",
"def crossPointsAround\n [KBPoint.new.init([x+1,y]),KBPoint.new.init([x-1,y]),KBPoint.new.init([x,y-1]),KBPoint.new.init([x,y+1])]\n end",
"def nn(x,y)\n measured = points.each_with_object(Hash.new { |h, k| h[k] = [] }) do |(coords, point), h|\n next if point.coords == [x, y]\n\n dist = point.dist(x, y)\n\n h[dist] << coords\n end\n\n measured.min_by { |k, _v| k }[1]\n end",
"def validate_x_y_coords(x, y)\n validate_x_coords(x)\n validate_y_coords(y)\n end",
"def position\n [x, y]\n end",
"def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end",
"def egde(x1, y1, x2, y2)\n ConsoleDraw::Figures::Line.new(x1, y1, x2, y2).calculate_coordinates\n end",
"def get_coords_from_node(node)\n\t\t[node.x,node.y]\n\tend",
"def point_in_canvas(x, y)\n [*1..canvas.size - 2].include?(y) && [*1..canvas.first.size - 2].include?(x)\n end",
"def vline(x, y1, y2, c)\n x, y1, y2 = x.to_i, y1.to_i, y2.to_i\n\n unless self.bounds?(x, y1) && self.bounds?(x, y2)\n puts \"ERR: Coordinates out of bounds\"\n return\n end\n\n (y1..y2).each {|y| self[y, x] = c}\n end",
"def path_to(x:, y:)\n x_signal = x / [x.abs, 1].max\n y_signal = y / [y.abs, 1].max\n\n if x.abs > y.abs\n [[1 * x_signal, 0]]\n elsif x.zero? && y.zero?\n [[0, 0]]\n else\n [[0, 1 * y_signal]]\n end\n end",
"def coords_of_neighbors(x, y)\n coords_of_neighbors = []\n (x - 1).upto(x + 1).each do |neighbors_x|\n (y - 1).upto(y + 1).each do |neighbors_y|\n next if (x == neighbors_x) && (y == neighbors_y)\n coords_of_neighbors << [neighbors_x, neighbors_y]\n end\n end\n coords_of_neighbors\n end",
"def main(points) # array with all the points\n #copy of the array by an especific cordinate\n #nlogn\n # This is a primitive, aka operations that are costless compared to the\n # total complexity we are aming for\n px = sort_by_cordinate(points, 0)\n py = sort_by_cordinate(points, 1)\n\n result = closest_pair(px, py)\nend",
"def [](*args)\n if args[0].is_a? Point\n grid[args[0].top][args[0].left]\n elsif args[0].is_a?(Integer) && args[1].is_a?(Integer)\n grid[args[1]][args[0]]\n else\n raise\n end\n rescue\n raise \"No point accessible with #{args.inspect}\"\n end",
"def new_point?(end_point)\n\t\tend_x, end_y = end_point\n\t\t!(pos_x == end_x && pos_y == end_y) \n\tend",
"def line(xx1, yy1, xx2, yy2)\n return \"some y out of range\" unless (0..@height).include?(yy1) && (0..@height).include?(yy2) \n return \"some x out of range\" unless (0..@width).include?(xx1) && (0..@width).include?(xx2)\n\n x1 = [xx1, xx2].min\n x2 = [xx1, xx2].max\n y1 = [yy1, yy2].min\n y2 = [yy1, yy2].max\n\n m = (y2.to_f - y1) / (x2 - x1)\n b = y2 - m * x2\n pixels = Array.new(@width, Array.new(@height, 0))\n\n (x1..x2).each do |x|\n column = Array.new(@height, 0)\n (y1..y2).each do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f / @density)\n yy = m * xx + b\n if yy >= y && yy < y + 1\n pixel = 1\n break\n end\n end\n column[y] = pixel\n end\n pixels[x] = column\n end\n\n PNM.create(pixels.transpose, {:type => :pbm})\n end",
"def vector2 xopr = [0, 0], y = nil\n\tVec2d.new xopr, y\nend",
"def to_array\n @points.collect { |p| [p.x, p.y] }\n end",
"def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end",
"def coords\n coord_list = []\n (@x..(@x + @size_x - 1)).each do |i|\n (@y..(@y + @size_y - 1)).each do |j|\n coord = [i, j]\n coord_list << coord\n end\n end\n\n return coord_list\n end",
"def xy(x = 0.5, y = 0.5, xt = :fraction, yt = :fraction)\n Kamelopard::XY.new x, y, xt, yt\n end",
"def getAt(x1, y1, x2, y2)\n if x1 == 0 || y1 == 0\n if x1 == 0 && y1 == 0\n return @sa[y2*@width + x2]\n elsif x1 == 0 && y1 != 0\n return @sa[y2*@width + x2] - @sa[(y1-1)*@width + x2]\n else # x1 != 0 && y1 == 0\n ty2 = y2*@width\n return @sa[ty2 + x2] - @sa[y2 + (x1 - 1)]\n end\n else\n tx1, ty1, tx2, ty2 = x1-1, (y1-1)*@width, x2, y2*@width\n return @sa[ty2 + tx2] - @sa[ty1 + tx2] - @sa[ty2 + tx1] + @sa[ty1 + tx1]\n end\n end",
"def point_f2p_new(coord)\n begin\n x = coord.x * (@top_right.x - @top_left.x) + coord.y * (@bottom_left.x - @top_left.x) + @top_left.x\n y = coord.x * (@top_right.y - @top_left.y) + coord.y * (@bottom_left.y - @top_left.y) + @top_left.y\n BPoint.new(x, y)\n rescue\n BPoint.new(0,0)\n end\n end",
"def curve(x1, y1, x2, y2, x3, y3)\n [x1.value, y1.value, x2.value, y2.value, x3.value, y3.value]\n end",
"def coordinates_to_indices(x, y)\n [x - 1, y - 1]\n end",
"def s\n Math.sqrt(x**2 + y**2)\n end",
"def create_projected_point_from_projected_coord(x, y)\n Rails.logger.debug \"RgeoGeometryAdapter Creating projected point geometry from x = #{x}, y = #{y}\"\n @geometry_factory.projection_factory.point(x, y) \n end"
] | [
"0.7030014",
"0.6635354",
"0.64439845",
"0.6437325",
"0.62981975",
"0.6279076",
"0.62583995",
"0.619676",
"0.61566496",
"0.615411",
"0.61453784",
"0.6118823",
"0.60863805",
"0.6083407",
"0.6077611",
"0.60636264",
"0.6033049",
"0.6029379",
"0.6028767",
"0.60246813",
"0.6001519",
"0.59803194",
"0.5976377",
"0.5966741",
"0.59323484",
"0.59313196",
"0.59242487",
"0.59229535",
"0.59185576",
"0.5914154",
"0.59056467",
"0.58984804",
"0.5886996",
"0.58508337",
"0.58485717",
"0.5840283",
"0.58366513",
"0.58207834",
"0.58084786",
"0.5808089",
"0.58047384",
"0.5789442",
"0.57780635",
"0.5772655",
"0.57677424",
"0.57452095",
"0.5739092",
"0.5732007",
"0.57304573",
"0.5726518",
"0.5718368",
"0.57143426",
"0.57124645",
"0.5710991",
"0.57085085",
"0.5695613",
"0.56918406",
"0.5683418",
"0.56816554",
"0.5681244",
"0.5675631",
"0.56659997",
"0.56569815",
"0.5656333",
"0.5654702",
"0.5642768",
"0.5637229",
"0.56364095",
"0.5630815",
"0.5627332",
"0.5625398",
"0.5621552",
"0.56214786",
"0.56211936",
"0.5620349",
"0.56186825",
"0.5617502",
"0.56170875",
"0.5611977",
"0.5606131",
"0.56050766",
"0.56049836",
"0.56014585",
"0.56014436",
"0.5582609",
"0.55786544",
"0.5559757",
"0.55531627",
"0.55371433",
"0.5528741",
"0.5528289",
"0.55224204",
"0.5520562",
"0.5517045",
"0.5515798",
"0.550886",
"0.550628",
"0.5500053",
"0.5494721",
"0.54892915",
"0.54826933"
] | 0.0 | -1 |
Function for 3d points, x, y and z | def initalize_3d(desviacion, cantidad, xpos, ypos, zpos, yd)
@matrix = Array.new
cantidad.times do
@matrix.push([xpos + 2 * desviacion * rand - desviacion, ypos + 2 * desviacion * rand - desviacion, zpos + 2 * desviacion * rand - desviacion, yd])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_point3d(pt)\n case pt\n when Array\n pt_a = pt.map(&:to_f)\n x, y, z = pt_a\n z ||= 0.0\n Point3d.new(x, y, z)\n when Point3d\n pt\n when WIN32OLE_RECORD\n Point3d.from_ole(pt) if pt.typename == \"Point3d\"\n end\n end",
"def to_ole_point3d(pt)\n case pt\n when ole_point3d?(pt)\n pt\n when Point3d\n create_ole_point(pt.x, pt.y, pt.z)\n when Array\n pt1 = pt.map(&:to_f)\n x, y, z = pt1\n z ||= 0.0\n create_ole_point(x, y, z)\n end\n end",
"def Point3dFromTransform3dTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743923, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromXYZ(arg0, arg1, arg2)\n ret = _invoke(1610743848, [arg0, arg1, arg2], [VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dProjectToPlane3d(arg0, arg1, arg2 = nil, arg3 = nil)\n ret = _invoke(1610744125, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_VARIANT, VT_BOOL])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dTripleProduct4Points(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743845, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def triangle_point(sPoint, a, b, c)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n a = a.to_f\r\n b = b.to_f\r\n c = c.to_f\r\n dx = (b*b - c*c + a*a) / (2*a)\r\n dy = Math.sqrt(b*b - dx*dx)\r\n pts[2] = Geom::Point3d.new(sPoint[0] + dx, sPoint[1] + dy, sPoint[2])\r\n return pts\r\nend",
"def Point3dFromMatrix3dTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743885, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dFromPoint3d(arg0)\n ret = _invoke(1610744187, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromVector3d(arg0)\n ret = _invoke(1610744207, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def zcrossproduct(point1, point2, point3)\n dx1 = point2.x - point1.x\n dy1 = point2.y - point1.y\n dx2 = point3.x - point2.x\n dy2 = point3.y - point2.y\n dx1*dy2 -dy1*dx2\n end",
"def Point3dFromTransform3dTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743922, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Range3dFromPoint3dPoint3dPoint3d(arg0, arg1, arg2)\n ret = _invoke(1610744084, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Transform3dFromPoint3d(arg0)\n ret = _invoke(1610743930, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def polymarker3d(x, y, z)\n n = equal_length(x, y, z)\n super(n, x, y, z)\n end",
"def polymarker3d(x, y, z)\n n = equal_length(x, y, z)\n super(n, x, y, z)\n end",
"def get_3d_polygon()\n height = get_keyword_value(\"HEIGHT\").to_f\n width = get_keyword_value(\"WIDTH\").to_f\n x = self.check_keyword?(\"X\")? self.get_keyword_value(\"X\").to_f : 0.0\n y = self.check_keyword?(\"Y\")? self.get_keyword_value(\"Y\").to_f : 0.0\n #counter clockwise\n origin = OpenStudio::Point3d.new( x, y , 0.0 )\n p2 = OpenStudio::Point3d.new(x + width , y,0.0 )\n p3 = OpenStudio::Point3d.new(x + width , y + height , 0.0 )\n p4 = OpenStudio::Point3d.new(x, y + height,0.0 )\n return [origin,p2,p3,p4]\n end",
"def xyz\n return [self.x,self.y,self.z]\n end",
"def Point3dFromTransform3d(arg0)\n ret = _invoke(1610743937, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromMatrix3dTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743883, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromXY(arg0, arg1)\n ret = _invoke(1610743849, [arg0, arg1], [VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromMatrix3dInverseTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743902, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromMatrix3dTransposeTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743886, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def to_p\n Point3.new(@x, @y, @z)\n end",
"def Transform3dFromMatrix3dAndFixedPoint3d(arg0, arg1)\n ret = _invoke(1610743934, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dOne\n ret = _invoke(1610743847, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Range3dFromPoint3dPoint3d(arg0, arg1)\n ret = _invoke(1610744081, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dInPolygonXY(arg0, arg1, arg2 = nil)\n ret = _invoke(1610744132, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_ARRAY | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dDotProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743839, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dProjectToRay3d(arg0, arg1, arg2, arg3 = nil, arg4 = nil)\n ret = _invoke(1610744126, [arg0, arg1, arg2, arg3, arg4], [VT_BYREF | VT_R8, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_VARIANT, VT_BOOL])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def xyz\n [x, y, z]\n end",
"def Point3dDotProduct3PointsXY(arg0, arg1, arg2)\n ret = _invoke(1610743840, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dFromTransform3dTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744221, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def point3c(point3c=nil,point3=self)\n (point3c ||= Point3c.new).set(point3.c_radius,point3.theta,point3.z)\n end",
"def Range3dFromPoint3d(arg0)\n ret = _invoke(1610744080, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def set3(x, y, z, n)\r\n\t\t\tif x<@dims && y<@dims && z<@dims\r\n\t\t\t\t@data[(@dims*x)+(@dims*x*y)+z]\r\n\t\t\telse\r\n\t\t\t\tfail \"Unable to store more than dimensions.\"\r\n\t\t\tend\r\n\t\tend",
"def unit(x=1,y=1,z=1)\n point3.unit!\n end",
"def Point3dFromMatrix3dTransposeTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743884, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def bezier3d(p1, p2, p3, p4, n)\n\tar = []\n\tar.push(p1)\n\tn.times do |i|\n\t\tt = (i+1).to_f / (n+1)\n\t\tp5 = intp3d(p1, p2, t)\n\t\tp6 = intp3d(p2, p3, t)\n\t\tp7 = intp3d(p3, p4, t)\n\t\tp8 = intp3d(p5, p6, t)\n\t\tp9 = intp3d(p6, p7, t)\n\t\tpz = intp3d(p8, p9, t)\n\t\tar.push(pz)\n\tend\n\tar.push(p4)\nend",
"def cross!(*args)\n vx, vy, vz = args.extract_vector3i!\n self.x, self.y, self.z = y * vz - z * vy, z * vx - x * vz, x * vy - y * vx\n self\n end",
"def Point3dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610743836, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dCrossProduct3PointsXY(arg0, arg1, arg2)\n ret = _invoke(1610743837, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Transform3dFromMatrix3dPoint3d(arg0, arg1)\n ret = _invoke(1610743929, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def dot(point3)\n (@x*point3.x)+(@y*point3.y)+(@z*point3.z)\n end",
"def Point3dFromSegment3dTangent(arg0)\n ret = _invoke(1610744250, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def distance_to(point3)\n Math.sqrt(((@x-point3.x)**2)+((@y-point3.y)**2)+((@z-point3.z)**2))\n end",
"def Point3dFromMatrix3dInverseTransposeTimesPoint3d(arg0, arg1)\n ret = _invoke(1610743903, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def point3s(point3s=nil,point3=self)\n (point3s ||= Point3s.new).set(point3.s_radius,point3.theta,point3.phi)\n end",
"def ==(point3)\n (@x == point3.x)&&(@y == point3.y)&&(@z == point3.z)\n end",
"def extract_vector3d!\n a = self\n if false and a.length == 0 then raise \"Expected vector coordinates\"\n elsif a.length >= 4 and a[0].kind_of? Numeric and a[1].kind_of? Numeric and a[2].kind_of? Numeric and\n a[3].kind_of? Numeric\n return Vector3d.new(a.slice!(0, 4))\n elsif a.length >= 3 and a[0].kind_of? Numeric and a[1].kind_of? Numeric and a[2].kind_of? Numeric\n return Vector3d.new(a.slice!(0, 3))\n elsif a.length >= 1 and a[0].kind_of? Vertex3d\n return a.slice!(0, 1).first\n elsif a.length >= 1 and a[0].kind_of? Array and (a[0].length == 3 or a[0].length == 4)\n return Vector3d.new(*a.slice!(0, 1).first)\n elsif a.length >= 1 and a.first.kind_of? Array and a.first.length == 1 and a.first.first.kind_of? Numeric\n i = a.slice!(0,1).first.first\n return Vector3d.new(i, i, i)\n elsif a.length == 1 and a[0].kind_of? Numeric # but a[1] and/or a[2] are not, so it's only 1 number\n return Vector3d.new(a.slice!(0, 1).first)\n elsif a.length == 0\n return Vector3d.new(0,0,0)\n end\n raise ArgumentError, \"Could not parse vector coordinates out of #{self.inspect}\"\n end",
"def Matrix3dFromPoint3dColumns(arg0, arg1, arg2)\n ret = _invoke(1610743894, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def to_xyz\n [x, y, z]\n end",
"def polyline3d(x, y, z)\n n = equal_length(x, y, z)\n super(n, x, y, z)\n end",
"def polyline3d(x, y, z)\n n = equal_length(x, y, z)\n super(n, x, y, z)\n end",
"def Point3dInterpolate(arg0, arg1, arg2)\n ret = _invoke(1610743853, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Matrix3dFromPoint3dRows(arg0, arg1, arg2)\n ret = _invoke(1610743895, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dFromTransform3dTransposeTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744222, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dTripleProduct(arg0, arg1, arg2)\n ret = _invoke(1610743844, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def center\n a, b, c, d = @points\n\n Geom::Point3d.new(\n (a.x + b.x + c.x + d.x) / 4,\n (a.y + b.y + c.y + d.y) / 4,\n (a.z + b.z + c.z + d.z) / 4\n )\n end",
"def Transform3dFromXYZ(arg0, arg1, arg2)\n ret = _invoke(1610743931, [arg0, arg1, arg2], [VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromMatrix3dRow(arg0, arg1)\n ret = _invoke(1610743906, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_I4])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dCrossProduct3Points(arg0, arg1, arg2)\n ret = _invoke(1610744157, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromSegment3dFractionParameter(arg0, arg1)\n ret = _invoke(1610744249, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromMatrix3dColumn(arg0, arg1)\n ret = _invoke(1610743904, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_I4])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def surface(x, y, z, option)\n # TODO: check: Arrays have incorrect length or dimension.\n nx = x.length\n ny = y.length\n super(nx, ny, x, y, z, option)\n end",
"def surface(x, y, z, option)\n # TODO: check: Arrays have incorrect length or dimension.\n nx = x.length\n ny = y.length\n super(nx, ny, x, y, z, option)\n end",
"def Vector3dFromMatrix3dTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744215, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dFromXYZ(arg0, arg1, arg2)\n ret = _invoke(1610744186, [arg0, arg1, arg2], [VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cross!(x=1/sqrt3,y=1/sqrt3,z=1/sqrt3)\n if x.kind_of? Numeric\n set((@y*z)-(@z*y), (@z*x)-(@x*z), (@x*y)-(@y*x))\n elsif x.point3_like?\n if y.kind_of? Numeric\n cross! x.x, x.y, x.z\n elsif y.point3_like?\n set(x).cross!(y)\n else\n raise_no_conversion y\n end\n else\n raise_no_conversion x\n end\n end",
"def Point3dAddPoint3dVector3d(arg0, arg1)\n ret = _invoke(1610744208, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def set( *args )\r\n fail_if_invalid()\r\n if args.size == 1\r\n # .set( Geom::Point3d )\r\n # .set( [ x, y, z ] )\r\n arg = args[0]\r\n if arg.is_a?( Geom::Point3d )\r\n @position = arg\r\n elsif arg.is_a?( Array )\r\n if arg.all? { |i| i.is_a?( Numeric ) }\r\n @position = Geom.Point3d.new( *arg )\r\n else\r\n raise ArgumentError, 'Array does not contain all Numeric.'\r\n end\r\n end\r\n elsif args.size == 3\r\n # .set( x, y, z )\r\n if args.all? { |i| i.is_a?( Numeric ) }\r\n @position = Geom.Point3d.new( *args )\r\n else\r\n raise ArgumentError, 'Arguments not all Numeric.'\r\n end\r\n else\r\n raise ArgumentError, \"Invalid arguments. (#{args.size})\"\r\n end\r\n @position.extend( TT::Point3d_Ex ) # Needed?\r\n @position\r\n end",
"def Transform3dFromWorldToPlane3d(arg0)\n ret = _invoke(1610744148, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_set_z_as_float\n obj = Geom::Point3d.new\n obj.z = 1000.0\n result = obj.z\n expected = 1000.0\n assert_equal(expected, result, 'expected does not match result.')\n end",
"def inv_3d\n format_3d(inv_dims_3d) if targets_3d.present?\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def Point3dFromRay3dTangent(arg0)\n ret = _invoke(1610744260, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dDotDifferenceVector3d(arg0, arg1, arg2)\n ret = _invoke(1610744206, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dAdd3ScaledVector3d(arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n ret = _invoke(1610744212, [arg0, arg1, arg2, arg3, arg4, arg5, arg6], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Transform3dFromPlane3dToWorld(arg0)\n ret = _invoke(1610744149, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dFromXY(arg0, arg1)\n ret = _invoke(1610744188, [arg0, arg1], [VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def to_s\n \"Point3: x #{x} y #{y} z #{z}\"\n end",
"def dot(*args)\n vx, vy, vz = args.extract_vector3i!\n x * vx + y * vy + z * vz\n end",
"def Range3dContainsPoint3d(arg0, arg1)\n ret = _invoke(1610744091, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dFromMatrix3dTransposeTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744216, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dFromRay3dFractionParameter(arg0, arg1)\n ret = _invoke(1610744241, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dZero\n ret = _invoke(1610743846, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Vector3dDotProductXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744162, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def axes3d(*)\n super\n end",
"def Vector3dFromTransform3dTimesVector3d(arg0, arg1)\n ret = _invoke(1610744219, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def test_set_z_as_fixnum\n obj = Geom::Point3d.new\n obj.z = 1000\n result = obj.z\n expected = 1000\n assert_equal(expected, result, 'expected does not match result.')\n end",
"def Vector3dSubtractPoint3dPoint3d(arg0, arg1)\n ret = _invoke(1610744197, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dIsPointInCCWSector(arg0, arg1, arg2, arg3, arg4)\n ret = _invoke(1610743861, [arg0, arg1, arg2, arg3, arg4], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dAdd2ScaledVector3d(arg0, arg1, arg2, arg3, arg4)\n ret = _invoke(1610744211, [arg0, arg1, arg2, arg3, arg4], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Point3dCrossProductXY(arg0, arg1)\n ret = _invoke(1610743838, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend",
"def grid3d(*)\n super\n end",
"def add_3(x, y, z)\n x + y + z\n end",
"def test_with_irregular_array3D1; show([[[0,0,0],[1,1,1]],\n [[0,0,0]]]) end",
"def Transform3dGetPointComponent(arg0, arg1)\n ret = _invoke(1610743921, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_I4])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def to_v\n Vector3.new(@x, @y, @z)\n end",
"def Point3dIsVectorInCCWSector(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743860, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end"
] | [
"0.71749216",
"0.6974889",
"0.693681",
"0.6843874",
"0.6802184",
"0.67917955",
"0.6784242",
"0.6745902",
"0.6725012",
"0.67101145",
"0.67022556",
"0.66521394",
"0.659573",
"0.65872043",
"0.65732133",
"0.65732133",
"0.65595686",
"0.655315",
"0.65271926",
"0.65048665",
"0.649709",
"0.6483687",
"0.6475274",
"0.6467696",
"0.6467663",
"0.6435931",
"0.638707",
"0.6383037",
"0.6369568",
"0.635908",
"0.6343917",
"0.6340463",
"0.6339319",
"0.633603",
"0.633301",
"0.6304988",
"0.6300458",
"0.6296894",
"0.62890124",
"0.62828207",
"0.62814415",
"0.6271339",
"0.62701833",
"0.62614083",
"0.6253211",
"0.62358606",
"0.62126404",
"0.6210273",
"0.61826956",
"0.6181642",
"0.6181536",
"0.61755025",
"0.61613595",
"0.61613595",
"0.61519235",
"0.61514056",
"0.6147198",
"0.6130065",
"0.61153185",
"0.6101392",
"0.6098831",
"0.60961187",
"0.6091507",
"0.6081786",
"0.6077266",
"0.6077266",
"0.6076241",
"0.60564643",
"0.60510665",
"0.60482824",
"0.60394263",
"0.6026705",
"0.59984934",
"0.5996255",
"0.5984239",
"0.5963964",
"0.5961848",
"0.59590316",
"0.595093",
"0.5950265",
"0.59422827",
"0.5932823",
"0.5914828",
"0.5869095",
"0.5834244",
"0.5831392",
"0.58199304",
"0.5817308",
"0.5808537",
"0.5803944",
"0.58035773",
"0.5803195",
"0.5799241",
"0.5797381",
"0.5780731",
"0.57741874",
"0.57615507",
"0.5761433",
"0.575619",
"0.57480764",
"0.5746208"
] | 0.0 | -1 |
watch all exist files modify event. | def start_watch_files
coffee_files.each do |file|
@notifier.watch(file, :modify) do
CoffeeCompiler.compile_file(file, true, true)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen_for_changes\n @semaphore.synchronize do\n @files_alive = []\n\n paths = initialize_paths(@paths, @dirs)\n directories = handle_paths(paths)\n if @opts[:recurse]\n update_changed_files(directories)\n end\n\n deleted_files = @file_cache.keys - @files_alive.uniq\n deleted_files.each do |filename|\n @file_cache.delete(filename)\n push_changes(filename, :removed)\n end\n end\n end",
"def watchable_files; end",
"def run_all\n #run_on_changes(Watcher.match_files(self, Dir.glob(\"**/*.*\")))\n @builder.notify(true)\n end",
"def changed_files\n until @changed.empty?\n descriptor = @changed.shift\n file = @watcher.watch_descriptors.delete(descriptor)\n watch(file)\n yield(file)\n end\n end",
"def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n files.delete(filename)\n next\n end\n if current_mtime != mtime \n updated << filename\n # update the mtime in file registry so we it's only send once\n files[filename] = current_mtime\n puts \"quick_serve: spotted change in #{filename}\"\n end\n end\n QuickServe::Rails::Snapshot.reset if updated != []\n false\n end",
"def files_changed(file, event)\n puts motivate\n # return true so that the watch loop keeps running\n return true\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob(File.join('**', '*.*'))))\n end",
"def run_on_changes(paths)\n if options[:all_on_change]\n paths = Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact)\n end\n paths = paths.select {|path| not options[:exclude] =~ path and File.file? path}\n\n directories = detect_nested_directories(watchers, paths, options)\n written = []\n\n directories.each do |directory, files|\n files.each do |file|\n begin\n act_on(directory, file)\n written << file\n rescue Exception => e\n error(e.message, file)\n throw :task_has_failed\n end\n end\n end\n if written.length > 0\n notify(written)\n end\n end",
"def watch( *glob )\n yield unless block_given?\n files = []\n loop do\n new_files = Dir[*glob].map {|file| File.mtime(file) }\n yield if new_files != files\n files = new_files\n sleep 0.5\n end\nend",
"def watch_files(files)\n @files.concat files\n self\n end",
"def changed_files\n @files.each do |file, stat|\n if new_stat = safe_stat(file)\n if new_stat.mtime > stat.mtime\n @files[file] = new_stat\n yield(file)\n end\n end\n end\n end",
"def scan_changed(&block) # :yields: file\n known_files.each do |known_file|\n new_mtime = mtime_for(known_file)\n if new_mtime != last_mtime[known_file]\n block.call(known_file)\n last_mtime[known_file]= new_mtime\n end\n end\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact))\n end",
"def run_all\n run_on_change(\n Watcher.match_files(\n self, \n Dir.glob(File.join(::Guard.listener.directory, '**', '*.s[ac]ss')).\n map {|f| f[::Guard.listener.directory.size+1..-1] }.\n reject {|f| partial?(f) }\n )\n )\n end",
"def run_all\n targets = Watcher.match_files(self, Dir.glob(\"**/*.*\"))\n run_on_changes targets\n end",
"def file_watcher; end",
"def file_watcher; end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.coffee')))\n end",
"def notify(changed_files)\n ::Guard.guards.each do |guard|\n paths = Watcher.match_files(guard, changed_files)\n guard.run_on_change paths unless paths.empty?\n end\n end",
"def fi_scan\n FileObj.all.each do |fo|\n fd = File.open(fo.abs_path)\n if dirty?(fo, fd)\n\t\t\t\twarn\n\t\t\t\tnotify_admin fo if CONFIG['notify_admin']\n\t\t\telse\n\t\t\t\tclean\n\t\t\tend\n puts fo.abs_path\n end\n end",
"def watch(&block)\n\n # Startup File Watcher\n script_changed = lambda { |modified, added, removed|\n\n @log.debug \"File(s) changed! - #{modified.join(\", \")}\" unless (modified.nil? || modified.empty?)\n @log.debug \"File(s) added! - #{added.join(\", \")}\" unless (added.nil? || added.empty?)\n @log.debug \"File(s) removed! - #{removed.join(\", \")}\" unless (removed.nil? || removed.empty?)\n\n block.call(modified, added, removed)\n }\n\n pig_listener = Listen.to(@project_root_path,\n :ignore => /(^\\..*$|logs.*)/)\n\n pig_listener.change(&script_changed)\n pig_listener.start\n\n\tend",
"def check_files(files)\r\n files_before = @file_info.keys\r\n used_files = {} \r\n files.each do |file|\r\n begin\r\n if @file_info[file]\r\n if @file_info[file].timestamp != File.mtime(file)\r\n @file_info[file].timestamp = File.mtime(file)\r\n digest = calc_digest(file)\r\n if @file_info[file].digest != digest\r\n @file_info[file].digest = digest \r\n @file_changed && @file_changed.call(file)\r\n end\r\n end\r\n else\r\n @file_info[file] = FileInfo.new\r\n @file_info[file].timestamp = File.mtime(file)\r\n @file_info[file].digest = calc_digest(file)\r\n @file_added && @file_added.call(file)\r\n end\r\n used_files[file] = true\r\n # protect against missing files\r\n rescue Errno::ENOENT\r\n # used_files is not set and @file_info will be removed below\r\n # notification hook hasn't been called yet since it comes after file accesses\r\n end\r\n end\r\n files_before.each do |file|\r\n if !used_files[file]\r\n @file_info.delete(file)\r\n @file_removed && @file_removed.call(file)\r\n end\r\n end\r\n end",
"def run_all\n run_on_additions(Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq))\n end",
"def notify(changed_files)\n ::Guard.guards.each do |guard|\n paths = Watcher.match_files(guard, changed_files)\n guard.run_on_change(paths) unless paths.empty?\n end\n end",
"def watch!(*globs)\n @watchlist.accept!(globs)\n end",
"def watch(opts)\n @watcher.set_files(opts[:files]) if opts[:files]\n @watcher.watch(method(:files_changed))\n end",
"def watch\n paths = [ Rails.root.join('app'), Rails.root.join('lib') ]\n @worker.log \"Watching files in #{paths}\"\n\n reloader = ActiveSupport::FileUpdateChecker.new(paths) { rework }\n Rails.application.reloaders << reloader\n\n ActionDispatch::Reloader.to_prepare do\n reloader.execute_if_updated\n end\n\n true\n end",
"def process_filesystem_event(event)\n absolute_filepath = event.absolute_name\n\n @file_patterns.each do |pattern|\n if FileMatcher.file_matches_pattern? absolute_filepath, pattern\n changed\n notify_observers @name, @path\n end\n end\n \n end",
"def refresh_watchers()\r\n paths = []\r\n\r\n # A list of all file paths the user passed in.\r\n unresolved_paths = @path.split(',')\r\n unresolved_paths = unresolved_paths.size == 0 ? @path : unresolved_paths\r\n\r\n # Glob all file paths and keep all readable files.\r\n for unresolved_path in unresolved_paths\r\n paths += Dir.glob(unresolved_path.strip).select do |resource|\r\n File.file?(resource) && File.readable?(resource)\r\n end\r\n end\r\n\r\n watched = @watched_files.keys\r\n\r\n # Files we are not yet watching.\r\n new_files = paths - watched\r\n\r\n # Files we are watching that no longer exist.\r\n dead_files = watched - paths\r\n\r\n start_watches(new_files)\r\n stop_watches(dead_files, true)\r\n end",
"def watch\n @listener ||= Listen.to(\n File.dirname(PATH),\n only: /\\A#{File.basename(PATH)}\\z/\n ) do |modified, added, removed|\n next if modified.empty? && added.empty? && removed.empty?\n\n reload\n end\n\n @listener.start\n end",
"def also_reload(*glob)\n Dir[*glob].each { |path| Watcher::List.for(self).watch_file(path) }\n end",
"def scan_now\r\n # Setup the checks\r\n # ToDo: CRC\r\n checks = {\r\n \t :name => {\r\n :use=>false,\r\n :proc=>Proc.new{ |the_file,stats| the_file.path }\r\n },\r\n :date => {\r\n :use=>false,\r\n :proc=>Proc.new{ |the_file,stats| stats.mtime }\r\n },\r\n :size => {\r\n :use=>true,\r\n :proc=>Proc.new{ |the_file,stats| stats.size }\r\n },\r\n }\r\n checks.each_pair{ |check_name,check|\r\n check[:use] = (@onmodify_checks == check_name) || ( @onmodify_checks.respond_to?( :include? ) && @onmodify_checks.include?( check_name ) )\r\n }\r\n\r\n #Check for add/modify\r\n @directory.rewind\r\n count = 0\r\n @directory.each{ |fname|\r\n file_path = \"#{@directory.path}/#{fname}\"\r\n next if (@name_regexp.respond_to?( :match ) && !@name_regexp.match( fname )) || !File.file?( file_path )\r\n the_file = File.new( file_path )\r\n file_stats = File.stat( file_path )\r\n\r\n saved_stats = @known_file_stats[file_path]\r\n new_stats = {}\r\n checks.each_pair{ |check_name,check|\r\n new_stats[check_name] = check[:proc].call( the_file, file_stats )\r\n }\r\n\r\n\t @known_files.push file_path if !@known_files.include? file_path\r\n\r\n if saved_stats\r\n if @on_modify.respond_to?( :call )\r\n sufficiently_modified = @onmodify_requiresall\r\n saved_stats = @known_file_stats[file_path]\r\n checks.each_pair{ |check_name,check|\r\n stat_changed = check[:use] && ( saved_stats[check_name] != new_stats[check_name] )\r\n if @onmodify_requiresall\r\n sufficiently_modified &&= stat_changed\r\n else\r\n sufficiently_modified ||= stat_changed\r\n end\r\n saved_stats[check_name] = new_stats[check_name]\r\n }\r\n @on_modify.call( the_file, saved_stats ) if sufficiently_modified\r\n end\r\n elsif @on_add.respond_to?( :call ) && (@scanned_once || @onadd_for_existing)\r\n @known_file_stats[file_path] = new_stats\r\n @on_add.call( the_file, new_stats )\r\n count += 1\r\n end\r\n the_file.close\r\n }\r\n\r\n # Check for removed files\r\n if @on_remove.respond_to?( :call )\r\n @known_file_stats.each_pair{ |path,stats|\r\n next if File.file?( path )\r\n stats[:path] = path\r\n @on_remove.call( stats )\r\n @known_file_stats.delete(path)\r\n }\r\n end\r\n\r\n @scanned_once = true\r\n return count\r\n end",
"def run_on_changes(paths)\n run_all()\n end",
"def watch\n @apks.each do |apk|\n file = apk.path\n if File.exist?(file)\n if apk.mtime != File.mtime(file) || apk.size != File.size(file)\n puts \"arquivo \\\"#{apk.fname}\\\" modificado.\"\n @apks.delete_at(apk.index - 1)\n verify(file)\n end\n else\n puts \"arquivo \\\"#{apk.fname}\\\" não encontrado\"\n end\n end\n end",
"def watch(have_changed, waiting = nil)\n @watching = true\n\n while @watching\n if files_changed?\n @watching = have_changed.call(@changed, @event)\n end\n\n sleep(1)\n\n waiting.call if waiting\n end\n end",
"def watch(file)\n return true if watching?(file) # if already watching\n if stat = safe_stat(file)\n @files[file] = stat\n end\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.tex')))\n end",
"def watch(*globs)\n @watchlist.accept(globs) unless globs.empty?\n @watchlist\n end",
"def start\n puts \"Watcher RUNNING------------------->\"\n loop do\n unless (diff = build_file_list - @org_file_list).empty?\n # sleep 0.5\n diff.each do |meta|\n @callbacks[:new_file_created].call(meta[0])\n end\n exit\n end\n sleep 0.5\n end\n end",
"def scan_now\n #Check for add/modify\n scan_dir(@directory)\n \n # Check for removed files\n if @on_remove.respond_to?( :call )\n @known_file_stats.each_pair{ |path,stats|\n next if File.file?( path )\n stats[:path] = path\n @on_remove.call( stats )\n @known_file_stats.delete(path)\n }\n end\n \n @scanned_once = true\n end",
"def glob_me\n was_changed = false\n files = Dir.glob(path + \"/*\")\n\n # add and monitor new files and directories\n files.each do |file|\n file_stat = File.lstat(file) rescue nil\n if (file_stat.directory?)\n unless (has_dir?(file)) # new directory\n # change state only for existing directories\n # newly added directories have to remain with NEW state\n was_changed = true\n ds = DirStat.new(file, self.stable_state)\n ds.set_event_queue(@event_queue) if @event_queue\n ds.monitor\n add_dir(ds)\n end\n else # it is a file\n unless(has_file?(file)) # new file\n # change state only for existing directories\n # newly added directories have to remain with NEW state\n was_changed = true\n fs = FileStat.new(file, self.stable_state)\n fs.set_event_queue(@event_queue) if @event_queue\n fs.monitor\n add_file(fs)\n end\n end\n end\n\n return was_changed\n end",
"def watch(directory)\n worker.watch(directory) do |modified_dirs|\n files = modified_files(modified_dirs)\n @callback.call(files) unless files.empty?\n end\n end",
"def run_on_change(paths)\n end",
"def modified_files; end",
"def run_on_change(paths)\n jammit\n end",
"def watch(watched_dirs)\n watched_dirs << @directory\n end",
"def mark_each_first_file_new_units\n to_mark = Regexp.new(%r{(hours|days)_ago/1/})\n @my_files.each do |f|\n if to_mark.match(f.fname)\n f.must_wait = true\n end\n end\n end",
"def run_on_changes(paths)\n restart\n end",
"def load_watcher\n require 'doozer/watcher'\n \n puts \"=> Watching files for changes\"\n watcher = FileSystemWatcher.new()\n \n # watcher.addDirectory(File.join(File.dirname(__FILE__),'../doozer/'), \"*.rb\")\n watcher.addDirectory( app_path + '/app/', \"**/*\")\n watcher.addDirectory( app_path + '/app', \"**/**/*\")\n watcher.addDirectory( app_path + '/config/', \"*.*\")\n watcher.addDirectory( app_path + '/lib/', \"*.*\")\n watcher.addDirectory( app_path + '/static/', \"*.*\")\n watcher.addDirectory( app_path + '/static/', \"**/**/*\")\n\n watcher.sleepTime = 1\n watcher.start { |status, file|\n if(status == FileSystemWatcher::CREATED) then\n puts \"created: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n elsif(status == FileSystemWatcher::MODIFIED) then\n puts \"modified: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n Doozer::Configs.clear_static_files\n elsif(status == FileSystemWatcher::DELETED) then\n puts \"deleted: #{file}\"\n load_files\n Doozer::Partial.clear_loaded_partials\n Doozer::MailerPartial.clear_loaded_partials\n Doozer::Configs.clear_static_files\n end\n }\n #don't join the thread it messes up rackup threading watcher.join()\n # p watcher.isStarted?\n # p watcher.isStopped?\n # p watcher.foundFiles.inspect\n end",
"def attach\n @monitored_paths.each {|path| SingleFileWatcher.new(path.to_s).attach(@loop) }\n end",
"def listen\n daemonize if @background\n @logger.log \"GIT FYNCY: Listening @ #{Time.now.ctime}\"\n relpath = method :relative_path\n files_to_remove = Set.new\n begin\n Listen.to!('.') do |modified, added, removed|\n begin\n self.sync\n rel_removed = removed.map(&relpath)\n files_to_remove.merge rel_removed\n files_to_remove.clear if @remote.rm files_to_remove\n rescue => e\n @logger.log e.inspect\n end\n end\n rescue SignalException\n exit 42\n ensure\n @logger.log \"\\n\"\n end\n end",
"def start\n puts \"Watching these files for changes #{glob}...\"\n configure_directory_watcher\n setup_graceful_exit\n \n directory_watcher.start.join\n end",
"def check(events)\n if !@check_warning_notified\n puts \"[NOTICE] Inherit from FileMonitor and override method check(events) or\\n use file_monitor_instance.run do|events| end to do anything when any file changes\"\n @check_warning_notified = true\n end\n end",
"def run_on_changes(paths)\n paths.each do |path|\n # use output_folder or default back to watched file location\n run_steering(path, @options[:output_folder] || File.dirname(path))\n end\n end",
"def track_files(glob); end",
"def observe_changes(from_root)\n affected_paths = Set.new\n sentinel_path = File.join(from_root, SENTINEL)\n\n # if the directory was recently created, it *seems* like it needs to\n # actually be written out before we start the watch, otherwise we don't\n # receive any events.\n #\n # Unfortunately, sync(3) is a slow/expensive operation and a\n # newly-created direcotry is probably not the most common use-case. As a\n # compromise, we sync(3) only if the directory appears to have been\n # created in the past few seconds.\n if (Time.now - File.stat(from_root).ctime) < 5\n Kernel.syscall(SYS_SYNC)\n end\n\n fsevent = FSEvent.new\n fsevent.watch(from_root, file_events: true, latency: LATENCY) do |paths, meta|\n done = false\n meta['events'].each do |evt|\n # Don't track directories. We could change this...\n next if evt['flags'].include?(ITEM_IS_DIR)\n path = evt['path']\n # Because macOS delivers these events with a configurable latency, we\n # have to wait for it to flush its pipeline before we can escape from\n # the run loop, so we push this sentinel event after invoking the\n # block. We know we're done when we receive it.\n if path.end_with?(SENTINEL)\n done = true\n else\n affected_paths << path\n end\n end\n raise Interrupt if done\n end\n thr = Thread.new { fsevent.run }\n # If we yield before the handler is set up, early events will be\n # discarded.\n sleep 1e-6 until fsevent.instance_variable_get(:@running)\n\n yield\n\n # Once the thread recieves the event for the sentinel_path, it will\n # return, and #join will return.\n FileUtils.touch(sentinel_path)\n thr.join\n File.unlink(sentinel_path) # clean up\n\n affected_paths\n end",
"def run_on_changes(paths)\n run(paths)\n end",
"def watch\n\nend",
"def directories_to_watch\n []\n end",
"def existing_files; end",
"def poll_changed_directories\n until stopped\n sleep(latency)\n report_changes\n end\n end",
"def run_on_changes(paths)\n changed_files, success = Runner.run(Inspector.clean(paths), watchers, options)\n notify changed_files\n\n throw :task_has_failed unless success\n end",
"def run_on_modifications(paths)\n @builder.notify\n end",
"def watchable_dirs; end",
"def listen\n @listener ||= Listen.to(@directory) do |modified, added, removed|\n to_reload = Set[] # list of component path to reload\n\n (added + modified + removed).each do |file|\n to_reload.add(file) if file.end_with? @suffix # add the file to the reload list if it's a component\n\n dependent_comps = @loaded_components.select{ |comp| comp.depend_on? file } # find every components that depend on the current file\n to_reload += dependent_comps.map(&:path) if dependent_comps # add their path to the reload list\n end\n\n unless to_reload.empty?\n @mutex.synchronize do\n info 'Waiting for all event threads to finish...' unless @bot.event_threads.empty?\n @bot.event_threads.each(&:join)\n\n to_reload.each { |file| reload! file }\n end\n end\n end\n\n @listener.start unless @listener.processing?\n end",
"def watch(directory)\n raise NotImplementedError, \"do whatever you want here, given the directory as only argument\"\n end",
"def watch_file(filename)\n known_resource_types.watch_file(filename)\n end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def run_on_changes(paths)\n paths.each do |path|\n system \"theme upload #{path}\"\n end\n end",
"def callback(paths, ignores, modified)\n @logger.info(\"File change callback called!\")\n @logger.info(\" - Paths: #{paths.inspect}\")\n @logger.info(\" - Ignores: #{ignores.inspect}\")\n @logger.info(\" - Modified: #{modified.inspect}\")\n\n tosync = []\n paths.each do |hostpath, folders|\n # Find out if this path should be synced\n found = catch(:done) do\n modified.each do |changed|\n match = nil\n ignores.each do |ignore|\n next unless match.nil?\n match = ignore.match(changed)\n end\n\n next unless match.nil?\n throw :done, true if changed.start_with?(hostpath)\n end\n\n # Make sure to return false if all else fails so that we\n # don't sync to this machine.\n false\n end\n\n # If it should be synced, store it for later\n tosync << folders if found\n end\n\n # Sync all the folders that need to be synced\n tosync.each do |folders|\n folders.each do |opts|\n ssh_info = opts[:machine].ssh_info\n do_rsync(opts[:machine], ssh_info, opts[:opts]) if ssh_info\n end\n end\n end",
"def monitor_changes(file, resolution=1)\n puts \"Monitoring #{file}...\"\n last_change = Time.now\n every_n_seconds(resolution) do\n check = File.stat(file).ctime\n if check > last_change\n yield file\n last_change = check\n elsif Time.now - last_change > 60\n puts \"Nothing's happened for a minute, I'm bored.\"\n break\n end\n end\nend",
"def run_on_changes(paths)\n paths.each do |path|\n unless updated?(path)\n return false\n end\n end\n true\n end",
"def filter_invalid_files\n real_files=[]\n @files.each do |file|\n if @edit_in_place\n if File.writable?(file)\n real_files << file \n else\n puts \"ERROR: File #{file} is not writable, ignoring.\"\n end\n else\n if File.readable?(file)\n real_files << file \n else\n puts \"ERROR: File #{file} is not readable, ignoring.\"\n end\n end\n end\n @files=real_files\n end",
"def poll_changed_dirs\n until @stop\n sleep(@latency)\n report_changes\n end\n end",
"def on_change(modified, added, deleted)\n # Modifications and additions are treated the same.\n (modified + added).uniq.each do |path|\n if file = Ichiban::ProjectFile.from_abs(path)\n begin\n @loader.change(file) # Tell the Loader that this file has changed\n file.update\n rescue Exception => exc\n Ichiban.logger.exception(exc)\n end\n end\n end\n \n # Deletions are handled specially.\n deleted.each do |path|\n Ichiban::Deleter.new.delete_dest(path)\n end\n \n # Finally, propagate this change to any dependent files.\n (modified + added + deleted).uniq.each do |path|\n begin\n Ichiban::Dependencies.propagate(path)\n rescue => exc\n Ichiban.logger.exception(exc)\n end\n end\n end",
"def cycle\n before_cycle\n\n rotation{|file| @watcher.watch(file) }\n @watcher.changed_files{|f| safe_load(f) }\n\n after_cycle\n end",
"def file_watcher=(_arg0); end",
"def file_watcher=(_arg0); end",
"def monitor(file_attr_to_checksum=nil)\n\n # Marking/Removing Algorithm:\n # assume that current dir is present\n # ls (glob) the dir path for child dirs and files\n # if child file is not already present, add it as new, mark it and handle its state\n # if file already present, mark it and handle its state.\n # if child dir is not already present, add it as new, mark it and propagates\n # the recursive call\n # if child dir already present, mark it and handle its state\n # marked files will not be remove in next remove phase\n\n # ls (glob) the dir path for child dirs and files\n globed_paths_enum = Dir.glob(@path + \"/*\").to_enum\n \n found_symlinks = {} # Store found symlinks under dir\n loop do\n globed_path = globed_paths_enum.next rescue break\n\n next unless is_globed_path_valid(globed_path)\n if File.symlink?(globed_path)\n add_found_symlinks(globed_path, found_symlinks)\n next\n end\n\n # Get File \\ Dir status\n globed_path_stat = File.lstat(globed_path) rescue next # File or dir removed from OS file system\n if globed_path_stat.file?\n # ----------------------------- FILE -----------------------\n child_stat = @files[globed_path]\n if child_stat\n # Mark that file exists (will not be deleted at end of monitoring)\n child_stat.marked = true\n # Handle existing file If we are not in manual mode.\n # In manual mode do nothing\n handle_existing_file(child_stat, globed_path, globed_path_stat) unless Params['manual_file_changes']\n else\n unless Params['manual_file_changes']\n # Handle regular case of new file.\n handle_new_file(child_stat, globed_path, globed_path_stat)\n else\n # Only create new content data instance based on copied/moved filed.\n handle_moved_file(globed_path, globed_path_stat, file_attr_to_checksum)\n end\n end\n else\n handle_dir(globed_path, file_attr_to_checksum)\n end\n end\n\n remove_not_found_symlinks(found_symlinks)\n\n GC.start\n end",
"def watch_src\n Dispatch::Queue.concurrent.async do\n raise \"$project_src_dir undefined.\" if ! $project_src_dirs\n\n dirs = $project_src_dirs.map { |dir| dir.stringByExpandingTildeInPath }\n options = FSEvent::CLI.parse(dirs.dup << '--file-events')\n format = options[:format]\n\n notifier = FSEvent::Notifier.new\n options[:urls].each do |url|\n puts \"watching #{url.path} with options #{options}\"\n notifier.watch(url.path, *options[:create_flags], options) do |event_list|\n event_list.events.each do |event|\n puts \"reload #{event.path}\"\n self.load_src File.basename(event.path.to_s)\n\n if block_given?\n puts \"yield to block\"\n yield\n end\n end\n end\n end\n notifier.run\n end\n end",
"def start_watching\n start_runner\n loop do\n if @files.detect { |file| File.exists?(file) && File.stat(file).mtime > @time }\n puts \"reloading sketch...\"\n $app && $app.close\n @time = Time.now\n GC.start\n start_runner\n reload_files_to_watch\n end\n sleep 0.33\n end\n end",
"def filter_nonexistent(modified_files); end",
"def notify_file_cp(src, dst)\r\n if @files.key?(src)\r\n @files[dst] = @files[src].clone\r\n else\r\n @files[src] = { exist: true }\r\n @files[dst] = { exist: true }\r\n end\r\n register_file_in_dirs(dst)\r\n end",
"def run_on_changes(paths)\n @builder.notify\n end",
"def run_on_change(paths)\n build_all_assets \"Assets have changed, rebuilding...\"\n end",
"def listen_for_changes\n Listen.to(input_dir.to_s) do\n sync\n end.start\n end",
"def update(sender)\n puts \"update was cllaed\"\n pattern=Regexp.new(sender.stringValue)\n filter_files(pattern)\n rescue\n filter_files(nil)\n end",
"def modified_files(options); end",
"def modified_files(options); end",
"def update_dir\n was_changed = false\n\n # monitor existing and absent files\n @files.each_value do |file|\n file.monitor\n\n if file.state == FileStatEnum::NON_EXISTING\n was_changed = true\n rm_file(file)\n end\n end\n\n @dirs.each_value do |dir|\n dir.monitor\n\n if dir.state == FileStatEnum::NON_EXISTING\n was_changed = true\n rm_dir(dir)\n end\n end\n\n was_changed = was_changed || glob_me\n\n return was_changed\n end",
"def start_watches(paths)\r\n for path in paths\r\n # Get or create a Position object for the file path.\r\n pos_file = @pos != nil ? @pos.get_position(path) : Position.new(path)\r\n # Create a LogState to track the log.\r\n log_state = LogState.new(pos_file, method(:emit_lines))\r\n # Start a timer to check for changes in the log and emit new lines.\r\n log_state.timer = timer_execute(:iis_file_watchers, @read_log_entires, repeat: false, &log_state.method(:emit_lines))\r\n @watched_files[path] = log_state\r\n end\r\n end",
"def setup_watcher\n this = self\n Handler.send(:define_method, :app) do\n this\n end\n\n @@load_paths.each do |name, path|\n Dir[\"#{self.app_path}/#{path}\"].each do |f|\n EM.watch_file(f, Handler)\n end\n end\n end",
"def on_change(directories, options = {})\n changes = fetch_records_changes(directories, options)\n unless changes.values.all? { |paths| paths.empty? }\n block.call(changes[:modified], changes[:added], changes[:removed])\n end\n rescue => ex\n Kernel.warn \"[Listen warning]: Change block raise an execption: #{$!}\"\n Kernel.warn \"Backtrace:\\n\\t#{ex.backtrace.join(\"\\n\\t\")}\"\n end",
"def report_changes\n changed_dirs = nil\n\n mutex.synchronize do\n return if @changed_directories.empty?\n changed_dirs = @changed_directories.to_a\n @changed_directories.clear\n end\n\n callback.call(changed_dirs, {})\n turnstile.signal\n end",
"def checkForObservers(devfile)\n begin\n path = \"/user/\" + params[:username] + \"/device/\" + params[:devicename] + \"/files\" + devfile.path + devfile.name\n devfile.file_observers.each do |fo|\n begin\n if fo\n XmppHelper::notificationToNode(fo, devfile, \"Content updated!\")\n end\n rescue Exception => ex\n putsE(ex)\n end \n end \n rescue Exception => e\n puts \"Error in cheking checking devfile for observers!\"\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n end",
"def watch( paths )\n chksum_errors = {}\n paths.map!{ |path| Dir[\"#{path}/**/*\"] }.flatten! if $r\n dirs = paths.select{ |path| File.directory? path }\n dirs.each do |dir|\n cd dir do\n begin\n chksum_manifest = load\n chksum_manifest = check chksum_manifest\n dump chksum_manifest\n rescue ChecksumError => error\n chksum_errors[dir] = error.message\n end\n end\n end\n chksum_errors\n end",
"def start\n $stderr.puts \"Watching filesystem events in: #{@existing_parent}\"\n\n callback = Proc.new do |modified, added, removed|\n if added.any? {|i| File.fnmatch(@watch_path, i) }\n puts \"Added: #{@watch_path}\"\n exit 0\n end\n end\n\n listener = Listen.to(@existing_parent, ignore!: [], &callback)\n listener.start\n\n # Set trap so that we can break out of `sleep`\n Signal.trap(\"INT\") do\n puts \"Exiting...\"\n exit 4\n end\n\n sleep\n end",
"def run_on_change(paths)\n copy_all_functions \"Functions have changed, copying over\"\n end",
"def monitor\n was_changed = false\n new_state = nil\n self_stat = File.lstat(@path) rescue nil\n if self_stat == nil\n new_state = FileStatEnum::NON_EXISTING\n @files = nil\n @dirs = nil\n @cycles = 0\n elsif @files == nil\n new_state = FileStatEnum::NEW\n @files = Hash.new\n @dirs = Hash.new\n @cycles = 0\n update_dir\n elsif update_dir\n new_state = FileStatEnum::CHANGED\n @cycles = 0\n else\n new_state = FileStatEnum::UNCHANGED\n @cycles += 1\n if @cycles >= @stable_state\n new_state = FileStatEnum::STABLE\n end\n end\n\n # The assignment\n self.state= new_state\n end",
"def scan_files\n raise \"scan_files must be redefined in children classes\"\n end"
] | [
"0.71931547",
"0.71086633",
"0.70951724",
"0.70945454",
"0.70710593",
"0.7065802",
"0.70382",
"0.702989",
"0.6975102",
"0.68732846",
"0.6819397",
"0.67969084",
"0.6793798",
"0.67830676",
"0.6729054",
"0.6675304",
"0.6675304",
"0.66505307",
"0.66266274",
"0.6611319",
"0.6532039",
"0.6528455",
"0.6526612",
"0.65176374",
"0.6504421",
"0.6491551",
"0.6470108",
"0.64411217",
"0.64260054",
"0.6422028",
"0.6417058",
"0.64148456",
"0.6403947",
"0.6402819",
"0.640106",
"0.63686764",
"0.6323927",
"0.6314135",
"0.6285209",
"0.628255",
"0.624632",
"0.62379265",
"0.62335086",
"0.6205625",
"0.6192986",
"0.6173292",
"0.6110937",
"0.60752845",
"0.6074599",
"0.6061197",
"0.60415584",
"0.6040293",
"0.6037899",
"0.6035765",
"0.602259",
"0.6021402",
"0.60199475",
"0.6007063",
"0.5996662",
"0.5996633",
"0.5995995",
"0.5984361",
"0.59709936",
"0.596064",
"0.59589493",
"0.5958261",
"0.59314406",
"0.5917532",
"0.5914806",
"0.59145343",
"0.5900395",
"0.58982",
"0.58880717",
"0.5883966",
"0.58788294",
"0.5872115",
"0.5861643",
"0.5861643",
"0.5850062",
"0.58353204",
"0.58321863",
"0.582501",
"0.5814372",
"0.5813531",
"0.5809852",
"0.5805207",
"0.5802811",
"0.58024085",
"0.58024085",
"0.5801671",
"0.5797123",
"0.5795093",
"0.57855517",
"0.5752081",
"0.57455367",
"0.574517",
"0.57253647",
"0.5718992",
"0.5713448",
"0.5697105"
] | 0.70518184 | 6 |
return the version of the package TODO deal with multiple publishers | def latest
version = nil
pkg(:list, "-Ha", @resource[:name]).each_line do |line|
v = parse_line(line.chomp)[:status]
case v
when "known"
return v
when "installed"
version = v
else
Puppet.warn "unknown package state for #{@resource[:name]}: #{v}"
end
end
version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_version\n @semver.to_s '%M.%m.%p%s'\n end",
"def version(packagename)\n\t\t\t\treturn(packages()[packagename].version)\n\t\t\tend",
"def version\n @version ||= if token.nil? || Array(packages).empty?\n '0.1.0'\n else\n packages.map do |p|\n Gem::Version.new(p['version'])\n end.sort.last.bump.to_s << '.0'\n end\n end",
"def version\n return @version if defined?(@version)\n \n @version = JSON.parse(File.read('package.json'))['version']\nend",
"def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end",
"def version\n resolved_version\n end",
"def pkg_version(item)\n # refactoring! :revision points to same revision as item!\n v = revision.checkout.extract_version\n return \"#{v}pre.#{item.version}.#{item.id}\"\n end",
"def get_version\n\t\tend",
"def published_version\n Rails.cache.fetch(\"published_version_for_#{name}\", expires_in: 10.minutes) do\n strategy.published_version\n end\n end",
"def version\n @gemspec.version || @version_helper.to_s\n end",
"def current_version\n @version\n end",
"def package_version(package)\n # use module version if it exists\n go_mod = package[\"Module\"]\n return go_mod[\"Version\"] if go_mod\n\n package_directory = package[\"Dir\"]\n return unless package_directory && File.exist?(package_directory)\n\n # find most recent git SHA for a package, or nil if SHA is\n # not available\n Dir.chdir package_directory do\n contents_version(*contents_version_arguments)\n end\n end",
"def version\n return last_version if versionable?\n version_number\n end",
"def get_version()\n\t\tend",
"def version\n @version\n end",
"def version\n @version ||= __determine_version\n end",
"def version\n case @version\n when Module\n \"#{@version::Major}.#{@version::Minor}.#{@version::Release}\"\n when Proc # not sure about this\n @version.call\n when NilClass\n 'unknown'\n else\n @version\n end\n end",
"def version\n\t\treturn @version ||= self.find_version\n\tend",
"def version\n @version || 0\n end",
"def installed_version\n logger.trace(\"#{new_resource} checking package version\")\n current_installed_version\n end",
"def version\n '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit>\n end",
"def version\n VERSION\n end",
"def version\n @version ||= data.version\n end",
"def version\n VERSION\n end",
"def version_number\n @version\n end",
"def installed_version(packagename)\n\t\t\t\treturn(installed_packages()[packagename].version)\t\t\t\t\n\t\t\tend",
"def version\n @version ||= create_version\n end",
"def publish_to_package_manager(version)\nend",
"def publish_to_package_manager(version)\nend",
"def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\nend",
"def current_version\n versions.first\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @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 version\n @version ||= '1.0'\n end",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def version\n build_string\n end",
"def version\n VERSION\n end",
"def version\n VERSION\n end",
"def version\n VERSION\n end",
"def package_version(pkg, version=pkg.latest, link_to_pkg=true, klass=\"version\")\n out = (link_to_pkg ? link_to(h(pkg.name), pkg) : pkg.name)\n (out += \" \" + content_tag(:span, \"(#{h(version)})\", :class => klass)) if version\n out\n end",
"def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end",
"def latest\n # If there's no \"latest\" version, we just return a placeholder\n result = :latest\n oldversion = properties[:ensure]\n case portstatus\n when '>', '='\n result = oldversion\n when '<'\n raise Puppet::Error, \"Could not match version info #{portinfo.inspect}.\" \\\n unless (m = portinfo.match(/\\((\\w+) has (.+)\\)/))\n source, newversion = m[1, 2]\n debug \"Newer version in #{source}\"\n result = newversion\n when '?'\n warning \"The installed package '#{pkgname}' does not appear in the \" \\\n 'ports database nor does its port directory exist.'\n when '!'\n warning \"The installed package '#{pkgname}' does not appear in the \" \\\n 'ports database, the port directory actually exists, but the ' \\\n 'latest version number cannot be obtained.'\n when '#'\n warning \"The installed package '#{pkgname}' does not have an origin \" \\\n 'recorded.'\n else\n warning \"Invalid status flag #{portstatus.inspect} for package \" \\\n \"'#{pkgname}' (returned by portversion command).\"\n end\n result\n end",
"def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def version\n get_scm_data if @_version.nil?\n @_version\n end",
"def latest\n # If there's no \"latest\" version, we just return a placeholder\n result = :latest\n status, info, portname, oldversion = [nil, nil, nil, nil]\n oldversion = properties[:ensure]\n case portstatus\n when '>','='\n result = oldversion\n when '<'\n if m = portinfo.match(/\\((\\w+) has (.+)\\)/)\n source, newversion = m[1,2]\n debug \"Newer version in #{source}\"\n result = newversion\n else\n raise Puppet::Error, \"Could not match version info #{portinfo.inspect}.\"\n end\n when '?'\n warning \"The installed package '#{pkgname}' does not appear in the \" +\n \"ports database nor does its port directory exist.\"\n when '!'\n warning \"The installed package '#{pkgname}' does not appear in the \" +\n \"ports database, the port directory actually exists, but the latest \" +\n \"version number cannot be obtained.\"\n when '#'\n warning \"The installed package '#{pkgname}' does not have an origin recorded.\"\n else\n warning \"Invalid status flag #{portstatus.inspect} for package \" +\n \"'#{pkgname}' (returned by portversion command).\"\n end\n result\n end",
"def version\n self.class.name + ' ' + VERSION\n end",
"def current_version\n version_number rev\n end",
"def version\n puts \"v0.3\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n name.split('_')[1]\n end",
"def publish_latest_version \n publish_version(latest_version)\n end",
"def package_name\n ver = if new_resource.version == 'latest'\n package_metadata[:version]\n else\n new_resource.version\n end\n \"Chef Development Kit v#{ver}\"\n end",
"def version(sender)\n v = ::Vdoc2Org::VERSION\n puts \"version: #{v}\"\n v\n end",
"def available_version(package_name, arch = nil)\n version(package_name, arch, true, false)\n end",
"def latest\n version = nil\n pkg(:list, \"-Ha\", @resource[:name]).each_line do |line|\n v = self.class.parse_line(line.chomp)[:status]\n case v\n when \"known\"\n return v\n when \"installed\"\n version = v\n when \"i--\"\n version = self.class.parse_line(line.chomp)[:version]\n else\n Puppet.warn \"unknown package state for #{@resource[:name]}: #{v}\"\n end\n end\n version\n end",
"def published_version\n Rails.cache.fetch(\"published_version_for_#{name}\", expires_in: 10.minutes) do\n f = open(\"http://download.opensuse.org/factory/repo/oss/media.1/build\")\n matchdata = %r{openSUSE-(.*)-i586-.*}.match(f.read)\n matchdata[1]\n end\n end",
"def version\n data.version\n end",
"def version\n @version ||= config(\"version\", \"0.0.1\")\n end",
"def version\n next_version\n end",
"def version\n @version ||= '1.0'\n end",
"def version\n @version_helper.to_s\n end",
"def version\n @version_helper.to_s\n end",
"def version_number\n return @version_number\n end",
"def default_version; end",
"def version\n path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__\n dir = File.dirname(path)\n if File.exist?(dir+'/version.stamp')\n version = File.read(dir+'/version.stamp')\n else\n version = \"Unknown version\"\n end\n version\n end",
"def get_cache_version\n data = get_from_cdn('version', {t: Time.now.to_i}, {public: true, uncompressed: true})\n\n unless data\n Tml.logger.debug('No releases have been published yet')\n return '0'\n end\n\n data['version']\n end",
"def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end",
"def version\n Cleaner.extract_version @id\n end",
"def latest\n output = npm_exec \"view #{@resource[:name]} versions\"\n output.split(/[^\\d\\.]+/).last\n end",
"def version\n return call('Bugzilla.version')\n end",
"def version\n @__version\n end",
"def version\n self[:version]\n end",
"def version\n\t\tmodule_info['Version'].split(/,/).map { |ver|\n\t\t\tver.gsub(/\\$Rev.s.on:\\s+|\\s+\\$$/, '')\n\t\t}.join(',')\n\tend",
"def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end",
"def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend",
"def installed_version(package_name, arch = nil)\n version(package_name, arch, false, true)\n end",
"def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"def version\n return ExtPubkey.version_from_purpose(number) if depth == 1\n ver ? ver : Bitcoin.chain_params.extended_pubkey_version\n end",
"def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend",
"def version\n versions.last.miq_semver.split(\".\").first + \".0.0\"\n end",
"def version\n read_property 'Version'\n end",
"def version\n self.class.version\n end",
"def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend"
] | [
"0.7481352",
"0.73648554",
"0.73506063",
"0.73107624",
"0.7064462",
"0.6987189",
"0.6973328",
"0.693692",
"0.68902993",
"0.68707144",
"0.6868122",
"0.6843051",
"0.6841027",
"0.68358505",
"0.6825646",
"0.68088144",
"0.6806174",
"0.6798599",
"0.6782503",
"0.67744935",
"0.6773506",
"0.6772479",
"0.67648107",
"0.6760928",
"0.6747484",
"0.67432034",
"0.67363465",
"0.6731537",
"0.6731537",
"0.67313725",
"0.67276406",
"0.67202175",
"0.67202175",
"0.67202175",
"0.67202175",
"0.67202175",
"0.67202175",
"0.67202175",
"0.67202175",
"0.67202175",
"0.6704342",
"0.6704342",
"0.6704342",
"0.6704342",
"0.6704342",
"0.6704342",
"0.6701027",
"0.6698711",
"0.66965365",
"0.6695981",
"0.6695981",
"0.6695981",
"0.66876864",
"0.6676873",
"0.6675337",
"0.66694033",
"0.6665813",
"0.6665813",
"0.66655606",
"0.66614115",
"0.66499954",
"0.6647882",
"0.6633568",
"0.6633376",
"0.663304",
"0.663304",
"0.66306245",
"0.6629954",
"0.66261804",
"0.6622664",
"0.6620612",
"0.66124886",
"0.66006595",
"0.65997857",
"0.6586744",
"0.6580647",
"0.65788704",
"0.6572048",
"0.6572048",
"0.65619075",
"0.6558986",
"0.6551466",
"0.65371835",
"0.653152",
"0.6528008",
"0.65207493",
"0.65087163",
"0.6502838",
"0.6500868",
"0.649767",
"0.64951086",
"0.6478988",
"0.6473295",
"0.6464986",
"0.6461376",
"0.6453896",
"0.6452796",
"0.6452443",
"0.64461505",
"0.6443892"
] | 0.66101414 | 72 |
update the package to the latest version available | def update
self.install
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n install\n end",
"def update\n # Install in pacman can be used for update, too\n self.install\n end",
"def update\n # Install in pacman can be used for update, too\n self.install\n end",
"def update!(**args)\n @package_name = args[:package_name] if args.key?(:package_name)\n @upgrade_to_version = args[:upgrade_to_version] if args.key?(:upgrade_to_version)\n end",
"def update\n library\n end",
"def auto_update\n Logger.log \"Updating #{gem.name}\"\n if gem.version\n update_version(:patch) and update_version(:minor) and update_version(:major)\n else\n update()\n end\n end",
"def upgrade(version)\n \n end",
"def update\n Puppet.debug \"Attempting to upgrade #{@resource[:name]}\"\n install unless mas_app\n mas('upgrade')\n end",
"def bump_patch_version; end",
"def pkg_update\n pkg_fetch unless File::exists? @srcdir\n\n sysprint \"#{@name} update: #{@fetch_url}\"\n\n protocol = @fetch_url.split(':')\n\n if protocol.length == 0\n syserr \"Invalid package source URL #{@fetch_url}\"\n raise\n end\n\n case protocol\n when /^http$/i, /^https$/i, /^ftp$/i\n sysprint \"#{@name}: can't update from protocol #{protocol}\"\n when /git/i\n git_update(@fetch_url)\n else\n syserr \"Unhandled URL type: #{protocol}\"\n raise\n end\n end",
"def update\n project.run \"apk update\"\n end",
"def update\n @repo.reset_hard\n @repo.pull_rebase\n log << \"Database updated. Now at: #{version}\"\n end",
"def action_update\n install_bundler\n run_bundler('update')\n set_state\n end",
"def update_version_method(version)\nend",
"def update!(**args)\n @version = args[:version] if args.key?(:version)\n end",
"def update\n `cd #{__dir__} && git pull origin master`\n install\nend",
"def update_datapackage\n update_file_in_repo(\"datapackage.json\", create_json_datapackage)\n end",
"def update\n if properties[:ensure] == :absent\n install\n else\n if @portorigin\n do_portupgrade portorigin, upgrade_options, resource[:package_settings]\n else\n warning \"Could not upgrade package '#{name}' which has no port origin.\"\n end\n end\n end",
"def update(options = { :build => :rb }) # Options: { :build => :rb/:beta/:dev }\n Bukkit::Server.download(\"http://dl.bukkit.org/latest-#{options[:build].to_s}/craftbukkit.jar\")\n end",
"def update_version_file\n version_file = @spec.version_file\n updated_version = Olag::Version::update(version_file)\n abort(\"Updated gem version; re-run rake\") if @spec.version.to_s != updated_version\n end",
"def upgrade_package host, package_name\n host.upgrade_package package_name\n end",
"def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end",
"def update!(**args)\n @has_dependencies = args[:has_dependencies] if args.key?(:has_dependencies)\n @is_installed = args[:is_installed] if args.key?(:is_installed)\n @version = args[:version] if args.key?(:version)\n end",
"def bump_minor_version; end",
"def update\n if properties[:ensure] == :absent\n install\n elsif @portorigin\n do_portupgrade portorigin, upgrade_options, resource[:package_settings]\n else\n warning \"Could not upgrade package '#{name}' which has no port origin.\"\n end\n end",
"def publish_latest_version \n publish_version(latest_version)\n end",
"def bump_major_version; end",
"def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end",
"def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end",
"def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end",
"def update!(**args)\n @dependencies = args[:dependencies] if args.key?(:dependencies)\n @has_dependencies = args[:has_dependencies] if args.key?(:has_dependencies)\n @version = args[:version] if args.key?(:version)\n end",
"def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end",
"def update_version(version_type)\n new_version = gem.last_version(version_type)\n\n if new_version == gem.version\n Logger.log_indent \"Current gem already at latest #{version_type} version. Passing this update.\"\n return true\n end\n\n Logger.log_indent \"Updating to #{version_type} version #{new_version}\"\n gem.version = new_version\n\n if update_gemfile and run_test_suite and commit_new_version\n true\n else\n revert_to_previous_version\n false\n end\n end",
"def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end",
"def update!(**args)\n @architecture = args[:architecture] if args.key?(:architecture)\n @package_name = args[:package_name] if args.key?(:package_name)\n @version = args[:version] if args.key?(:version)\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def latest\n upd = latest_info\n unless upd.nil?\n # FIXME: there could be more than one update for a package\n # because of multiarch\n return \"#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}\"\n else\n # Yum didn't find updates, pretend the current\n # version is the latest\n raise Puppet::DevError, \"Tried to get latest on a missing package\" if properties[:ensure] == :absent\n return properties[:ensure]\n end\n end",
"def upgrade\n project.run \"apk upgrade\"\n end",
"def update_previous_version_of_packages(task)\n begin\n server = get_xmlrpc_client\n task.packages.each do |package|\n next if !package.can_be_shipped?\n\n # use package.get_pkg_name for SCL packages\n param = server.call(\"getLatestRPMS\", task.previous_version_tag, package.get_pkg_name)\n nvr_info = param[1][0]\n unless nvr_info.nil?\n version = nvr_info['version']\n release = nvr_info['release']\n release = release.split('.')[1].gsub('_', '-')\n if release.include?(\"redhat\")\n abbreviated_version = version + '.' + release\n else\n abbreviated_version = version\n end\n package.previous_version = abbreviated_version\n package.save\n end\n end\n rescue Exception => e\n puts \"Error for task #{task.name} in finding previous version of packages\"\n puts \"Probably because its previous version tag is empty\"\n puts \"Previous_version_tag of task is: #{task.previous_version_tag}\"\n end\n end",
"def update!(**args)\n @apt_package = args[:apt_package] if args.key?(:apt_package)\n @cos_package = args[:cos_package] if args.key?(:cos_package)\n @googet_package = args[:googet_package] if args.key?(:googet_package)\n @qfe_package = args[:qfe_package] if args.key?(:qfe_package)\n @windows_application = args[:windows_application] if args.key?(:windows_application)\n @wua_package = args[:wua_package] if args.key?(:wua_package)\n @yum_package = args[:yum_package] if args.key?(:yum_package)\n @zypper_package = args[:zypper_package] if args.key?(:zypper_package)\n @zypper_patch = args[:zypper_patch] if args.key?(:zypper_patch)\n end",
"def update\n is_valid_project\n $VERBOSE = !options[:verbose].nil?\n name = File.basename(CURR_DIR)\n project_dir = CURR_DIR\n overwrite_config = !options[:overwrite_config].nil?\n version = options[:version]\n unless version == nil or OK_OBD_VERSIONS.include?(version)\n throw \"Specified version \\\"#{version}\\\" isn't supported.\\nTry one of the following:\\n #{OK_OBD_VERSIONS.join(\"\\n \")}\"\n end\n rebuild = !options[:rebuild].nil?\n download_openbd(version, rebuild) unless version.nil?\n update_project(name, version, false, overwrite_config, true) \n display \"#{name} updated to OpenBD #{version}\" unless version.nil?\n end",
"def update_everything\n announcing 'Updating All Packages' do\n chroot 'update_everything'\n end\n send_to_state('build', 'update_everything')\n end",
"def update\n r = install(true)\n # 4 == /No updates available for this image./\n return if [0,4].include? r[:exit]\n raise Puppet::Error, _(\"Unable to update %{package}\") % { package: r[:out] }\n end",
"def bump_patch_version()\n Juwelier::Commands::Version::BumpPatch.build_for(self).run\n end",
"def version_task\n update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']\n update_gemspec(:date, Date.today)\n\n update_version_file(gemspec.version)\n update_version_constant(gemspec.version)\n end",
"def update_version(new_version)\n contents = File.read(@gradle_properties)\n contents = contents.gsub(/(version[=:])#{@version}/, \"\\\\1#{new_version}\")\n File.open(@gradle_properties, 'w') { |file| file.write(contents) }\n end",
"def update!(**args)\n @available_package = args[:available_package] if args.key?(:available_package)\n @create_time = args[:create_time] if args.key?(:create_time)\n @id = args[:id] if args.key?(:id)\n @installed_package = args[:installed_package] if args.key?(:installed_package)\n @origin_type = args[:origin_type] if args.key?(:origin_type)\n @type = args[:type] if args.key?(:type)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update\n \n end",
"def update!\n if path = vendorized?\n type = File.symlink?(path) ? :symlink : :copy\n FileUtils.rm_rf normalize(:lib)\n send \"vendorize_with_#{type}\"\n say \"updated #{type} #{path} -> #{program(:version)}\"\n else\n ['dom.html', 'rhino.js', 'node.js'].each do |path|\n path = normalize path\n next unless File.exists? path\n contents = File.read(path).gsub /jspec-(\\d+\\.\\d+\\.\\d+)/, \"jspec-#{program(:version)}\"\n if program(:version) == $1\n say \"skipping #{path}; already #{$1}\"\n next\n end\n File.open(path, 'r+'){ |file| file.write contents } \n say \"updated #{path}; #{$1} -> #{program(:version)}\"\n end\n end\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end",
"def upgrade_direct!\n package \"Chef Development Kit v#{package_metadata[:version]}\" do\n source package_metadata[:url]\n checksum package_metadata[:sha256]\n end\n end",
"def update() end",
"def CanBeUpdated(package)\n props = Pkg.ResolvableProperties(\n package, #any version\n :package,\n \"\"\n )\n # find maximum version and remember\n # if it is installed\n max_ver = \"0\"\n max_is_installed = false\n Builtins.foreach(props) do |prop|\n cur_ver = Ops.get_string(prop, \"version\", \"0\")\n if VersionALtB(max_ver, cur_ver)\n max_ver = cur_ver\n # `installed or `selected is ok\n max_is_installed = Ops.get_symbol(prop, \"status\", :available) != :available\n Builtins.y2milestone(\"new max: installed: %1\", max_is_installed)\n end\n end\n !max_is_installed\n end",
"def latest\n #rug can only get a list of *all* available packages?\n output = rug \"list-updates\"\n\n if output =~ /#{Regexp.escape @resource[:name]}\\s*\\|\\s*([^\\s\\|]+)/\n return $1\n else\n # rug didn't find updates, pretend the current\n # version is the latest\n return @property_hash[:ensure]\n end\n end",
"def bump_patch_version()\n Jeweler::Commands::Version::BumpPatch.build_for(self).run\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @packages = args[:packages] if args.key?(:packages)\n end",
"def auto_minor_version_upgrade\n data[:auto_minor_version_upgrade]\n end",
"def auto_minor_version_upgrade\n data[:auto_minor_version_upgrade]\n end",
"def update ; end",
"def update!(**args)\n @major_version = args[:major_version] if args.key?(:major_version)\n @minor_version = args[:minor_version] if args.key?(:minor_version)\n @tertiary_version = args[:tertiary_version] if args.key?(:tertiary_version)\n end",
"def publish_to_package_manager(version)\nend",
"def publish_to_package_manager(version)\nend",
"def update\n @parent.gemset_update\n end",
"def bazel_update(from_version, to_version)\n upgrade_description = \"Update the bazel version #{from_version.nil? ? '' : \"from #{from_version} \"}to #{to_version}\"\n desc upgrade_description\n command(:\"patch_bazel_version_to_#{to_version}\") do |app|\n patched = patch_file('.bazelversion') do |content|\n from_version.nil? ? \"#{to_version}\\n\" : content.gsub(from_version, to_version)\n end\n if patched\n mysystem(\"git commit -m \\\"#{upgrade_description}\\\"\")\n end\n end\n end",
"def update\n mode == \"update\" || mode == \"autoupgrade\"\n end",
"def set_version\n self.version ||= latest_version + 1\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @packages = args[:packages] if args.key?(:packages)\n end",
"def upgrade_npm_packages\n Kernel.exec('bundle exec vite upgrade_packages')\n end",
"def update\n #Nothing necessary\n end",
"def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end",
"def update_version?\n append_version?\n end",
"def update\n # TODO: implement update\n end",
"def update_for\n update_for_items.collect(&:package)\n end",
"def latest_version\n self.class::Versions.max {|a, b| Ajaxlibs::VersionsTools.compare a, b}\n end",
"def update\n ws.config.interactive = false\n Autoproj::CLI::Update.new(ws).run(\n [], reset: :force,\n packages: true,\n config: true,\n deps: true,\n osdeps_filter_uptodate: true,\n osdeps: false\n )\n @update_failed = false\n true\n rescue StandardError => e\n # if this is true, the only thing the daemon\n # should do is update the workspace on push events,\n # no PR syncing and no triggering of builds\n # on PR events\n @update_failed = Time.now\n Autoproj.error e.message\n false\n end",
"def update!(**args)\n @change = args[:change] if args.key?(:change)\n @latest_version = args[:latest_version] if args.key?(:latest_version)\n @url = args[:url] if args.key?(:url)\n end",
"def patch_version; end",
"def latest\n # Refresh package metadata before looking for latest versions\n pkg(:refresh)\n\n lines = pkg(:list, \"-Hvn\", @resource[:name]).split(\"\\n\")\n\n # remove certificate expiration warnings from the output, but report them\n cert_warnings = lines.select { |line| line =~ /^Certificate/ }\n unless cert_warnings.empty?\n Puppet.warning(_(\"pkg warning: %{warnings}\") % { warnings: cert_warnings.join(', ') })\n end\n\n lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }\n\n # Now we know there is a newer version. But is that installable? (i.e are there any constraints?)\n # return the first known we find. The only way that is currently available is to do a dry run of\n # pkg update and see if could get installed (`pkg update -n res`).\n known = lst.find { |p| p[:status] == 'known' }\n if known\n options = ['-n']\n options.concat(join_options(@resource[:install_options])) if @resource[:install_options]\n return known[:ensure] if exec_cmd(command(:pkg), 'update', *options, @resource[:name])[:exit].zero?\n end\n\n # If not, then return the installed, else nil\n (lst.find {|p| p[:status] == 'installed' } || {})[:ensure]\n end",
"def apt_get_update_install\n @app.packages.present? ? install_additional_packages : update_apt\n end",
"def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }\n end",
"def update(packages)\n updated_repo = false\n current_package_filenames = @rp.get_package_files\n future_package_filenames = Array.new\n packages.each do |pkg_name, pkg_objs|\n pkg_objs.each do |pkg|\n pkg_filename = File.basename(pkg.path)\n future_package_filenames << pkg_filename \n # If the package file does not exist, link it\n unless current_package_filenames.include?(pkg_filename)\n updated_repo = true\n File.link(pkg.path, File.join(@path, pkg_filename))\n end\n end\n end\n\n to_del = current_package_filenames - future_package_filenames\n to_del.each do |file|\n updated_repo = true\n File.unlink(File.join(@path, file))\n end\n @rp.update(packages)\n end",
"def update\n app_dir = app_dir\n # there's probably a git gem we could use here\n system \"cd #{app_dir} && git pull\" unless app_dir.nil?\n system \"cd #{File.dirname(__FILE__)} && git pull\"\nend",
"def update\n raise NotImplementedError\n end",
"def update\n if @package.update(package_params)\n render :show, status: :ok, location: @package\n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end",
"def action_upgrade\n run_package_action(:upgrade)\n end",
"def latest\n url = \"https://pypi.python.org/pypi/#{URI.encode(@resource[:name])}/json\"\n result = self.open_jsonurl(url)\n result['info']['version'] if result != nil\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Error in contacting pypi.python.org: #{detail}\"\n end",
"def update\n raise NotImplementedError\n end"
] | [
"0.7670873",
"0.7574621",
"0.7574621",
"0.7141967",
"0.6950891",
"0.687627",
"0.6835481",
"0.67902696",
"0.6747972",
"0.6730853",
"0.67028064",
"0.66699004",
"0.66044164",
"0.6574911",
"0.6557067",
"0.6554257",
"0.65267116",
"0.6522931",
"0.64822567",
"0.6467083",
"0.6465875",
"0.64349246",
"0.6425306",
"0.64216906",
"0.6406805",
"0.63622224",
"0.63507336",
"0.62990266",
"0.62990266",
"0.62990266",
"0.62812155",
"0.62619907",
"0.6253438",
"0.62123185",
"0.62120825",
"0.61899835",
"0.61899835",
"0.6186001",
"0.6176723",
"0.6169596",
"0.61333996",
"0.6121032",
"0.61002094",
"0.609901",
"0.60924315",
"0.60913354",
"0.609006",
"0.6087016",
"0.6067184",
"0.6060217",
"0.6060217",
"0.60586554",
"0.60466796",
"0.6030434",
"0.6026532",
"0.6023677",
"0.60223514",
"0.6020393",
"0.6020393",
"0.60192597",
"0.6015096",
"0.59942174",
"0.59942174",
"0.5978735",
"0.5977855",
"0.5974109",
"0.59689814",
"0.5963166",
"0.5963166",
"0.5963166",
"0.5963166",
"0.5963166",
"0.5963166",
"0.5963166",
"0.5963166",
"0.5955568",
"0.59553987",
"0.59521663",
"0.5948085",
"0.59421384",
"0.59421384",
"0.5918656",
"0.59183604",
"0.5911842",
"0.5909172",
"0.59088033",
"0.5904088",
"0.5902145",
"0.5898981",
"0.5898655",
"0.5897251",
"0.5892641",
"0.58924687",
"0.5883155",
"0.58798337",
"0.5876992",
"0.5874808",
"0.58740944"
] | 0.72198856 | 4 |
list a specific package | def query
begin
output = pkg(:list, "-H", @resource[:name])
rescue Puppet::ExecutionFailure
# pkg returns 1 if the package is not found.
return {:ensure => :absent, :name => @resource[:name]}
end
hash = self.class.parse_line(output.chomp) || {:ensure => :absent, :name => @resource[:name]}
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_packages\n res = []\n out = Aptly::runcmd \"aptly mirror show -with-packages #{@name.quote}\"\n Aptly::parse_indented_list out.lines\n end",
"def packages\n FileList[package_path('.*')]\n end",
"def package_list(packages, version)\n Array(packages[:base]).join(' ') + ' ' + Array(packages[version]).join(' ')\n end",
"def package_list(packages, version)\n packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')\n end",
"def packages\n ::Packages::Package.all\n end",
"def package_info_command(*args)\n Licensed::Shell.execute(\"go\", \"list\", \"-e\", \"-json\", *Array(args)).strip\n end",
"def packages\n %w(dtach rtorrent)\nend",
"def list_packages(path,glob,rel)\n\t# user name and server name\n\tu,s=ENV['PKGSERVER'].split(\"@\")\n # Look for port option\n portOption = ENV['SSH_OPTS'].scan(/-p [0-9]+/)\n # Get port if set\n p = portOption.empty? ? 22 : portOption.first.split(\" \").last\n\n Net::SFTP.start(s,u,:port=>p) do |sftp|\n debs = [];\n sftp.dir.glob(path,glob) { |f| debs << f }\n \n versionRE=/^([^\\d]+[-_])(.*)([-_].+)$/\n\n debs.sort {|x,y| Gem::Version.new(y.name.match(versionRE).captures[1])<=>Gem::Version.new(x.name.match(versionRE).captures[1])}.each do |f|\n puts \"<tr><td><a href='#{rel}/#{f.name}'>#{f.name}</a></td>\"\n \n t=Time.at(f.attributes.mtime).strftime('%Y/%m/%d')\n mb = ((f.attributes.size/(1024.0*1024))*10).floor/10.0\n puts \"<td>#{t}</td><td>#{mb}M</td></tr>\"\n end\n end\n puts \"</table>\"\nend",
"def all_package_names\n each_autobuild_package.map(&:name)\n end",
"def packages; end",
"def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end",
"def query\n r = exec_cmd(command(:pkg), 'list', '-Hv', @resource[:name])\n return {:ensure => :absent, :name => @resource[:name]} if r[:exit] != 0\n self.class.parse_line(r[:out])\n end",
"def index\n @pagetitle = \"Packages\"\n @packages = Package.all\n end",
"def [](packagename)\n\t\t\t\treturn(packages()[packagename])\n\t\t\tend",
"def packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend",
"def index\n @package_items = @package.package_items\n end",
"def find_package_by_name(name)\n @packages[name]\n end",
"def list_installed(options={})\n software, version = parse_software_args((options[:software]||options[:package]||\"\"), options[:version])\n run_command(\"#{command} list #{software} | grep \\\"*\\\"\", options)\n end",
"def packages()\n\t\t\t\traise(PackageError, \"A full package list is not implemented on OpenBSD\")\n\t\t\tend",
"def packages\n @packages ||= []\n end",
"def packages\n @packages ||= []\n end",
"def index\n @packages = Package.all\n end",
"def index\n @packages = Package.all\n end",
"def index\n @packages = Package.all\n end",
"def index\n @packages = Package.all\n end",
"def opam_list(explicit: true)\n command=\"#{@packager} list --columns=name\"\n command+=\" --roots\" if explicit\n\t\t\t\tr=SH.run_simple(command, chomp: :line)\n\t\t\t\tr[2..]\n\t\t\tend",
"def list_forge_modules(module_list)\n unless @options[:silent]\n puts \"\\nListing discovered modules from CLI and/or Puppetfile:\\n\\n\"\n module_list.each do |name|\n puts \" #{name}\"\n end\n puts ''\n end\n end",
"def list_modules\n pal.list_modules\n end",
"def packages\n Dir[File.join($__HELLO_DIR__, 'packages/*/*.yml')]\n .map do |yml|\n info = YAML.load File.read yml\n info['dir'] = File.dirname yml if info\n info\n end\n .select {|p| p }\n .sort_by {|p| p['priority'] || 10 }\nend",
"def packages()\n\t\t\tend",
"def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1)\n info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end",
"def moduleList()\n res = \"\"\n leader = \" \"\n begin\n Dir.foreach($opdir) do |name|\n next unless name =~ /(.*)\\.rb$/\n require File.join(\"ri/op\", $1)\n klass = eval $1\n modDesc = klass::desc\n res << leader << $1 << \": \" << modDesc << \"\\n\"\n end\n rescue\n puts $!\n res = leader + \"no modules found...\"\n end\n res\nend",
"def installed_packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend",
"def list_modules module_type\n if module_type.empty?\n @colour.help \"ForGen module types: #{MODULE_TYPES}\"\n return\n end\n\n if MODULE_TYPES.include? module_type\n @colour.help \"Listing modules of type #{module_type}:\"\n Dir[\"#{DIR_MODULES}/#{module_type}/**/forgen_metadata.xml\"].select{ |file| !File.directory? file }.each_with_index do |case_name, case_number|\n @colour.help \"#{case_number}) #{case_name}\"\n end\n else\n @colour.error \"Module type [#{module_type}] does not exist\"\n end\nend",
"def lookup(package_name)\n pkgs = @rpms[package_name]\n if pkgs\n pkgs.sort.reverse\n else\n nil\n end\n end",
"def search_list(name, config)\n file = File.read(config)\n data = JSON.parse(file)\n packages = data.each { |x|\n if x[1][\"name\"] == name\n puts x[1][\"name\"].green + \"\\n-- \" + x[1][\"desc\"].green\n else\n puts x[1][\"name\"] + \"\\n-- \" + x[1][\"desc\"]\n end\n }\nend",
"def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end",
"def packages()\n\t\t\t\tpackages = installed_packages()\n\n\t\t\t\tpackagelist = `#{@finkbin} list -n`\n\n\t\t\t\tpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tpackages[linearr[0]] = PackageInfo.new()\n\t\t\t\t\tpackages[linearr[0]].name = linearr[0]\n\t\t\t\t\tpackages[linearr[0]].version = linearr[1]\n\t\t\t\t\tpackages[linearr[0]].description = linearr[2]\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend",
"def find_package_set(name)\n each_package_set.find { |set| set.name == name }\n end",
"def packages\n @packages ||= client.list_packages('duo-openvpn').response\n end",
"def query_package(pkg_name)\n @logger.info(\"Querying for #{pkg_name}\")\n @index[:packages].key?(pkg_name)\n end",
"def [](name)\n packages[name]\n end",
"def read_pkglist(filename)\n\tpkg_list = Array.new\n\tf = File.new(filename)\n\tbegin\n\t\twhile (line = f.readline)\n\t\t\t# line.chomp\n\t\t\t# $stdout.print line if line =~ /blue/\n\t\t\trawline = line.strip\n\t\t\tunless rawline == \"\"\n\t\t\t\trawtoks = rawline.split\n\t\t\t\tpkg_list.push(rawtoks[0]) unless rawtoks[0] =~ /^#/\n\t\t\tend\n\t\tend\n\trescue EOFError\n\t\tf.close\n\tend\n\treturn pkg_list\nend",
"def index\n @packages = Package.order(:name).paginate(page: params[:page], per_page: 10)\n end",
"def listpackages\n packages = []\n\n @repository.categories.each do |category|\n Architecture.dataset(category).each do |entry|\n source = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => entry[:architecture]\n }\n end\n end\n if category.eql? \"stage\"\n Component.dataset(category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => \"unknown\"\n }\n end\n end\n end\n end\n packages\n end",
"def find_package(word)\n\t\n\tTextMate.exit_show_tool_tip(\"Please select a class to\\nlocate the package path for.\") if word.empty?\n\t\n\t$package_paths = []\n\t$best_paths = []\n\t\n\tsearch_all_paths(word)\n\t\n\tif $package_paths.size > 0 and $best_paths.size > 0\n\t\t$package_paths = $best_paths + ['-'] + $package_paths\n\telse\n\t\t$package_paths = $best_paths + $package_paths\n\tend\n\n\tTextMate.exit_show_tool_tip \"Class not found\" if $package_paths.empty?\n\n\tif $package_paths.size == 1\n\n\t\t$package_paths.pop\n\t\n\telse\n\t\t\n\t\t# Move any exact hits to the top of the list.\n\t\t$best_paths = $package_paths.grep( /\\.#{word}$/ )\n\t\t\n\t\ti = TextMate::UI.menu($package_paths)\n\t\tTextMate.exit_discard() if i == nil\n\t\t$package_paths[i]\n\n\tend\n\nend",
"def search_packages(pattern)\n packages = RailsPwnerer::Base.all_packages\n Hash[packages.select { |key, value|\n pattern.kind_of?(Regexp) ? (pattern =~ key) : key.index(pattern)\n }.map { |key, value|\n # apt-cache search sometimes leaves version numbers out\n # Update the cache with version numbers.\n if value.nil?\n info = RailsPwnerer::Base.package_info_hash(\n Kernel.`(\"apt-cache show #{key}\"))\n packages[key] = value = info['Version']\n end\n [key, value]\n }]\n end",
"def list\n senders_id=cookies[ :user_id ]\n @create_packages=Packages.view_all_packages( senders_id )\n end",
"def list(command)\n case command.split.at(1)\n when \"artists\" || \"artist\" || \"Artists\" || \"Artist\"\n navigate(Artist)\n when \"songs\" || \"song\" || \"Songs\" || \"Song\"\n navigate(Song)\n when \"genres\" || \"genre\" || \"Genre\" || \"Genres\"\n navigate(Genre)\n else\n puts \"The commands are:\" + Commands::list\n end\n @library.each_with_index {|member, index| puts index.to_s + \".\" + member.name}\n prompt(\"list\")\n end",
"def relevant_packages\n packages.select { |p| p['version'] == version }\n end",
"def installed_packages()\n\t\t\tend",
"def package(index = 0)\n container.package(index)\n end",
"def packages_providing(component)\n matches = []\n `yum provides #{component}`.each_line { |l|\n matches << $1 if l =~ /(.*)\\.fc.*/\n }\n matches\nend",
"def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend",
"def packages\n manifest.each_with_object({}) do |(src, package_name), hsh|\n next if src.nil? || src.empty?\n hsh[package_name] ||= []\n hsh[package_name] << File.join(Licensed::Git.repository_root, src)\n end\n end",
"def each_package(&block)\n packages_by_name.each_value(&block)\n end",
"def check_all_packages\n packages_not_installed = []\n Constants::PACKAGES.each do |pkg|\n string = \"Looking for package #{pkg}...\"\n installed = check_package(pkg)\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append package name to packages_not_installed list\n packages_not_installed << pkg\n end #if\n end #do\n \n packages_not_installed\n end",
"def show\n @package = Package.find(params[:id])\n @pagetitle = \"Packages - #{@package.title}\"\n end",
"def index\n @package_types = PackageType.all\n end",
"def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end",
"def list_packages 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_list_packages_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ArtifactRegistry::V1beta2::ListPackagesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def list(pattern = /.*/)\n if Gem::Specification.respond_to?(:each)\n Gem::Specification.select{|spec| spec.name =~ pattern }\n else\n Gem.source_index.gems.values.select{|spec| spec.name =~ pattern }\n end\n end",
"def find_packages(name, constraint = nil)\n # implement inside child\n end",
"def index\n @file_packages = FilePackage.all\n end",
"def list_names\n @lib.list_names\n end",
"def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end",
"def list\n Lib.list @path, @no_follow\n end",
"def index\n @package = Package.find(params[:package_id])\n @package_details = @package.package_details\n end",
"def main_package_set\n each_package_set.find(&:main?)\n end",
"def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end",
"def populate_ks_pkg_list(options)\n pkg_list = []\n if options['service'].to_s.match(/centos|fedora|rhel|sl_|oel/)\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"@base\")\n end\n pkg_list.push(\"@core\")\n if options['service'].to_s.match(/[a-z]_6/)\n pkg_list.push(\"@console-internet\")\n pkg_list.push(\"@system-admin-tools\")\n end\n if not options['service'].to_s.match(/sl_6|[a-z]_5|fedora/)\n pkg_list.push(\"@network-file-system-client\")\n end\n if options['service'].to_s.match(/centos_[6,7]|fedora|sl_[6,7]/)\n if not options['service'].to_s.match(/fedora_2[3-9]|centos_6/)\n pkg_list.push(\"redhat-lsb-core\")\n if not options['service'].to_s.match(/rhel_[6,7]|oel_[6,7]|centos_7/)\n pkg_list.push(\"augeas\")\n pkg_list.push(\"tk\")\n end\n end\n if not options['service'].to_s.match(/fedora|_[6,7,8]/)\n pkg_list.push(\"ruby\")\n pkg_list.push(\"ruby-irb\")\n pkg_list.push(\"rubygems\")\n pkg_list.push(\"ruby-rdoc\")\n pkg_list.push(\"ruby-devel\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"augeas-libs\")\n pkg_list.push(\"ruby-libs\")\n end\n end\n if not options['service'].to_s.match(/fedora|el_[7,8]|centos_[6,7,8]/)\n pkg_list.push(\"grub\")\n pkg_list.push(\"libselinux-ruby\")\n end\n if options['service'].to_s.match(/el_[7,8]|centos_[7,8]/)\n pkg_list.push(\"iscsi-initiator-utils\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"e2fsprogs\")\n pkg_list.push(\"lvm2\")\n end\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"kernel-devel\")\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"automake\")\n pkg_list.push(\"autoconf\")\n pkg_list.push(\"lftp\")\n pkg_list.push(\"avahi\")\n end\n end\n pkg_list.push(\"kernel-headers\")\n pkg_list.push(\"dos2unix\")\n pkg_list.push(\"unix2dos\")\n if not options['service'].to_s.match(/fedora_2[4-9]|centos_6/)\n pkg_list.push(\"zlib-devel\")\n end\n if not options['service'].to_s.match(/fedora/)\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"libgpg-error-devel\")\n pkg_list.push(\"libxml2-devel\")\n pkg_list.push(\"libgcrypt-devel\")\n pkg_list.push(\"xz-devel\")\n pkg_list.push(\"libxslt-devel\")\n pkg_list.push(\"libstdc++-devel\")\n end\n if not options['service'].to_s.match(/rhel_5|fedora|centos_6/)\n pkg_list.push(\"perl-TermReadKey\")\n pkg_list.push(\"git\")\n pkg_list.push(\"perl-Git\")\n end\n pkg_list.push(\"gcc\")\n pkg_list.push(\"gcc-c++\")\n if not options['service'].to_s.match(/centos_|el_8/)\n pkg_list.push(\"dhcp\")\n end\n pkg_list.push(\"xinetd\")\n pkg_list.push(\"tftp-server\")\n end\n if not options['service'].to_s.match(/el_|centos_/)\n pkg_list.push(\"libgnome-keyring\")\n end\n if not options['service'].to_s.match(/rhel_5/)\n pkg_list.push(\"perl-Error\")\n end\n pkg_list.push(\"httpd\")\n if options['service'].to_s.match(/fedora/)\n pkg_list.push(\"net-tools\")\n pkg_list.push(\"bind-utils\")\n end\n if not options['service'].to_s.match(/fedora|el_8|centos_8/)\n pkg_list.push(\"ntp\")\n end\n pkg_list.push(\"rsync\")\n if options['service'].to_s.match(/sl_6/)\n pkg_list.push(\"-samba-client\")\n end\n end\n return pkg_list\nend",
"def find_package_definition(name)\n packages[validate_package_name_argument(name, require_existing: false)]\n end",
"def index\n @order_pack_packages = OrderPackPackage.all\n end",
"def package\n @options['package']\n end",
"def index\n @packages = paginate(Package.all)\n end",
"def find_package_set_by_name(name)\n @package_sets[name]\n end",
"def packages\n JSON.parse(package_metadata_command).values.flatten\n rescue JSON::ParserError => e\n message = \"Licensed was unable to parse the output from 'pnpm licenses list'. JSON Error: #{e.message}\"\n raise Licensed::Sources::Source::Error, message\n end",
"def query\n self.class.newstylepkgoutput\n begin\n output = pkg(:list, \"-H\", @resource[:name])\n rescue Puppet::ExecutionFailure\n # pkg returns 1 if the package is not found.\n return {:ensure => :absent, :name => @resource[:name]}\n end\n\n hash = self.class.parse_line(output.chomp) || {:ensure => :absent, :name => @resource[:name]}\n hash\n end",
"def list_takingpackage\n @con=Packages.confirm_package(cookies[:user_id]) \n end",
"def package(name)\n Packaged.instance self , name\n end",
"def command_get_device_list(command)\n\t\tdir = File.join(@module_dir, \"device\", \"*.rb\")\n\t\tDir.glob(dir) {|file| message(\" #{File.basename(file, \".rb\")}\") }\n\tend",
"def get_installed_modules_for_host(host)\n on host, puppet(\"module list --render-as pson\")\n str = stdout.lines.to_a.last\n pat = /\\(([^()]+)\\)/\n mods = str.scan(pat).flatten\n return mods\n end",
"def index\n @package_descriptions = PackageDescription.all\n\n end",
"def current_package\n @current_package\n end",
"def packages_list(owner, repo, opts = {})\n data, _status_code, _headers = packages_list_with_http_info(owner, repo, opts)\n return data\n end",
"def index\n @packages = @packages.sort_by {|p| p.name}\n @current_packages = @packages.select {|p| !p.old}\n @old_packages = @packages.select {|p| p.old}\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)DIR/\n #elsif pkg == :devel\n # next unless item[:dest] =~ /(INCLUDE|MAN)DIR/\n #else\n # throw \"bad pkg type\"\n #end\n dst = expand_dir(item[:dest])\n if item[:rename].nil?\n dst += '/' + src\n else\n dst += '/' + item[:rename]\n end\n dst.gsub!(/^\\/usr\\/local\\//, '/usr/') # KLUDGE: only true when making an RPM or DEB\n res.push dst\n end\n end\n res.join \"\\n\"\n end",
"def list(namespace)\n list = Dir.entries(make_path(namespace)) - %w{. ..}\n list.map! {|item| File.split(item)[1].to_sym}\n list.to_set\n end",
"def list_all_installable_packages(server)\n @connection.call('system.list_all_installable_packages', @sid, server)\n end",
"def go_list_deps\n args = [\"-deps\"]\n args << \"-mod=vendor\" if config.dig(\"go\", \"mod\") == \"vendor\"\n\n # the CLI command returns packages in a pretty-printed JSON format but\n # not separated by commas. this gsub adds commas after all non-indented\n # \"}\" that close root level objects.\n # (?!\\z) uses negative lookahead to not match the final \"}\"\n deps = package_info_command(*args).gsub(/^}(?!\\z)$/m, \"},\")\n JSON.parse(\"[#{deps}]\")\n end",
"def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tname = match[1]\n\t\t\t\t\t\tversion = match[2]\n\t\t\t\t\t\tdescription = match[3]\n\n\t\t\t\t\t\tpackages[name] = PackageInfo.new()\n\t\t\t\t\t\tpackages[name].name = name\n\t\t\t\t\t\tpackages[name].version = version\n\t\t\t\t\t\tpackages[name].description = description\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend",
"def packages_for_a_single_project\n project.packages\n end",
"def all(package, bundles)\n warn \"*** SPLIT PACKAGE: #{package} is exported by <#{bundles.join(\", \")}>\"\n return bundles\n end",
"def index\n @package_versions = PackageVersion.all\n end",
"def getPackages\n `wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.4.tar.gz`\n `wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz`\n `wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz`\n `tar zxf nagios-4.0.4.tar.gz`\n `tar zxf nagios-plugins-2.0.tar.gz`\n `tar zxf nrpe-2.15.tar.gz`\n end",
"def package\n return @children['package'][:value]\n end",
"def show\n @package = Package.find(params[:id])\n end",
"def package_name\n # TODO: verify renamed packages\n resource['title']\n end",
"def list_bundles\n BrickFTP::API::Bundle.all\n end",
"def list_bundles\n BrickFTP::API::Bundle.all\n end",
"def package_information\n puts\n puts \"%30s%s\" % [\"Plugin information : \", @package.metadata[:name]]\n puts \"%30s%s\" % [\"-\" * 22, \"-\" * 22]\n puts \"%30s%s\" % [\"Plugin Type : \", @package.plugintype.capitalize]\n puts \"%30s%s\" % [\"Package Output Format : \", @package_type.upcase]\n puts \"%30s%s\" % [\"Version : \", @package.metadata[:version]]\n puts \"%30s%s\" % [\"Iteration : \", @package.iteration]\n puts \"%30s%s\" % [\"Vendor : \", @package.vendor]\n puts \"%30s%s\" % [\"Post Install Script : \", @package.postinstall] if @package.postinstall\n puts \"%30s%s\" % [\"Author : \", @package.metadata[:author]]\n puts \"%30s%s\" % [\"License : \", @package.metadata[:license]]\n puts \"%30s%s\" % [\"URL : \", @package.metadata[:url]]\n\n if @package.packagedata.size > 0\n @package.packagedata = @package.packagedata.select{|k, v| v != nil}\n @package.packagedata.each_with_index do |values, i|\n if i == 0\n puts \"%30s%s\" % [\"Identified Packages : \", values[0]]\n else\n puts \"%30s%s\" % [\" \", values[0]]\n end\n end\n end\n end"
] | [
"0.72322726",
"0.69187444",
"0.68011403",
"0.6794119",
"0.6770573",
"0.66273046",
"0.6320337",
"0.6291789",
"0.6259277",
"0.62124026",
"0.61893344",
"0.6161955",
"0.61603963",
"0.6127052",
"0.61255234",
"0.6121941",
"0.607312",
"0.60133165",
"0.6004784",
"0.6002743",
"0.6002743",
"0.599806",
"0.599806",
"0.599806",
"0.599806",
"0.5989574",
"0.5983833",
"0.5943853",
"0.5930342",
"0.590861",
"0.5901578",
"0.5875364",
"0.58677775",
"0.586144",
"0.5857164",
"0.58193916",
"0.5816789",
"0.5815161",
"0.57917887",
"0.5777998",
"0.57699144",
"0.5737435",
"0.5733496",
"0.5726026",
"0.57151353",
"0.5697998",
"0.5677088",
"0.5670214",
"0.56681764",
"0.56620455",
"0.5637782",
"0.5635884",
"0.5630886",
"0.5617611",
"0.5610444",
"0.5604304",
"0.5583588",
"0.5567517",
"0.5564582",
"0.5559442",
"0.554948",
"0.55465955",
"0.55398715",
"0.5530776",
"0.5520367",
"0.5518626",
"0.5516749",
"0.550164",
"0.5492715",
"0.54824185",
"0.54800427",
"0.54798627",
"0.5475674",
"0.5472588",
"0.54701084",
"0.54668176",
"0.54662716",
"0.54591966",
"0.54459244",
"0.5443483",
"0.54384524",
"0.5434296",
"0.54299825",
"0.542658",
"0.5424263",
"0.5405824",
"0.5402453",
"0.54006374",
"0.5398429",
"0.5384133",
"0.5368313",
"0.53659225",
"0.53641796",
"0.5362688",
"0.5353835",
"0.5353576",
"0.534441",
"0.5331022",
"0.5330009",
"0.5330009",
"0.53252393"
] | 0.0 | -1 |
Cache the transposed vector, it gets used a lot | def transposed_search_vector
@transposed_search_vector ||= super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache\n @transpose\n end",
"def transposed(matrix, size)\n # TODO (Step 2): Implement on CPU\n return [1.0, 2.0, 3.0, 4.0]\nend",
"def transpose() end",
"def transpose\n Matrix[self.to_a]\n end",
"def transpose; end",
"def transpose(matrix)\n matrix[0][0], matrix[1][0], matrix[2][0], matrix[0][1], matrix[1][1], \n matrix[2][1], matrix[0][2], matrix[1][2], matrix[2][2] = \n matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], \n matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2] \nend",
"def transpose\n t = super()\n t.flip!\n end",
"def transpose!\n super()\n self.flip!\n end",
"def transpose\n FMatrix.new(@cols, @rows) do |matrix, row, col|\n matrix.set!(row, col, self.get(col, row))\n end\n end",
"def transpose(matrix)\n new_matrix = Array.new(3) { Array.new }\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |element, element_index|\n # binding.pry\n new_matrix[element_index][row_index] = element\n end\n end\n new_matrix\nend",
"def my_transpose(trans_arr)\n i, j = 0, 1\n array_copy = trans_arr.dup\n (i...trans_arr.length-1).each do |index_one|\n (j...trans_arr.length).each do |index_two|\n array_copy[index_one][index_two], array_copy[index_two][index_one] =\n array_copy[index_two][index_one], array_copy[index_one][index_two]\n end\n end\n array_copy\n end",
"def transpose(matrix)\n result = Array.new(matrix[0].length, []) #HARD - PASS BY REFERENCE ISSUE\n matrix.each do |row|\n row.each_with_index do |el, col_idx|\n result[col_idx] << el\n end\n end\n result\nend",
"def my_transpose\n transpose_arr = Array.new(self.length){Array.new(self.length)}\n self.each_with_index do |arr, idx1|\n arr.each_with_index do |ele, idx2|\n transpose_arr[idx2][idx1] = ele\n end\n end\n transpose_arr\n end",
"def transpose!(matrix)\n (0..2).each do |i1|\n (i1..2).each do |i2|\n matrix[i1][i2], matrix[i2][i1] = matrix[i2][i1], matrix[i1][i2]\n end\n end\n matrix\nend",
"def transpose(matrix)\n new_matrix = []\n (0...matrix.size).each { |index| new_matrix << column(matrix, index) }\n new_matrix\nend",
"def my_transpose\n ret = []\n i=0\n while i < self.length\n j=0\n ret2 = []\n while j < self[i].length\n ret2 << self[j][i]\n j += 1\n end\n ret << ret2\n i += 1\n end\n ret\n end",
"def my_transpose\n row_length = length\n col_length = first.length\n transposed = Array.new(col_length) { Array.new(row_length) }\n\n (0...row_length).each do |row|\n (0...col_length).each do |col|\n transposed[col][row] = self[row][col]\n end\n end\n transposed\n end",
"def transpose(matrix)\n size = matrix.first.size\n matrix.each_with_index.with_object(Array.new(size) {[]}) do |(arr, idx), trans_arr|\n arr.each_with_index do |el, i|\n trans_arr[i] << el\n end\n end\nend",
"def transpose\n return Matrix.new @rows.transpose\n end",
"def transpose(matrix)\narray1 = []\narray2 = []\narray3 = []\nretrun_matrix = []\n\nmatrix.each do |element_1, element_2, element_3|\n array1 << element_1\n array2 << element_2\n array3 << element_3\n end \n retrun_matrix << array1 \n retrun_matrix << array2\n retrun_matrix << array3 \n return retrun_matrix\nend",
"def transpose(permute = nil)\n if permute.nil?\n if self.dim == 1\n return self.clone\n elsif self.dim == 2\n new_shape = [self.shape[1], self.shape[0]]\n else\n raise(ArgumentError, \"need permutation array of size #{self.dim}\")\n end\n elsif !permute.is_a?(Array) || permute.sort.uniq != (0...self.dim).to_a\n raise(ArgumentError, \"invalid permutation array\")\n else\n # Figure out the new shape based on the permutation given as an argument.\n new_shape = permute.map { |p| self.shape[p] }\n end\n\n if self.dim > 2 # FIXME: For dense, several of these are basically equivalent to reshape.\n\n # Make the new data structure.\n t = self.reshape_clone_structure(new_shape)\n\n self.each_stored_with_indices do |v,*indices|\n p_indices = permute.map { |p| indices[p] }\n t[*p_indices] = v\n end\n t\n elsif self.list? # TODO: Need a C list transposition algorithm.\n # Make the new data structure.\n t = self.reshape_clone_structure(new_shape)\n\n self.each_column.with_index do |col,j|\n t[j,:*] = col.to_flat_array\n end\n t\n else\n # Call C versions of Yale and List transpose, which do their own copies\n if jruby?\n nmatrix = NMatrix.new :copy\n nmatrix.shape = [@shape[1],@shape[0]]\n twoDMat = self.twoDMat.transpose\n nmatrix.s = ArrayRealVector.new(ArrayGenerator.getArrayDouble(twoDMat.getData(), shape[1],shape[0]))\n return nmatrix\n else\n self.clone_transpose\n end\n end\n end",
"def transpose\n Matrix.columns(@rows)\n end",
"def matrix_transpose(matrix)\r\n m_row = 0\r\n t_col = 0\r\n result = []\r\n while matrix[m_row]\r\n m_col = 0\r\n t_row = 0\r\n while matrix[m_row][m_col]\r\n result.push([])\r\n result[t_row][t_col] = matrix[m_row][m_col]\r\n m_col += 1\r\n t_row += 1\r\n end\r\n m_row += 1\r\n t_col += 1\r\n end\r\n return result\r\nend",
"def my_transpose\n\n end",
"def transpose(matrix)\n row = matrix.length\n col = matrix[0].length\n res = Array.new(col) { Array.new(row)}\n (0...col).each do |i|\n (0...row).each do |j|\n res[i][j] = matrix[j][i]\n end\n end\n return res\nend",
"def transpose!(matrix)\n (0...matrix.size).each do |i|\n (i...matrix.size).each do |j|\n matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]\n end\n end\nend",
"def transpose!(matrix)\n copy_matrix = []\n matrix.each_with_index { |row, ind| copy_matrix[ind] = row }\n matrix[0].length.times { matrix.unshift([]) }\n copy_matrix.length.times { matrix.pop }\n matrix.each_with_index do |_, n_ind|\n copy_matrix.each_with_index do |_, ind|\n matrix[ind] << copy_matrix[n_ind][ind]\n end\n end\nend",
"def my_transpose\n result = Array.new(length) { Array.new(length) }\n self.each_with_index do |row, r|\n row.each_with_index do |num, c|\n result[r][c] = self[c][r]\n end\n end\n result\n end",
"def transpose!\n raise NotImplementedError\n end",
"def my_transpose\n transposed = []\n\n i = 0\n until transposed.length == length\n current = []\n self.each do |arr|\n current << arr[i]\n end\n i += 1\n transposed << current\n end\n\n transposed\n end",
"def my_transpose\n output = Array.new(self.length) {Array.new(self.length)}\n\n self.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n output[col_i][row_i] = self[row_i][col_i]\n end\n end\n output\n end",
"def transpose_of_matrix matrix\n\treturn Matrix.new(matrix.line, matrix.col, matrix.values.transpose)\nend",
"def my_transpose(matrix)\n transposed = []\n matrix.each_with_index do |row, i|\n new_row = []\n row.each_with_index do |ele, j|\n new_row << matrix[j][i]\n end\n transposed << new_row\n end\n transposed\nend",
"def transpose(a)\n # get the number of rows and columns\n # create empty matrix where # of rows = # of columns, and vice versa\n rows = a.length\n cols = a[0].length\n newA = Array.new(cols) {Array.new(rows)}\n\n i = j = 0\n while i < rows\n while j < cols\n # swap them\n newA[j][i] = a[i][j]\n j += 1\n end\n i += 1\n # don't forget to reset j after every column\n j = 0\n end\n\n newA\nend",
"def transpose(matrix)\n new_matrix = []\n matrix[0].size.times { |_| new_matrix.push(Array.new) }\n matrix.each do |array|\n # while iterating through array,\n # the next spot in each item in new_matrix gets successive items from array.\n array.size.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend",
"def transpose(matrix)\n results = Array.new(3){Array.new(3)}\n\n m = 0\n n = 0\n\n 3.times do \n results[m][n], results[m + 1][n], results[m + 2][n] = matrix[n]\n n += 1\n end\n\n results\nend",
"def transpose(matrix)\n new_matrix = []\n\n new_matrix_size = matrix[0].size\n\n new_matrix_size.times do |old_column|\n new_row = []\n\n matrix.size.times do |old_row|\n new_row << matrix[old_row][old_column]\n end\n\n new_matrix << new_row\n end\n\n new_matrix\nend",
"def my_transpose\n raise 'needs to be a square matrix' unless length == self[0].length\n\n transposed = []\n col = []\n\n each_index do |row_idx|\n temp_arr = []\n each do |sub_arr|\n temp_arr << sub_arr[row_idx]\n end\n transposed << temp_arr\n end\n\n transposed\n end",
"def transpose(matrix)\n first_array = [matrix[0][0], matrix[1][0], matrix[2][0]]\n second_array = [matrix[0][1], matrix[1][1], matrix[2][1]]\n third_array = [matrix[0][2], matrix[1][2], matrix[2][2]]\n final_array = [first_array, second_array, third_array]\nend",
"def transpose(matrix)\n transpose_matrix = []\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |item, col_index|\n if transpose_matrix[col_index] == nil\n transpose_matrix[col_index] = [] # cannot use a[index] << [] as it will raise error as a[index] return nil which do not have << method\n end\n transpose_matrix[col_index][row_index] = item\n end\n end\n \n transpose_matrix\nend",
"def transpose(matrix)\n result = []\n (0..2).each do |column_index|\n new_row = (0..2).map { |row_index| matrix[row_index][column_index] }\n result << new_row\n end\n result\nend",
"def transpose(matrix)\n #\n # your code goes here\n #\n i = 0\n while i < matrix.length\n j = i\n while j < matrix.length\n if i != j\n temp_value = matrix[i][j]\n matrix[i][j] = matrix[j][i]\n matrix[j][i] = temp_value\n end\n j += 1\n end\n i += 1\n end\n matrix\nend",
"def transpose(matrix)\n new_matrix = [[], [], []]\n matrix.each do |array|\n 3.times do |i|\n new_matrix[i] << array[i]\n end\n end\n new_matrix\nend",
"def My_Transpose(nums) \n transposed_matrix=[]\n givens_0=nums[0]\n givens_1=nums[1]\n givens_2=nums[2]\n \n transposed_matrix[0]=[givens_0[0],givens_1[0],givens_2[0]]\n transposed_matrix[1]=[givens_0[1],givens_1[1],givens_2[1]]\n transposed_matrix[2]=[givens_0[2],givens_1[2],givens_2[2]]\n \n puts(\"the first row of the transposed_matrix[0] is #{transposed_matrix[0]}\")\nend",
"def transpose\n\n # pre-conditions and invariants\n _invariants\n\n newDelegate = @delegate.clone\n newDelegate.transpose\n\n newMatrix = SparseMatrix.new(newDelegate)\n\n # post-conditions and invariants\n _invariants\n assert_equal(self.row_size,newMatrix.column_size,\"post-condition\")\n assert_equal(self.column_size,newMatrix.row_size,\"post-condition\")\n (0..self.row_size-1).each { |i|\n (0..self.column_size-1).each { |j|\n assert_equal(self[i,j],newMatrix[j,i],\"post-condition\")\n }\n }\n\n return newMatrix\n end",
"def transpose(arr) # transpose matrix\n column1, column2, column3 = [arr[0][0], arr[1][0], arr[2][0]],\n [arr[0][1], arr[1][1], arr[2][1]],\n [arr[0][2], arr[1][2], arr[2][2]]\n [column1, column2, column3]\nend",
"def my_transpose(matrix)\n raise \"Not a two dimensional array\" unless matrix.length > 1 && matrix[0].is_a?(Array)\n result = Array.new(matrix.length) {Array.new(matrix.length)}\n\n result.each_index do |row|\n result[row].each_index do |col|\n result[row][col] = matrix[col][row]\n end\n end\n\n result\nend",
"def transpose(mtrx)\n new_mtrx = Array.new(3) { Array.new(3) }\n new_mtrx.each_with_index do |sub_arr, idx|\n sub_arr.each_with_index do |element, inner_idx|\n new_mtrx[idx][inner_idx] = mtrx[inner_idx][idx]\n end\n end\n new_mtrx\nend",
"def transpose(arr)\n transposed = Array.new([[], [], []])\n arr.each_index do |outer_i|\n arr.each_index do |inner_i|\n transposed[inner_i][outer_i] = arr[outer_i][inner_i]\n end\n end\n transposed\nend",
"def my_transpose(matrix)\n #algorithm\n for i in 0...matrix[0].length\n for j in (i + 1)...matrix[0].length\n temp = matrix[i][j]\n matrix[i][j] = matrix[j][i]\n matrix[j][i] = temp\n end\n end\n\n #printer\n for k in (0..(matrix[0].length-1))\n puts matrix[k].join(\" \")\n end\n matrix\nend",
"def transpose(matrix)\n transposed = []\n num_columns = matrix.first.length\n num_rows = matrix.length\n\n (0...num_columns).each do |col|\n row_to_add = []\n (0...num_rows).each do |row|\n row_to_add << matrix[row][col]\n end\n transposed << row_to_add\n end\n\n # another version:\n # (0...num_columns).each do |column_index|\n # new_row = (0...num_rows).map do |row_index|\n # matrix[row_index][column_index]\n # end\n # result << new_row\n # end\n\n transposed\nend",
"def transpose!(matrix)\n (0...matrix.size).each do |row|\n (0...matrix.size).each do |col|\n matrix[row][col], matrix[col][row] =\n matrix[col][row], matrix[row][col] if row < col\n end\n end\nend",
"def transpose(matrix)\n if matrix.empty? || matrix.first.empty?\n raise ArgumentError\n end\n result = Array.new(matrix.first.length) { Array.new(matrix.length, 0) }\n matrix.each_with_index do |row, x|\n row.each_with_index do |val, y|\n result[y][x] = val\n end\n end\n result\nend",
"def transpose(matrix)\n new_row_0 = []\n new_row_1 = []\n new_row_2 = []\n\n matrix.each do |row|\n new_row_0 << row[0] \n new_row_1 << row[1]\n new_row_2 << row[2]\n end\n p [new_row_0, new_row_1, new_row_2]\nend",
"def my_transpose\n new_array = []\n\n (0...self.length).each do |row|\n new_row = []\n\n (0...self.length).each do |col|\n new_row << self[col][row]\n \n end\n new_array << new_row\n end\n new_array\n end",
"def transform(vec)\n return getRotationMatrix() * vec\n end",
"def transpose\n result = self.class.new(cols, rows)\n _transpose_memcpy(result.gsl, self.gsl)\n result\n end",
"def transpose(matrix)\n new_matrix = []\n\n column = 0\n while column < matrix.size\n new_row = []\n\n row = 0\n while row < matrix.size\n new_row << matrix[row][column]\n row += 1\n end\n\n new_matrix << new_row\n column += 1\n end\n\n new_matrix\nend",
"def transpose(before)\n after = [[],[]]\n\n before.each_with_index do |n1, i|\n n1.each_with_index do |n2, j|\n after[i][j] = before[j][i]\n end\n end\n\n after\nend",
"def rotate!\n @grid = @grid.transpose.map{|c| c.reverse}\n end",
"def t\n return Matrix.new(@cols, @rows) {|i,j| self[j,i]}\n end",
"def flip_vertical(matrix)\n matrix.reverse\n end",
"def t\n return Matrix.new(@rows, @cols) {|i,j| self[j,i]}\n end",
"def vectorizar\n\t\t\taux = Array.new(0)\n\t\t\tfor i in 0...colum\n\t\t\t\tfor j in 0...filas\n\t\t\t\t\taux << pos[i][j]\n\t\t\t\tend\n\t\t\tend\n\t\t\tArray.new(aux)\n\t\tend",
"def vectorizar\n aux = Array.new(0)\n for i in 0...colum do\n for j in 0...filas do\n aux << pos[i][j]\n end\n end\n Array.new(aux)\n end",
"def trans(input)\n\trows, columns = input.count, input.first.count\n\tx, y = [], []\n\ti = j = 0\n\twhile j < columns do\n\t\twhile i <= rows - 1 do\n\t\t\tx.push(input[i][j])\n\t\t\ti += 1\n\t\tend\n\t\tj += 1 #go to next column\n\t\ti = 0 #reset the inner counter to go back to 1st array\n\tend\n\tx.each_slice(rows).each.map{|e| y.push(e)}\n\treturn y\nend",
"def transpose\n gather { [] }.\n map(element_type: :array) { |a| a.transpose }.\n scatter(element_type: :array)\n end",
"def transpose\n gather { [] }.\n map(element_type: :array) { |a| a.transpose }.\n scatter(element_type: :array)\n end",
"def my_transpose(arr) \n new_arr = []\n (0...arr.length).each do |outer_el| # the second dimension of a matrix\n outer_arr = []\n (0...arr.length).each do |inner_el| \n outer_arr << arr[inner_el][outer_el] # flip everything inside the array and place in the outer_arr\n end\n new_arr << outer_arr # nest that outer_arr inside the new_arr\n end\n new_arr\nend",
"def transpose\n @column = @column ? false : true\n end",
"def transform! *ms\n m = [*ms].flatten.reverse.inject(:*)\n @vbuffer.each_triple_with_index do |t,i|\n q = m * NMatrix[[t[0]],[t[1]],[t[2]],[1]]\n @vbuffer[i] = [q[0]/q[3], q[1]/q[3], q[2]/q[3]]\n end\n self\n end",
"def to_indexed_verts_array a=[]\n\t\t@verts.each do |v|\n\t\t\ta += v[:vector]\n\t\tend\n\t\ta\n\tend",
"def transpose!\n _transpose(self.gsl)\n @size = [@gsl[:rows], @gsl[:cols]]\n self\n end",
"def transpose(matrix)\n\t#\n\t# your code goes here\n result = [] #empty arr as accumulator\n i = 0\n while i < matrix.length #iterates trhough matrix\n array = []\n matrix.each do |sub_matrix| #iterates through sub_matrix\n array << sub_matrix[i] #sends elements to array\n end\n result << array #sends new sub-array to result\n i += 1\n end\n\n result\nend",
"def transpose(arr)\n columns = arr.max.length-1\n\n (0..columns).map do |column|\n (0..arr.length-1).map do |row|\n arr[row][column]\n end\n\n end\nend",
"def flip_vertically\n dup.flip_vertically!\n end",
"def column_vectors\n # (0 .. column_size - 1).collect { |i| column(i) }\n my_rows = @rows\n r_size = my_rows.size\n col_size = my_rows[0].size\n vector_cls = Vector\n array_cls = Array\n res = array_cls.new(col_size)\n for j in 0..col_size-1 do\n a_col = array_cls.new(r_size)\n for i in 0..r_size-1 do\n a_col[i] = my_rows[i][j]\n end\n res[j] = Vector.elements(a_col, false)\n end\n res\n end",
"def row_vectors\n # (0 .. row_size - 1).collect { |i| row(i) }\n my_rows = @rows\n r_size = my_rows.size\n res = Array.new(r_size)\n vector_cls = Vector\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n res[i] = vector_cls.elements(a_row) \n end\n res\n end",
"def transpose\n # So. Pointless. Blerg.\n IterableArray.new(@array.transpose.map do |x|\n IterableArray.new x\n end)\n end",
"def conjugate_transpose\n self.transpose.complex_conjugate!\n end",
"def transpose(array)\n result = []\n number = array.count\n if array.empty?\n single_array = array\n else\n single_array = [array[0]]\n end\n single_array.each do |val|\n val.each do |v|\n new_array = []\n number.times do\n new_array << v\n end\n result << new_array\n end\n end\n result\nend",
"def transpositions\n new_words = []\n @words.each do |word|\n @word = word || '' \n new_words += (0..length-1).map { |i| \"#{@word[0...i]}#{@word[i+1, 1]}#{@word[i,1]}#{@word[i+2..-1]}\" }\n end\n new_words\n end",
"def transpose(arr)\n col_size = arr.size # the number of rows in the original array\n row_size = arr[0].size # the number of cols in the original array\n new_arr = Array.new(row_size) { Array.new(col_size) } # create a nil-filled row_size-by-col_size array\n arr.each_with_index do |sub_arr, row|\n sub_arr.each_with_index { |elem, col| new_arr[col][row] = elem }\n end\n new_arr\nend",
"def transform(t)\n ovwrite_me t.vectormult(self)\n end",
"def pinv_left\n (transpose * self).inv * transpose\n end",
"def transpose(array)\n return [] if array.empty?\n result = []\n array.first.length.times do |i|\n array.each_with_index do |inner, inner_index|\n result[i] ||= []\n result[i] << array[inner_index][i]\n end\n end\n result\nend",
"def d; Matrix.new(RAtlas.vec2diag(@storage)); end",
"def Vector3dFromMatrix3dTransposeTimesVector3d(arg0, arg1)\n ret = _invoke(1610744214, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def get_transpose()\n transpose_graph = Graph.new(26)\n\n for i in 0..@number_of_vertices -1 do\n @adjacent_list[i].each do |x|\n transpose_graph.add_edge(x, i)\n end\n end\n\n transpose_graph\n end",
"def refresh\n d = @data.dup.map{ |row| row.split(\"\") }\n @num_rotations.times { d = d.transpose.map(&:reverse) }\n d.map(&:reverse!) if @flipped\n d.map(&:join)\n end",
"def Vector3dFromMatrix3dTransposeTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744216, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def vector\n result = []\n next_candiate = 2\n while result.size < @table_size\n (result << next_candiate) if prime?(next_candiate)\n next_candiate += 1\n end\n result\n end",
"def rotate( vector )\n\t\t\t(self.inverse * self.class.new(vector) * self ).vec \n\t\tend",
"def rotate_matrix(array)\n\n\nend",
"def flip\n arr = Array.new(self.length)\n (0..self.length / 2).each do |index|\n arr[index] = self[self.length - 1 - index]\n arr[self.length - 1 - index] = self[index]\n end\n arr\n end",
"def reverse_columns!\n ensure_shape\n @data = @data.transpose.reverse.transpose\n end",
"def transpositions word\n n = word.length\n (0...n-1).collect {|i| word[0...i]+word[i+1,1]+word[i,1]+word[i+2..-1] }\n end",
"def flip_horizontal(matrix)\n matrix.map(&:reverse)\n end",
"def transpose(dim_a, dim_b)\r\n FlexArray.new_from_array(self).transpose!(dim_a, dim_b)\r\n end",
"def data\n data = (@transpose ? @data.transpose : @data).clone\n data.shift\n data\n end"
] | [
"0.726309",
"0.6704453",
"0.66432786",
"0.66375405",
"0.661326",
"0.6556241",
"0.64950514",
"0.6457604",
"0.6386165",
"0.6369163",
"0.6305857",
"0.6291343",
"0.6288887",
"0.61494726",
"0.61116374",
"0.6098272",
"0.60681313",
"0.6062541",
"0.605699",
"0.60386384",
"0.603795",
"0.6031877",
"0.5996671",
"0.5974235",
"0.5937566",
"0.593275",
"0.59286994",
"0.5911621",
"0.59103954",
"0.59023416",
"0.5884503",
"0.5883632",
"0.58827734",
"0.58700746",
"0.58418745",
"0.584126",
"0.58359295",
"0.58109653",
"0.5799953",
"0.57971215",
"0.57943565",
"0.57919717",
"0.57820714",
"0.5778902",
"0.577518",
"0.57497734",
"0.57478005",
"0.57438844",
"0.5730106",
"0.5726794",
"0.57009304",
"0.5692779",
"0.5661175",
"0.5656981",
"0.5655188",
"0.56495565",
"0.56271684",
"0.56260425",
"0.56042427",
"0.55707145",
"0.5566917",
"0.5546179",
"0.5543396",
"0.55070496",
"0.54888284",
"0.5476022",
"0.5475248",
"0.5475248",
"0.5464389",
"0.54544055",
"0.5437241",
"0.54274976",
"0.5424923",
"0.5423098",
"0.540347",
"0.53878206",
"0.5340726",
"0.5330873",
"0.53288126",
"0.532686",
"0.53212684",
"0.5314065",
"0.5309267",
"0.52908367",
"0.52890265",
"0.5280402",
"0.52615553",
"0.5241749",
"0.5240683",
"0.5229112",
"0.5228799",
"0.5219828",
"0.5213106",
"0.52050567",
"0.51972324",
"0.5192184",
"0.5184683",
"0.5178078",
"0.51721144",
"0.5165717"
] | 0.612385 | 14 |
Clear the cache before we continue on | def raw_vector_with(word_list)
clear_cache!
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_cache; end",
"def clear_cache() @cache = {}; end",
"def clear_cache!\n @cache = {}\n end",
"def clear_cache!\n @cache = {}\n end",
"def clear\n cache.clear\n end",
"def clear_cache\n @cache = {}\n end",
"def clear\r\n @cache.flush\r\n end",
"def clear\n @cache.clear\n end",
"def clear!\n @cache = {}\n end",
"def cache_clear\n @client.flushall\n end",
"def clear_cache!\n # this should be overridden by concrete adapters\n end",
"def clear\n @cache = {}\n end",
"def cache_clear\n @moneta.clear\n end",
"def reset\r\n @cache.reset\r\n end",
"def clear_cache\n @all = nil\n end",
"def cache_clear\n @store.clear\n end",
"def clear_cache\n @access.refresh\n end",
"def clear_cache\n @access.refresh\n end",
"def reset!\n @cache = nil\n end",
"def clear\n @cache.clear\n self\n end",
"def clear_cache\n ccs.each(&:clear_cache)\n end",
"def flush_cache; end",
"def cache_clear\n @store.delete\n end",
"def clear\n FileUtils.rm_f(cache_file)\n initialize!\n end",
"def cache_clear\n @store.flush_all\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end",
"def clear_cache\n @results = nil\n @result_ids = nil\n @num_results = nil\n @letters = nil\n end",
"def cache_clear\n @dataset.delete\n end",
"def cache_clear\n @dataset.delete\n end",
"def memoize_cache_clear\n __memoize_cache__.clear\n self\n end",
"def reset_cache\n self.class.reset_cache\n end",
"def clear_cache\n Rails.cache.clear\n render :text => 'cleared'\n end",
"def flush!\n @_cache = {}\n end",
"def _clear_cache\n @cache_parent.clear\n end",
"def reset\n @entry_cache.clear\n end",
"def clear_all!\n @cache = Cache.new\n end",
"def reset\n hash.clear\n expire_cache!\n self\n end",
"def clear_cache\n Rails.cache.clear\n invoke_callbacks(:clear_cache, :after)\n head :no_content\n end",
"def refresh_cache\n @cache = build_cache\n end",
"def clear\n @metadata = {}\n clear_cache\n end",
"def clear_cache\n Rails.cache.delete(self.class.cache_key(self.key))\n end",
"def clear_cache\n\t\tprint \"Clearing cache...\"\n\t\turl = get_url(\"clear\", @uid, @password, @sid)\n\t\trun_1010(url, \"\") { puts \"done\" }\n\tend",
"def clear\n @cache.clear\n entries.clear\n self\n end",
"def clear_cache!\n @sorted = false\n end",
"def clear_cached\n Rails.cache.delete(self.cache_key, opts_for_cache)\n end",
"def flush_memos\n CACHE.clear\n end",
"def clear_cache\n CircleCi.request(conf, \"#{base_path}/build-cache\").delete\n end",
"def flush_cache!\n @cached_dependencies = {}\n end",
"def clear\n\n set_id_to_cache_key_map\n\n cache_response = fetch\n @id_to_cache_key_map.each do |id, key|\n Memcache.delete(key)\n Memcache.delete(\"ca_sa_shared_de_sa_cs_#{cache_response[id][:api_key]}\")\n end\n\n nil\n\n end",
"def clear_cache\n @lit_cache = {}\n @lit_nextpos = {}\n end",
"def clear_caches\n self.log.debug \"Clearing entry and values caches.\"\n\t\t@entry = nil\n\t\t@values.clear\n\tend",
"def clear_cache\n property_cache.clear\n end",
"def clear_cache\n @current_site.set_meta(cache_key, nil)\n end",
"def invalidate_all!\n FileUtils.rm_r(@cache_path, force: true, secure: true)\n end",
"def clear_all\n FileUtils.rm_rf(CACHE_DIR)\n end",
"def expire_cache!\n @snapshot = nil\n end",
"def clear_cache\n Slides.log :cache_clear do\n Timeout.timeout(1) do\n begin\n Rails.cache.clear\n rescue\n $stderr.puts \"error message=#{$!.message}\"\n end\n end\n end\nend",
"def flush_cache\n Linker.flush_cache\n end",
"def reset_cache\n envspecific_regexs(true)\n end",
"def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end",
"def clear_current_cache\n\t\t\t\t\tself.class.clear_current_cache\n\t\t\t\tend",
"def clear\n # TODO: this is rather brutal, in future need to be able to revert\n Rails.logger.info(\"Clearing OpenbisMedataStore at #{filestore_path}\")\n # cache.delete_matched(/.*/)\n # need to add an entry to empty cache otherwise the clear failes on unexisting deak\n cache.fetch('fake') { '' } unless File.exist?(cache.cache_path)\n cache.clear\n end",
"def delete_cache_files; end",
"def delete_cache_files; end",
"def clear_checksum_cache!\n @lookup_checksums = {}\n end",
"def flush!\n unless @cache.empty?\n $stderr.puts \" FLUSHING CACHE!\"\n @cache.clear\n end\n self\n end",
"def clear_cache\n @copyright_status = nil\n end",
"def clear_cache\n CircleCi.request(@conf, \"/project/#{username}/#{project}/build-cache\").delete\n end",
"def clear_all_caches\n $CACHE.clear\n remove_cached_feeds\n remove_cached_list_of_taxon_concepts\n if ActionController::Base.cache_store.class == ActiveSupport::Cache::MemCacheStore\n ActionController::Base.cache_store.clear\n return true\n else\n return false\n end\n end",
"def clear_cache\n $redis.del self.id\n end",
"def clear_cache\n $redis.del self.id\n end",
"def cache_clear\n DrgCms.cache_clear(:dc_page)\nend",
"def invalidate_cache! now\n end",
"def clear_cache(uri)\n if last_cached(uri) > 0\n cache_store.delete(cache_key([uri, last_cached(uri)]))\n cache_store.delete(cache_key(uri))\n end\n end",
"def flush_cache!\n flush!(:manually_requested)\n end",
"def free\n cache.clear\n nil\n end",
"def clear_data_uri_cache\n @_uri_cache = {}\n end",
"def clear_all_caches\n TemplateCache.clear\n HardCache.clear\n redirect_to 'Adminful#dashboard', :flash => 'Cleared template and view cache'\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def reset_cache!\n @@cache = { :default => {} }.with_indifferent_access\n true\n end",
"def flush\n write_cache if @dirty\n @dirty = false\n end",
"def unload!\n cache.save if @__cache\n __send__ :unloaded if respond_to? :unloaded\n\n @__cache = nil\n end",
"def clear!\n @cache.delete(current_store_id)\n end",
"def clear_cache! *keys\n clear_cache *keys\n ipcm_trigger :clear_cache, *keys\n end",
"def flush_cache\n Rails.cache.delete([self.class.name, symbol_was.to_s])\n Rails.cache.delete([self.class.name, id])\n end",
"def clear_cache\n @process_pid.set(nil)\n end",
"def clear_cached_vars\n @_rendered , @_versions = false , false\n end",
"def invalidate_memoized_attributes\n @full_name = nil\n @cache_file = nil\n end",
"def cleanup_cache\n\t\t\tputs \"Cleaning up cache\"\n\t\t\texpire_older_than = ((Time.now.to_f - MiniProfiler::EXPIRE_TIMER_CACHE) * 1000).to_i\n\t\t\t@timer_struct_lock.synchronize {\n\t\t\t\t@timer_struct_cache.delete_if { |k, v| v['Root']['StartMilliseconds'] < expire_older_than }\n\t\t\t}\n\t\tend",
"def clear_hardcache\n HardCache.clear\n redirect_to 'Adminful#dashboard', :flash => 'Cleared view cache'\n end",
"def clear_cache\n FileUtils.rm File.expand_path(\"cms-css/#{self.slug}.css\", Rails.public_path), :force => true\n FileUtils.rm File.expand_path(\"cms-js/#{self.slug}.js\", Rails.public_path), :force => true\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def flush_cache\n # needed on at least fc23/fc24 sometimes to deal with the dnf cache getting out of sync with the rpm db\n FileUtils.rm_f \"/var/cache/dnf/@System.solv\"\n Chef::Provider::Package::Dnf::PythonHelper.instance.reap\n end",
"def clear_cache\n $redis.del \"posts\"\n end",
"def clear_cached_values\n @chocoversion = nil\n @compiled_choco = nil\n end",
"def clear_buffer_cache!\n @buffers = nil\n end"
] | [
"0.8854878",
"0.8634191",
"0.85568637",
"0.85568637",
"0.8543571",
"0.849489",
"0.8375541",
"0.83753085",
"0.8345576",
"0.8217096",
"0.8191377",
"0.8136908",
"0.80884296",
"0.80801725",
"0.80136675",
"0.8001174",
"0.7894996",
"0.7894996",
"0.78758943",
"0.7863244",
"0.7832587",
"0.7793872",
"0.77710956",
"0.7768153",
"0.776737",
"0.77261275",
"0.7722685",
"0.7722685",
"0.76804644",
"0.76663715",
"0.7637506",
"0.7634451",
"0.7607179",
"0.76015055",
"0.7569486",
"0.7569472",
"0.7556747",
"0.75515336",
"0.7497537",
"0.74811625",
"0.7476011",
"0.74535084",
"0.7406929",
"0.7405916",
"0.740061",
"0.7373529",
"0.7356204",
"0.7341546",
"0.7335689",
"0.72943574",
"0.7290627",
"0.7287296",
"0.7269731",
"0.72527677",
"0.7250102",
"0.7246938",
"0.7239176",
"0.72379357",
"0.72186136",
"0.7213568",
"0.72005373",
"0.71901095",
"0.71901095",
"0.7184096",
"0.71692175",
"0.71490616",
"0.7144683",
"0.71399486",
"0.71350694",
"0.71350694",
"0.71019316",
"0.7075865",
"0.70552",
"0.70022255",
"0.6979539",
"0.6956521",
"0.6952539",
"0.69408554",
"0.693627",
"0.6923631",
"0.69229287",
"0.6902268",
"0.68883544",
"0.6886655",
"0.68770814",
"0.6871952",
"0.68595064",
"0.6847783",
"0.6844675",
"0.68335146",
"0.6833135",
"0.6833135",
"0.6833135",
"0.6833135",
"0.6833135",
"0.6833135",
"0.6833135",
"0.68224484",
"0.6821158",
"0.68122584",
"0.6805752"
] | 0.0 | -1 |
We don't want the cached_data here | def marshal_dump
[@lsi_vector, @lsi_norm, @raw_vector, @raw_norm, @categories, @word_hash]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cached?; end",
"def cache(data); end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache_value?; end",
"def disable_caching=(_arg0); end",
"def cache_on?; end",
"def cache_on?; end",
"def disable_caching; end",
"def cached\n raise NotImplementedError\n end",
"def without_cache(&block); end",
"def without_cache(&block); end",
"def filter_cache; end",
"def cache_store; end",
"def cache_store; end",
"def cache\n DataCache\n end",
"def should_cache?\n false\n end",
"def _cache_control; end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def cache?\n false\n end",
"def move_to_cache\n true\n end",
"def disable_cache; end",
"def move_to_cache\r\n true\r\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 cached\n self\n end",
"def data\n @cache ||= {}\n end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def instance_cache; end",
"def no_cache!\n @cacheable = false\n end",
"def clear_cache; end",
"def prepare_for_caching\n @predictor.instance_variable_set(:@data_set, nil)\n end",
"def cache\n yield\n end",
"def configure_cache; end",
"def set_cache(value); end",
"def set_cache(value); end",
"def data\n # This is a common memoization technique used in Ruby\n @data ||= normalize_data\nend",
"def flush_cache; end",
"def uncached\n yield\n end",
"def cached?(key)\n false\n end",
"def cache!\n @@cache\n end",
"def singleton_cache; end",
"def use_cache?\n super && !against_head?\n end",
"def use_cache?\n super && !against_head?\n end",
"def move_to_cache\n false\n end",
"def cache_get(key)\n nil\n end",
"def using_cache\n\t\t(@modcache_invalidated != true)\n\tend",
"def set_no_caching\n self.vdo_caching = 1\n self.auto_caching = 1\n end",
"def cache_version_data\n {}\n end",
"def data_caches\n (@data_caches || [])\n end",
"def cache_request\n cache\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 cache_query?\n false\nend",
"def cache_query?\n false\nend",
"def cacheable?\n true\n end",
"def clear_cache() @cache = {}; end",
"def singleton0_cache; end",
"def cached?\n !(!@cached)\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache_data?(key, obj)\n if(data = @redis.get(key)).nil? # this data is a json\n\n\t\t\tdata = historical_run(key, obj.map()).to_json\n @redis.set(key, data) # redis must cache a json\n @redis.expire(key,14400)\n\t\tend\n\n return JSON.parse(data) # this data must be changed to object\n end",
"def add_cache_control; end",
"def cache\n @cache ||= build_cache\n end",
"def cache\n @cache ||= {}\n end",
"def photo__cache\r\n@photo_cache ||= {}\r\nend",
"def test_cached\n cached = TestCache.new\n \n # force = false\n assert !cached.cached?(:m1)\n cached.m1\n assert cached.cached?(:m1)\n sleep 4\n assert cached.cached?(:m1)\n \n # force = true\n assert !cached.cached?(:m2)\n cached.m2\n sleep 1\n assert cached.cached?(:m2)\n sleep 3\n assert !cached.cached?(:m2)\n end",
"def http_cache_forever(public: T.unsafe(nil)); end",
"def prepareForReuse; end",
"def counter_cache; end",
"def without_caching(&block)\n @options[:perform_caching] = false\n block.call\n ensure\n @options.delete(:perform_caching)\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 fallback_data; end",
"def fallback_data; end",
"def without_cache &block\n tmp = @cache_on\n @cache_on = false\n block.call\n @cache_on = tmp\n end",
"def disk_cache_enabled; end",
"def cached_instance\n @cached_instance ||= read_instance\n end",
"def no_cache\n conditionally_visible? || self[:no_cache]\n end",
"def counter_cache=(_arg0); end",
"def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end",
"def _template_cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def unless_cached(opts={})\n partial_key = opts[:key].present? ? opts[:key] : caller.first.match(/`[^']*/).to_s[1..-1]\n key = \"#{self.base_redis_key}_#{partial_key}\"\n\n self.class.unless_cached_base(key, opts) do\n yield\n end\n end",
"def cache_fetch(*args)\n super { |key| @store[key] }\n end",
"def cache_key\n end",
"def stored_data; end"
] | [
"0.79779893",
"0.79286397",
"0.7774408",
"0.7774408",
"0.7774408",
"0.7774408",
"0.7774408",
"0.7774408",
"0.7774408",
"0.7592871",
"0.7531231",
"0.73953855",
"0.73953855",
"0.7389803",
"0.7370729",
"0.7344182",
"0.7344182",
"0.7316475",
"0.7253996",
"0.7253996",
"0.72289556",
"0.72122",
"0.70817596",
"0.70511043",
"0.70511043",
"0.70511043",
"0.70511043",
"0.7008121",
"0.7008121",
"0.7008121",
"0.7008121",
"0.6992154",
"0.69809777",
"0.6962735",
"0.69051284",
"0.68578035",
"0.68578035",
"0.68578035",
"0.68404835",
"0.68342507",
"0.6827518",
"0.6827518",
"0.681558",
"0.678911",
"0.67887497",
"0.6773919",
"0.67584354",
"0.6751196",
"0.6737775",
"0.6729613",
"0.6729613",
"0.6713967",
"0.6704578",
"0.67007977",
"0.6660935",
"0.6660457",
"0.6634475",
"0.6619417",
"0.6619417",
"0.6577134",
"0.6557035",
"0.65000045",
"0.64861196",
"0.64681643",
"0.6456738",
"0.64499277",
"0.6446735",
"0.6437121",
"0.6437121",
"0.64130807",
"0.6403188",
"0.6394365",
"0.63844115",
"0.63727385",
"0.63727385",
"0.63708043",
"0.6353665",
"0.634194",
"0.6293558",
"0.6288136",
"0.6275102",
"0.62731594",
"0.6264131",
"0.62605536",
"0.62585294",
"0.62569386",
"0.6244672",
"0.6244672",
"0.6232358",
"0.62217087",
"0.6215755",
"0.6211539",
"0.6202232",
"0.62003064",
"0.6193929",
"0.618196",
"0.618196",
"0.6176602",
"0.6175801",
"0.6170976",
"0.6168172"
] | 0.0 | -1 |
Is the passed candidate a better match than any of the current matches? ARG: `other` another Candidate instance to check against the current set | def better_match?( other )
return true if prefers?( other ) && free?
preference_index = preferences.index other
match_preference_indexes = matches.map { | match | preferences.index match }
preference_index and match_preference_indexes.any? { |i| i > preference_index }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than any other match?\n when better_match?( other )\n free!\n match! other\n\n else\n false\n end\n end",
"def matched?( other = nil )\n return full? if other.nil?\n matches.include? other\n end",
"def one_match?(candidate_categories, result_age = nil)\n return false unless candidate_categories.one?\n\n candidate_category = candidate_categories.first\n match = candidate_category.include? self, result_age\n debug \"one_match? #{match}\"\n match\n end",
"def match!( other )\n return false unless prefers?( other ) && !matched?( other )\n matches << other\n other.matches << self\n end",
"def matches?(other)\n operable_values == other.operable_values\n end",
"def minimal_match?(other)\n super and tolerant_match?(other, TOLERANT_MATCH_ATTRS)\n end",
"def two_candidates?\n @candidates.count == 2\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def is_better_match?(person, first_better, second_better)\n @preferences[person].detect { |pref| pref == first_better || pref == second_better }\n end",
"def similar_to?(other)\n self.composition == other.composition\n end",
"def ==(other)\n @candidate == other.candidate\n end",
"def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end",
"def is_similar?(other, thresh = SIMILARITY_THRESHOLD)\n similar = true\n [ :r, :g, :b ].each do |c|\n similar = false if (self.send(c) - other.send(c)).abs > thresh\n end\n similar\n end",
"def amicable_with?(other)\n factors.reduce(:+) == other &&\n other.factors.reduce(:+) == self &&\n self != other\n end",
"def candidates_included_in_all_the_others(candidates_in_correct_position)\n\tcandidates_in_correct_position.each do |small|\n\t\tok = true\n\t\tcandidates_in_correct_position.each do |big|\n\t\t\tif small!=big\n\t\t\t\tunless big.source.position.include?(small.source.position)\n\t\t\t\t\tok = false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn small if ok\n\tend\n\tnil\nend",
"def is_a_match(total_in_common)\n total_in_common >= 2 ? true : false\n end",
"def contains_all?(other)\n (other & self) == self\n end",
"def similarTo?( otherObj )\n\t\t\treturn false unless otherObj.is_a?( self.class )\n\t\t\totherAry = otherObj.to_ary\n\t\t\trval = true\n\t\t\tself.to_ary.each_with_index {|elem,i|\n\t\t\t\tif (elem - otherAry[i]).abs > 1e-10\n\t\t\t\t\trval = false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\t\treturn rval\n\t\tend",
"def nearly?(other); end",
"def near_match?(choice)\n @comp.code_combination.include?(choice)\n end",
"def facts_match?(other_facts, self_facts=nil)\n self_facts = query_facts.body if self_facts.nil?\n same_num_elements?(other_facts, self_facts) && same_fact_contents?(other_facts, self_facts)\n end",
"def better_partner?(matchable)\r\n rank(matchable) > rank(@partner)\r\n end",
"def matched?(other_user)\n matched.include?(other_user)\n end",
"def eql? other\n object_id == other.object_id || \n (self.class == other.class &&\n specification == other.specification && \n candidate_types == other.candidate_types && \n candidate_types_excluded == other.candidate_types_excluded && \n candidate_objects == other.candidate_objects && \n join_points_matched == other.join_points_matched &&\n join_points_not_matched == other.join_points_not_matched)\n end",
"def match?(other)\n return false unless other.is_a?(GroupingCriteria)\n return true if ids && other.ids && ids.intersect?(other.ids)\n return true if values == other.values\n return false if values.blank? || other.values.blank?\n values.each_with_index.all? do |v, i|\n v.blank? || other.values[i].blank? || (v == other.values[i])\n end\n end",
"def is_stable?\n # Every person's partner should match up\n @matches.all? { |k,v| is_matched?(k, v) }\n end",
"def intersects?(other)\n return false if separate? other\n return false if contained? other\n return false if coincident? other\n true\n end",
"def match(other)\n solve == other.solve\n end",
"def match(other, anchor, fuzz=Pixel(0))\n each { |p| return false if !other[anchor + p].approx(self[p], fuzz)}\n true\n end",
"def propose! other\n if other.single?\n #first engagement for other\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n current_pref = other.pref_list.preference_of(other.engaged_to)\n my_pref = other.pref_list.preference_of(self)\n #the lower the index, the more preferred\n if my_pref < current_pref\n #found better matching\n other.jilt!\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n #reject this engagement\n return false\n end\n end\n end",
"def similar?(other)\n other && other.to == @to && other.from == @from && other.label == @label\n end",
"def best_match_from(other)\n other.max_by do |their_type|\n best_type = self.by_precedence.find do |our_type|\n their_type =~ our_type\n end\n if best_type.nil?\n 0\n else\n best_type.quality * their_type.quality\n end\n end\n end",
"def intersects?(other)\n return false if self.equal?(other)\n !(above?(other) || below?(other) || right_of?(other) || left_of?(other) || behind?(other) || in_front_of?(other))\n end",
"def check(best, results)\n\t\tmag = best * @threshold\n\t\tamount = 0\n\n\t\tresults.each do |value|\n\t\t\tif value <= mag\n\t\t\t\tamount += 1\n\t\t\tend\n\t\tend\n\n\t\tif amount < @k\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def tags_match?(other)\n (self.respond_to?(:tags) and other.respond_to?(:tags)) ?\n self.tags == other.tags : true\n end",
"def accepts?(other)\n true\n end",
"def include?(other, result_age = nil)\n return false unless other\n\n abilities_include?(other) &&\n ages_include?(other, result_age) &&\n equipment == other.equipment &&\n (men? || other.women?) &&\n (!weight? || weight == other.weight)\n end",
"def contains?(other)\n @pairs & other.pairs == other.pairs\n end",
"def match?(choices)\n\n @choices = choices\n raise ArgumentError, 'Checker received non-card input' unless @choices.kind_of?(Array)\n raise ArgumentError, 'A set has 3 cards! Please select 3 cards!' unless @choices.size == 3\n\n # Logic: \"MAKE THIS TERSE\"\n numbers = Array.new(3) { |i| choices[i].number }\n symbols = Array.new(3) { |i| choices[i].symbol }\n shadings = Array.new(3) { |i| choices[i].shading }\n colors = Array.new(3) { |i| choices[i].color }\n\n features = [numbers, symbols, shadings, colors]\n @result = features.all? { |feature| feature.uniq.size != 2 }\n end",
"def similar_to?(other)\n return false if [:connect_type, :install_type, :secondary_voltage].any? do |prop|\n self[prop] != other[prop]\n end\n\n # Allow 12.47kV and 12.5kV configurations to be used interchangably\n return false if (self[:primary_voltage].to_i - other[:primary_voltage].to_i).abs > 300\n\n self.phases == other.phases\n end",
"def matches?(other)\n self.exists? && other.exists? && self.hash == other.hash\n end",
"def contains?(other)\n other.corners.all? { |corner| includes_point?(corner) }\n end",
"def >(other)\n (rock? && other.scissors?) ||\n (rock? && other.lizard?) ||\n (paper? && other.rock?) ||\n (paper? && other.spock?) ||\n (scissors? && other.paper?) ||\n (scissors? && other.lizard?) ||\n (lizard? && other.paper?) ||\n (lizard? && other.spock?) ||\n (spock? && other.rock?) ||\n (spock? && other.scissors?)\n end",
"def allowed?(val)\r\n return @candidates.include?(val)\r\n end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def subset_of?( other_collection )\n all? {|e| other_collection.include? e }\n end",
"def connects?(other)\n other &&\n (self == other ||\n (suited? &&\n suit == other.suit &&\n (rank - other.rank).abs <= 2))\n end",
"def matches(other)\n other.kind_of?(QueryField) && other.name == @name && other.operation == @operation && other.boost == @boost \n end",
"def superset_of?( other_collection )\n other.all? {|e| self.include? e }\n end",
"def equals(other)\n return false if not super(other)\n return self.opts == other.opts\n end",
"def catalogs_match?(other_catalogs, self_catalogs=nil)\n self_catalogs = query_catalogs.body if self_catalogs.nil?\n return false unless other_catalogs.size == self_catalogs.size\n other_catalogs.each_index { |index| return false unless catalog_match?(other_catalogs[index], self_catalogs[index]) }\n true\n end",
"def match(other, settings=nil)\n no_match_required = settings.nil? || settings.no_match_required?\n potential_match_attributes = {:offer_signup => other, :request_signup => self, :collection => self.collection}\n prompt_matches = []\n unless no_match_required\n self.requests.each do |request|\n other.offers.each do |offer|\n if (match = request.match(offer, settings))\n prompt_matches << match\n end\n end\n end\n return nil if settings.num_required_prompts == ALL && prompt_matches.size != self.requests.size\n end\n if no_match_required || prompt_matches.size >= settings.num_required_prompts\n # we have a match\n potential_match_attributes[:num_prompts_matched] = prompt_matches.size\n potential_match = PotentialMatch.new(potential_match_attributes)\n potential_match.potential_prompt_matches = prompt_matches unless prompt_matches.empty?\n potential_match\n else\n nil\n end\n end",
"def exact_matches(guess)\n pegs.zip(guess.pegs).count { |a, b| a == b }\n end",
"def contains?(other); end",
"def contains?(other); end",
"def contains?(other); end",
"def intersect?(other_set)\n requires_set(other_set, __method__)\n intersection(other_set).any?\n end",
"def match_characteristics(other)\n chr = characteristics\n ochr = other.characteristics\n chr and ochr and chr.tissue_side == ochr.tissue_side and chr.tissue_site == ochr.tissue_site\n end",
"def matches?(candidates)\n candidates.any? && candidates.all? { |l| @languages.include?(l.name) }\n end",
"def succeeds?(other)\n range_precedes(other, self)\n end",
"def proper_subset?(other_set)\n requires_set(other_set, __method__)\n return false if self == other_set\n return false unless self.subset?(other_set) && self.length < other_set.length\n true\n end",
"def one_candidate?\n @candidates.count == 1\n end",
"def exact_matches(other_code)\n exact_matches = 0\n @seq.each_with_index do |letter, index|\n exact_matches += 1 if self.is_exact_match?(other_code, index)\n end\n exact_matches\n end",
"def intersects?(other)\n !!intersection_with(other)\n end",
"def in_contest?(pet)\n pet.id == challenger.id || pet.id == challenged.id\n end",
"def within?(other)\n range_within_other?(self,other)\n end",
"def subset?(other_set)\n other_set.set.all? { |element| include?(element) }\n end",
"def accepted?\n score == max_score\n end",
"def same_suit?(other)\n if self.wild? || other.wild?\n return true \n end\n self.suit == other.suit\n end",
"def sum_of_two?(set)\n set.any? { |x| set.include?(self-x) }\n end",
"def deuce?\n score1 == score2 &&\n score1 >= deuce_minimum &&\n score2 >= deuce_minimum\n end",
"def candidate?\n !!candidate\n end",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end",
"def is_similar?(other)\n return false unless other.is_a?(Triangle)\n\n s1_1, s1_2, s1_3 = self.sides.map {|side| side.length}\n s2 = other.sides.map {|side| side.length}\n\n are_similar?(s1_1, s1_2, s1_3, *s2) ||\n are_similar?(s1_1, s1_3, s1_2, *s2) ||\n are_similar?(s1_2, s1_1, s1_3, *s2) ||\n are_similar?(s1_2, s1_3, s1_1, *s2) ||\n are_similar?(s1_3, s1_1, s1_2, *s2) ||\n are_similar?(s1_3, s1_2, s1_1, *s2)\n end",
"def check_repeated_choice guess\r\n\t\t\t\t\t@resultb.include? guess\r\n\t\t\t\tend",
"def contained?(other); end",
"def contained?(other); end",
"def contained?(other); end",
"def needs_playing?\n # if either both children are matches and they both need relevant\n # OR\n # both children are players and both are present\n children.count {|child| child.is_a?(Match) ? child.relevant? : child.present?} == 2\n end",
"def covers? other\n @hash.keys.all? do |attr|\n self[attr] == other[attr] || self[attr] == :undefined || other[attr] == :null\n end\n end",
"def contains?(_other)\n true\n end",
"def factor?(other)\n s = self.base.unit.map{ |u| [u.type] * u.power }.flatten\n o = other.base.unit.map{ |u| [u.type] * u.power }.faltten\n (s - o).empty?\n end",
"def equal?(other)\n raise \"Incident is not complete\" unless complete? && other.complete?\n\n screener.target.equal?(other.screener) &&\n general_info.target.equal?(other.general_info) &&\n involved_civilians.zip(other.involved_civilians).all? { |c1, c2| c1.equal? c2 } &&\n involved_officers.zip(other.involved_officers).all? { |o1, o2| o1.equal? o2 }\n end",
"def match(candidates)\n\t\tself.downcase(candidates)\n\t\t@ed.match(candidates)\n\tend",
"def contained?(other)\n center.distance(other.center) < (@r - other.r).abs\n end",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def coincident?(other)\n center.distance(other.center) == 0 and @r == other.r\n end",
"def potential_matches\n @potential_matches ||= super.select do |license|\n if license.creative_commons? && file.potential_false_positive?\n false\n else\n license.wordset\n end\n end\n end",
"def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end",
"def includes_all?(other)\n leftovers = other.dup\n leftovers.delete_elements!(self)\n leftovers.empty?\n end",
"def include?(other)\n set_indexes.sort & other.set_indexes.sort == other.set_indexes.sort\n end",
"def matches?(actual)\n @matching_values.include?(actual)\n end",
"def similarity_to other, threshold = nil\n Babushka::Levenshtein.distance self, other, threshold\n end",
"def match?(instance)\n match_id?(instance) || match_percentage?(instance) || match_groups?(instance)\n end",
"def <=>(other) \n res = (self.combination_score <=> other.combination_score)\n # First try by combination\n return res if res != 0\n # Otherwise break the tie \n return break_tie(other)\n end",
"def evaluate(control, candidate)\n control == candidate ? :match : :mismatch\n end",
"def ==(other)\n if other.instance_of?(self.class)\n @val == other.to_i\n elsif other.is_a?(Set) && size == other.size\n other.all? { |o| include?(o) }\n else\n false\n end\n end",
"def ensure_no_subtractions(other)\n bools = map do |elem|\n case elem\n when String\n other.include?(elem)\n when Hash\n match = other.find { |e|e.is_a?(Hash) && e.keys[0] == elem.keys[0] }\n if match\n elem.values.any? ? elem.values[0].ensure_no_subtractions(match.values[0]) : true\n else\n false\n end\n end\n end\n bools.all?\n end"
] | [
"0.68644595",
"0.6494814",
"0.6171067",
"0.61165327",
"0.6103533",
"0.60148656",
"0.59837264",
"0.59695625",
"0.59534496",
"0.5951573",
"0.5924914",
"0.591324",
"0.5906214",
"0.5900777",
"0.5891475",
"0.58822894",
"0.5877805",
"0.5814154",
"0.58112717",
"0.5763609",
"0.5746574",
"0.57407373",
"0.5739021",
"0.57315296",
"0.5711809",
"0.5705308",
"0.57006204",
"0.5604953",
"0.56027514",
"0.5596296",
"0.5568266",
"0.5564178",
"0.55635893",
"0.55605024",
"0.55520827",
"0.55426097",
"0.55335605",
"0.5527971",
"0.55107975",
"0.54906917",
"0.54854244",
"0.54687864",
"0.54607666",
"0.54604805",
"0.5449295",
"0.5449295",
"0.5449295",
"0.5431422",
"0.5427448",
"0.54184496",
"0.5416581",
"0.54006904",
"0.53982115",
"0.53960896",
"0.53758746",
"0.5375084",
"0.5375084",
"0.5375084",
"0.5374621",
"0.5368755",
"0.5361467",
"0.5359171",
"0.53579473",
"0.53328496",
"0.53320974",
"0.5323156",
"0.5319165",
"0.5310044",
"0.53099066",
"0.53012115",
"0.53001225",
"0.5296986",
"0.52930474",
"0.52720994",
"0.527086",
"0.5265828",
"0.5265361",
"0.5243658",
"0.5243658",
"0.5243658",
"0.52408516",
"0.5234176",
"0.522406",
"0.5221945",
"0.5221871",
"0.5219264",
"0.52190536",
"0.52146727",
"0.5207626",
"0.5207379",
"0.52015996",
"0.5201222",
"0.52002686",
"0.5197843",
"0.51819277",
"0.51810044",
"0.51736444",
"0.5170457",
"0.5166902",
"0.51642126"
] | 0.7467674 | 0 |
Have all possible preferences been cycled through? | def exhausted_preferences?
preference_position >= preferences.size - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_options_main?\n no_preference_options.none? && not_counted_options.none?\n end",
"def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend",
"def all_present?(values, preferences)\n values.map { |v| preferences.present?(key, v) }.inject(&:&)\n end",
"def check_if_all_donors_ready\n self.donor_preferences.each do |donor_preference|\n return false if !donor_preference.is_ready\n end\n return true\n end",
"def pbAllFainted\n return $Trainer.ablePokemonCount==0\nend",
"def prefers?( other )\n preferences.include? other\n end",
"def check!\n error = proc { | message | raise ArgumentError.new( message ) }\n set1_keys = set1.keys\n set2_keys = set2.keys\n set1_size = set1.size\n set2_size = set2.size\n\n # Check set1\n set1.each do | target , options |\n message = \"Preferences for #{ target.inspect } in `set1` do not match availabilities in `set2`!\"\n options = options.first if options.first.is_a?( Array )\n error[ message ] unless \\\n # Anything there is a preference for is in the other set\n ( options.all? { | preference | set2_keys.include?( preference ) } )\n end\n\n # Check set2 the same way\n set2.each do | target , options |\n message = \"Preferences for #{ target.inspect } in `set2` do not match availabilities in `set1`!\"\n options = options.first if options.first.is_a?( Array )\n error[ message ] unless \\\n # Anything there is a preference for is in the other set\n ( options.all? { | preference | set1_keys.include?( preference ) } )\n end\n\n # We've run the check\n self.checked = true\n end",
"def there_are_twelve_enabled_puppies\n expect(Puppy.enabled.size).to eql 12\nend",
"def satisfied?(flavors)\n result = false\n preferences.each_slice(2) do |pref|\n result = (flavors[pref.first - 1] == pref.last)\n break if result\n end\n result\n end",
"def done?\n @possibles.all? do |ops_modifiers, count|\n count.zero? || !all_ops_modifiers_qualify?(ops_modifiers, count)\n end\n end",
"def run\n while ( rcs = remaining_candidates ).any?\n rcs.each do | candidate |\n while !candidate.exhausted_preferences? && candidate.free?\n candidate.propose_to_next_preference\n end\n end\n end\n self\n end",
"def only_some_present?(values, preferences)\n presence = values.map { |value| preferences.present?(key, value) }\n presence.include?(true) && presence.include?(false)\n end",
"def of_presence!\n requested_user_preferences.each do |requested|\n validate_pref_code!(requested)\n validate_user_pref_key!(requested)\n\n requested.dig('user_preferences').each do |user_preference|\n validate_user_pref!(user_preference)\n validate_user_pref_code!(user_preference)\n end\n end\n\n requested_user_preferences\n end",
"def test_should_verify_if_is_true\n a_preference = preferences(:store_use_inventory_control)\n assert a_preference.is_true?\n\n a_preference = preferences(:store_require_login)\n assert !a_preference.is_true?\n end",
"def preferences\n [\n {fish: 15, leisure: 1},\n {fish: 15, leisure: 0},\n {fish: 14, leisure: 0},\n {fish: 13, leisure: 0},\n {fish: 12, leisure: 0},\n {fish: 11, leisure: 0},\n {fish: 10, leisure: 0},\n {fish: 9, leisure: 0},\n {fish: 8, leisure: 0},\n {fish: 7, leisure: 0},\n {fish: 6, leisure: 0},\n {fish: 5, leisure: 0},\n {fish: 4, leisure: 0},\n {fish: 3, leisure: 0},\n {fish: 2, leisure: 0},\n {fish: 1, leisure: 0},\n {fish: 0, leisure: 0}\n ]\n end",
"def remaining_candidates\n case strategy.to_sym\n when :symmetric\n candidates.reject { | candidate | candidate.full? || candidate.exhausted_preferences? }\n when :asymmetric\n candidate_set1.values.reject { | candidate | candidate.full? || candidate.exhausted_preferences? }\n end\n end",
"def print_prefs\n puts \"____________\"\n puts \"Reduced Sets\"\n @people_prefs.each_with_index do |prefs, i|\n puts \"#{i}| #{prefs.join(' ')} \"\n end\n puts \"____________\"\n end",
"def flush?\n suits.uniq.count == 1\n end",
"def guessed_all_correct?\n end",
"def pref?\n type? 'PREF'\n end",
"def check_if_all_pop_ups_are_displayed\n\n your_league_pop_up_should_not_be_displayed\n make_your_predictions_pop_up_should_not_be_displayed\n join_private_league_pop_up_should_not_be_displayed\n join_public_league_pop_up_should_not_be_displayed\n create_your_own_league_pop_up_should_not_be_displayed\n\n end",
"def verify_vote_proposal_options\n return true unless vote_proposal_options\n if status == \"preview\"\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n correct_options << \"Accept\"\n correct_options << \"Decline\"\n else\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n end\n\n vote_proposal_options.all? do |option|\n correct_options.index(option.name)\n end \n end",
"def display_checked?(_preferences, _value)\n false\n end",
"def has_temporary_toggles\n options.has_key?(:temporary_toggles)\n end",
"def confirm_options\n # Postals are the easiest to find\n # Whatever is after is probably the country!\n # Whatever is before is probaby city/state\n confirm_postal\n\n # Must confirm state first\n # Because it's easier than country to detect\n # When no postal is present\n confirm_state\n confirm_country\n\n # Street number is probably the next easiest thing to find\n confirm_street_number\n confirm_street_label\n confirm_street_direction\n\n confirm_unit\n # name is between number && (label || direction)\n confirm_street_name\n # city is between (label || direction || name) && (state || postal)\n confirm_city\n end",
"def all_ok?\n tm = TactBattleManager\n all_sh_ok = tm.shared_act_ok? && @tb_state != :wait\n tbu_all_ok = @tb_actions[:all] < all_action_lmt && @tb_state != :wait\n tm.use_shared_actions? ? all_sh_ok : tbu_all_ok\n end",
"def test_preferences\n c = cli(['-m'])\n assert(c.map?)\n refute(c.print?)\n refute(c.save?)\n end",
"def there_are_five_disabled_puppies\n expect(Puppy.disabled.size).to eql 5\nend",
"def complete?(counts_by_length)\n num_players = counts_by_length['1'][1]\n counts_by_length.each do |key, value|\n l = key.to_i\n if l > 1\n num_perms = 1\n l.times do |index|\n num_perms *= (num_players - index)\n end\n return false if num_perms != counts_by_length[key][1]\n end\n end\n true\nend",
"def double_faced?\n two_up? && mana_costs_shown.select(&:present?).count < 2\n end",
"def poker?\n cuantos_pares == 2 && @pares.group_by{|k, v| k}.size == 1\n end",
"def ready_save_and_check_summary\n\t\tself.finished_and_ready = true\n\t\tself.save!\n\t\t@round = Round.find(self.round_id)\n\t\t@round.prefs.each do |p|\n\t\t\tif !p.finished_and_ready\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t\n\tend",
"def set_complete?(eqps = [])\n itms = items\n !itms.empty? && ((itms & eqps).size == itms.size)\n end",
"def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end",
"def game_over?\n combinations = grab_combos\n result = check_combos(combinations)\n [result[0], result[1]]\n end",
"def percolates?\n end",
"def flip?\n two_up? && mana_costs_shown.select(&:present?).count == 2\n end",
"def update_candidates_from(impossible_candidates, backtrack_mode = false)\n prev_cand_count = @candidates.count\n\n if backtrack_mode\n @dirty = true\n if @once\n @backuped_candidates = @candidates\n @once = false\n end\n end\n\n @candidates = (Set.new(@candidates) - Set.new(impossible_candidates)).to_a\n\n\n\n @candidates.count != prev_cand_count\n end",
"def check_prefecture\n if prefecture == \"--未選択--\"\n errors.add(:prefecture, \"選択して下さい\")\n end\n end",
"def possible?\n entries.size > 1\n end",
"def has_dietary_preferences?\n return self.dietary_preference.present?\n end",
"def affordable_combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v <= to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"You can't afford anything...\" end\n end",
"def setup_all_options\n # setup all options one by one\n Constants.preferences_setup_options.each do |option|\n setup_option(option_name(option))\n end\n end",
"def check_if_round_part_b_ready_to_start\n self.creator_preferences.each do |creator_preference|\n # return false if !creator_preference.is_ready\n return false if !creator_preference.finished_round\n end\n self.donor_preferences.each do |donor_preference|\n return false if !donor_preference.is_ready\n end\n self.part_b_started = true\n self.start_time = DateTime.now\n self.save!\n end",
"def include?(target)\n preferences.include?(target)\n end",
"def done\n return if DEFAULTS.keys.sort == @converted.sort\n\n bads = DEFAULTS.transform_values { 0 }.merge(\n @converted.group_by(&:itself).transform_values(&:count)\n ).select { |k, v| v != 1 }\n\n raise \"Options were not converted exactly once! #{bads}\"\n end",
"def check_repeated_choice guess\r\n\t\t\t\t\t@resultb.include? guess\r\n\t\t\t\tend",
"def found_multiple?\n @flags.size > 1\n end",
"def does_set_exist!\n\t\ttrue_set = []\n\t\twhile true_set.length == 0 do\n\t\t\tpossibleCombination = @board.combination(3).to_a\n\t\t\tpossibleCombination.each do |setOf3| \n\t\t\t\tif Board.actual_set?(setOf3)\n\t\t\t\t\ttrue_set = setOf3\n\t\t\t\t\tbreak\n\t\t\t\tend \n\t\t\tend\n\t\t\tif true_set.length == 0\n\t\t\t\tadd_cards\n\t\t\tend\n\t\tend\n\t\treturn true_set\n\tend",
"def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end",
"def check_cooperation(active)\n for battler in active.combination_battlers\n return true if cant_use_cooperation(battler) and not active.multi_action_running\n end\n return false\n end",
"def ready_to_start?\n\t\tenabled_players = @entries.select do |entry|\n\t\t\tentry.enabled\n\t\tend\n\t\tenabled_players.size() >= Constants::MIN_PLAYERS &&\n\t\t\tnames_are_unique?(enabled_players)\n\tend",
"def chosen_baptized_at_home_parish?\n show_empty_radio == 1 || show_empty_radio == 2\n end",
"def solved\n all_queens_placed && attacks_possible != true\n end",
"def par?\n cuantos_pares >= 1\n end",
"def complete_property_checkups?\n nil\n end",
"def two_candidates?\n @candidates.count == 2\n end",
"def baptized_at_home_parish_yes_checked\n chosen_baptized_at_home_parish? && baptized_at_home_parish\n end",
"def sports?\n userPreference.sports?\n end",
"def can_assume_and_change?\n if can_assume?\n\n # Cache wall first\n @can_assume_and_change ||= false\n return @can_assume_and_change if @can_assume_and_change.present?\n\n # Returns TRUE if the setting contains \"assume\"\n #\n # Lookup the available Setting constants for all the\n # various key mappings.\n if setting(assume_key).value =~ /_ask_and_assume/\n log \"can assume(<strong>#{assume_key}</strong>) and <strong>change</strong>\"\n @can_assume_and_change = true\n return true\n end\n\n end\n end",
"def any_key?\n @keys == UndefinedSetting\n end",
"def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end",
"def check_pickups\n @game_state.pickups.select { |pickup| pickup.collides?(self) }.each do |pickup|\n pickup.apply!(self)\n @game_state.pickups.delete(pickup)\n end\n end",
"def done?(assignments)\n \tassignments.size == problem.vars.size\n end",
"def common?\n self.sightings.size > 30\n end",
"def load_all\n parse_json(get(PREFERENCE_URL))['prefs'].each do |p|\n @@greader_preferences[p['id']] = p['value']\n end\n end",
"def consistent?\n bound? && (store.keys & configs.keys).empty?\n end",
"def learned?\n consecutive_successful_repetitions >= WhRails::Application.config.max_consecutive_successful_repetitions\n end",
"def all_primary_picks_are_wins?\n user_picks = primary_pool_picks\n return false if user_picks.count < Week.closed_week_ids.count\n return user_picks.select{|x| x.is_game_over? && !x.is_a_winner? }.count == 0\n end",
"def verb_correct? set\n (set & VERBS).count >= 1\n end",
"def full_house?\n three_of_a_kind? && pair?\n end",
"def enabled_all?; end",
"def all?\n @options[:all].present?\n end",
"def coarticulated?\n place.size > 1\n end",
"def opponent_exhausted_winnings_and_base_cards?\n @opponent.no_base_cards_remaining?\n end",
"def strict?\n each_pair.all?{|name, value|sufficient? name, value}\n end",
"def complete\n #81 times for each block in the puzzle\n @board.each do |key, value|\n next if value != 0\n\n candidatesArray = grand_filter(key)\n\n candidatesArray.each do |possibility|\n @board[key] = possibility\n foundAll = complete\n if(foundAll == true)\n return true\n end\n end\n\n # finished trying all the candidates, backtrack\n @board[key] = 0\n return false\n end\n\n return true\n end",
"def factoring_enabled\n [\n self.CustomerProfileNo == VISMA_CONFIG['factoring_customer_profile_number'],\n self.FormProfileCustNo == VISMA_CONFIG['factoring_form_profile_number'],\n self.RemittanceProfileNo == VISMA_CONFIG['factoring_remittance_profile_number'],\n self.CustomerNo == self.FactCustomerNo.to_i\n ].all?\n end",
"def compute_qualification(team, pilots, pilot_contests)\n if 3 <= pilots.size\n contests_properties = gather_contest_properties(pilot_contests)\n non_primary_participant_occurrence_count = 0\n three_or_more_pilot_occurrence_count = 0\n contests_properties.each do |contest|\n non_primary_participant_occurrence_count += 1 if contest[:has_non_primary]\n three_or_more_pilot_occurrence_count += 1 if 3 <= contest[:pilot_count]\n end\n team.qualified = 3 <= non_primary_participant_occurrence_count &&\n 3 <= three_or_more_pilot_occurrence_count\n else\n team.qualified = false\n end\nend",
"def flush?\n per_suit = matched_suits\n for suit, count in per_suit do\n return true if count >= 5\n end \n return false \n end",
"def possibilities\n @dictionary.length\n end",
"def profile_complete?\n\t\tparameters_with_values = generate_array_of_param_with_value\n\n\t\tparameters_with_values.each do |p|\n\t\t\treturn false if !p\n\t\tend\n\n\t\treturn true\n\tend",
"def all_secondary_picks_are_wins?\n user_picks = secondary_pool_picks\n return false if user_picks.count < Week.closed_second_chance_pick_week_ids.count\n return user_picks.select{|x| x.is_game_over? }.select{|y| !y.is_a_winner? }.count == 0\n end",
"def carnivore_species_fighting?\n @carnivores.uniq.count > 1\n end",
"def on_switches(total_switches)\n switches = {}\n (1..total_switches).each { |num| switches[num] = false }\n\n (1..total_switches).each do |number|\n (number).step(by:number, to: total_switches) do |num|\n switches[num] = !switches[num]\n end\n end\n\n switches.select { |_, switch_on| switch_on }.keys\nend",
"def complete?\n keys.all?(&:complete?)\n end",
"def has_prompted?(kind)\n\t\t@prompted[kind]\n\tend",
"def has_prompted?(kind)\n\t\t@prompted[kind]\n\tend",
"def smtp_prefs_changed?\n SMTP_PREFS.any? { |p| self.changed.include?(p.to_s) }\n end",
"def ask_pref(preference, prompt)\n prefs[preference] = ask_wizard(prompt)\nend",
"def check_config\n %w(token).each do |param|\n (usage and return false) if Weechat.get_plugin_config(param).to_s.empty?\n end\n true\nend",
"def complete_flag_values?\n @complete_flag_values\n end",
"def allow_mode_switching?\n submissions.count == 0 || autograded?\n end",
"def several?\n several = (count > 1) if several.nil?\n end",
"def over?\n self.assignments.remaining.count == 0 && !sets_available?\n end",
"def save_autoshare_prefs(network, params)\n events = params.select {|k,v| v == '1'}.keys\n rv = preferences.save_autoshare_opt_ins(network, events)\n if rv\n @preferences = rv\n true\n else\n false\n end\n end",
"def active_difficulties(*values)\n if values.include? :none\n @difficulties = []\n else\n # Change active difficulties to what the user supplies, but only when they supply a difficulty we already know about\n @difficulties = values.reject { |v| not @difficulties.include? v }\n end\n end",
"def flush?\n return val if val.map(&:suit).uniq.count == 1\n\n false\n end",
"def wheelchair?\n [true, false].sample\n end",
"def suitable?\n @suitable ||= begin\n info = AvailableHints.keys.inject([]) do |ary, attr|\n ary.concat Array.wrap(send(attr))\n end\n\n info.size >= 7\n end\n end"
] | [
"0.6566466",
"0.62994796",
"0.6233791",
"0.5991729",
"0.5973898",
"0.59432155",
"0.5911168",
"0.58726835",
"0.58512074",
"0.577376",
"0.5747453",
"0.57448065",
"0.5718785",
"0.567215",
"0.5671604",
"0.5659553",
"0.5609859",
"0.5583733",
"0.5580997",
"0.55703056",
"0.55646974",
"0.55578715",
"0.5524483",
"0.54917836",
"0.54859084",
"0.54786474",
"0.5475111",
"0.54719317",
"0.5469968",
"0.54516596",
"0.5439584",
"0.5432469",
"0.5402167",
"0.537639",
"0.53660434",
"0.5364877",
"0.5353149",
"0.534344",
"0.53266",
"0.53261596",
"0.53203946",
"0.5315649",
"0.53054345",
"0.530199",
"0.52889144",
"0.5277077",
"0.52724",
"0.5271416",
"0.5269437",
"0.52662563",
"0.52628",
"0.5258303",
"0.5252613",
"0.5246234",
"0.52433854",
"0.52368385",
"0.5232594",
"0.52263206",
"0.5220885",
"0.52059644",
"0.52047396",
"0.52002305",
"0.5194994",
"0.5189657",
"0.5185465",
"0.5184116",
"0.518252",
"0.5176891",
"0.517359",
"0.517067",
"0.516793",
"0.51648206",
"0.51622677",
"0.5162009",
"0.51575285",
"0.5153205",
"0.5145832",
"0.51396745",
"0.5133809",
"0.5128685",
"0.51269364",
"0.5121634",
"0.51131105",
"0.5102475",
"0.5099544",
"0.50965506",
"0.50934845",
"0.50934845",
"0.50934535",
"0.5088553",
"0.5088151",
"0.5079259",
"0.5078825",
"0.5076827",
"0.5071591",
"0.5070127",
"0.5056832",
"0.50537086",
"0.5051962",
"0.50500757"
] | 0.7163214 | 0 |
Is there available positions for more matches based on the defined `match_positions`? | def free?
matches.length < match_positions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matched_positions\n _response_entity.fetch(\"matchingTokens\", [])\n end",
"def near_match\n (0..3).each do |guess_index|\n compare_for_near_match(guess_index)\n end\n end",
"def match_at? rexp, pos = 0\n MatchAt.match_at? self, rexp, pos\n end",
"def exact_matches(loc=@counter)\n matches = 0\n 4.times{ |x| matches += 1 if @guessgrid[loc][x] == @code[x] }\n matches\n end",
"def has_match?\n !match_x.nil? && !match_y.nil?\n end",
"def locate_matching_blocks\n @matching_blocks = matching_sdiff_segments.map do |segment|\n create_match_from(segment)\n end\n\n # an empty match at the end forces the loop to make operations to handle\n # the unmatched tails I'm sure it can be done more gracefully, but not at\n # 23:52\n @matching_blocks << HTMLDiff::Match.new(@old_words.size,\n @new_words.size, 0)\n end",
"def matches\n @matches ||= []\n end",
"def match_result\n [match_x, match_y]\n end",
"def match_position_by_similar\n add_fuzz_to_images\n self.match_result = search_image.find_similar_region(template_image)\n return match_result\n end",
"def find_matches\n @match_distances = Match.find_match(current_user, \"Any\", nil)\n end",
"def match_position_by_opencv\n t_image = CvMat.load(template_image.filename)\n s_image = CvMat.load(search_image.filename)\n\n result = s_image.match_template(t_image, :sqdiff_normed)\n\n point = result.min_max_loc[2]\n if point.x > 0 && point.y > 0\n self.match_result = [point.x, point.y]\n end\n return match_result\n end",
"def if_match(teams, start)\n\tmatch = Array.new\n\ttest = FuzzyStringMatch::JaroWinkler.create( :native )\n\twhile start < RC_C.num_rows\n\t\tteams.each do |team|\n\t\t\ti = test.getDistance(team, RC_C.rows[start][1])\n\t\t\tif i > 0.65\n\t\t\t\tmatch.push(team)\n\t\t\t\t# puts \"match, #{team} matches #{RC_C.rows[start][1]}\"\n\t\t\tend\n\t\tend\n\t\tstart += 1\n\tend\n\treturn match\nend",
"def positions(passes) = passes.map { find_position(_1) }",
"def match_position_by_pixel_rows\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n\n catch :try_next_position do\n puts \"Checking search image at #{x}, #{y}\" if @verbose\n\n template_image.rows.times do |j|\n\n t_width = template_image.columns\n\n # Just check first row, not full string\n t_row = template_image.export_pixels_to_str(0, j, t_width, 1)\n s_row = search_image.export_pixels_to_str(x, y+j, t_width, 1)\n\n if s_row != t_row\n # if any row doesn't match, move on.\n throw :try_next_position\n end\n\n end # template_image.columns.times do\n\n # Success! We made it through all rows \n # at this position.\n self.match_result = x, y\n throw :found_match\n\n end # catch :try_next_position\n\n end\n end\n end # catch :found_match\n return match_result\n end",
"def match_position_by_full_string\n\n t_width = template_image.columns\n t_height = template_image.rows\n t_pixels = template_image.export_pixels_to_str(0, 0, t_width, t_height)\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n \n puts \"Checking search image at #{x}, #{y}\" if @verbose\n s_pixels = search_image.export_pixels_to_str(x, y, t_width, t_height)\n \n if s_pixels == t_pixels\n self.match_result = x, y\n throw :found_match\n end\n\n end\n end\n end # catch :found_match\n return match_result\n end",
"def match_position_by_pixel_strings\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n\n catch :try_next_position do\n puts \"Checking search image at #{x}, #{y}\" if @verbose\n\n template_image.rows.times do |j|\n template_image.columns.times do |i|\n\n t_pixel = template_image.export_pixels_to_str(i, j, 1, 1)\n s_pixel = search_image.export_pixels_to_str(x+i, y+j, 1, 1)\n\n if s_pixel != t_pixel\n throw :try_next_position\n end\n\n end # template_image.rows.times do\n end # template_image.columns.times do\n\n # Success! We made it through the whole \n # template at this position.\n self.match_result = x, y\n throw :found_match\n\n end # catch :try_next_position\n\n end\n\n end\n end # catch :found_match\n return match_result\n end",
"def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end",
"def match_position_by_pixel_objects\n qfuzz = QuantumRange * fuzz\n \n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n\n catch :try_next_position do\n puts \"Checking search image at #{x}, #{y}\" if @verbose\n\n template_image.rows.times do |j|\n template_image.columns.times do |i|\n\n # #pixel_color returns a Pixel object\n # around 4x slower than export_pixels_to_str\n t_pixel = template_image.pixel_color(i,j)\n s_pixel = search_image.pixel_color(x+i,y+j)\n \n # Pixel objects allow fuzzy comparisions\n # #fcmp returns true/false if pixels are close\n if !s_pixel.fcmp(t_pixel, qfuzz)\n throw :try_next_position\n end\n\n end # template_image.rows.times do\n end # template_image.columns.times do\n\n # Success! We made it through the whole template\n # at this position.\n self.match_result = x, y\n throw :found_match\n\n end # catch :try_next_position\n\n end\n\n end\n end # catch :found_match\n return match_result\n end",
"def contain?(position); end",
"def matcher(match)\n match = match.flatten.uniq\n match.each do |m|\n @counter.count(m)\n end\n end",
"def scan_proximity(item, match, x_pos, y_pos)\n (x_pos + 1..x_pos + 2).each do |next_x_pos|\n scan_area = @radar_scan.crop(next_x_pos, y_pos, item.width, item.height)\n next_match = item.match(scan_area)\n if next_match > match\n x_pos = next_x_pos\n match = next_match\n end\n end\n\n [x_pos, match]\n end",
"def match!\n clear!\n tighten_search_area\n @benchmark = Benchmark.measure do\n send(strategy_method)\n end\n save_match_file if highlight_match\n return has_match?\n end",
"def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches(input)\n (0...input.length).reduce([]) do |memo, offset|\n memo + matches_at_offset(input, offset)\n end\n end",
"def near_matches(guess)\n near_matches = 0\n COLORS.values.each do |color|\n near_matches += [pegs.count { |x| x == color }, \n guess.pegs.count { |x| x == color }].min\n end\n \n near_matches - exact_matches(guess)\n end",
"def receive_match(pos_1, pos_2)\n @matched_cards[pos_1] = true\n @matched_cards[pos_2] = true\n end",
"def try_to_match(tokens, match_start)\n progress = PatternMatchProgress.progress_start\n (match_start...tokens.length).each do |i|\n token = tokens[i]\n features = token.feature.split(',')\n y = features.last\n if reWord !~ y\n if y == '、'\n next\n end\n return nil\n end\n if progress.word_start? && !jiritu_token?(features)\n return nil\n end\n n = count_char(y)\n progress = progress.add_sentence(token.surface, n)\n\n if progress.word_length_matched?\n progress = progress.mark_word_break\n elsif progress.word_length_over?\n return nil\n end\n return progress.sentence if progress.matched?\n end\n nil\n end",
"def match_at? str, pos = 0\n MatchAt.match_at? str, self, pos\n end",
"def is_a_match(total_in_common)\n total_in_common >= 2 ? true : false\n end",
"def compound_match(fragments, target)\n match_set = fragments.map.with_index{|word, idx| [target.split(word), idx]}.select{|item| item[0].include?(\"\")}\n match_set = match_set.select{ |item| fragments.index(item.first&.last) != nil}\n index1 = match_set.first&.last\n index2 = fragments.index(match_set&.first&.first&.last) || nil\n return nil if index2.nil?\n\n if fragments[index1] + fragments[index2] == target\n if index1 < index2\n return [fragments[index1], fragments[index2], [index1, index2]]\n else\n return [fragments[index2], fragments[index1], [index1, index2]]\n end\n else\n if index1 < index2\n return [fragments[index1], fragments[index2], [index2, index1]]\n else\n return [fragments[index2], fragments[index1], [index2, index1]]\n end\n end\nend",
"def matches?(sequence)\n (0..(sequence.size-length)).each do |pos|\n return pos if matches_at?(pos, sequence)\n end\n return false\n end",
"def match_position_by_sad\n # SAD = \"sum of absolute differences\"\n best_sad = 1_000_000\n\n search_rows.times do |y|\n search_cols.times do |x|\n puts \"Checking search image at #{x}, #{y}\" if @verbose\n sad = 0.0\n\n template_image.rows.times do |j|\n template_image.columns.times do |i|\n s_pixel = search_image.pixel_color(x+i,y+j)\n t_pixel = template_image.pixel_color(i,j)\n\n # Could use pixel hue\n # #to_hsla returns [hue, saturation, lightness, alpha]\n # sad += (s_pixel.to_hsla[0] - t_pixel.to_hsla[0]).abs\n \n # Or pixel \"intensity\" which is computed as:\n # (0.299*R) + (0.587*G) + (0.114*B)\n sad += (s_pixel.intensity - t_pixel.intensity).abs\n \n end\n end\n\n # save if this is best position (least difference) so far\n if sad < best_sad\n puts \"New best at #{x}, #{y}: #{sad}\" if @verbose\n best_sad = sad\n self.match_result = x, y\n end\n\n end\n end\n\n return match_result\n\n end",
"def is_matched(ind)\n\t\treturn @tile_Array[ind].return_match\n\tend",
"def find_matches(a,b)\n \n match_count = 0\n if a[0..1] == b[0..1]\n match_count += 1\n end\n if a[3..4] == b[3..4]\n match_count += 1\n end\n if a[6..7] == b[6..7]\n match_count += 1\n end\n if a[9..10] == b[9..10]\n match_count += 1\n end\n if a[12..13] == b[12..13]\n match_count += 1\n end\n return(match_count)\nend",
"def matches\n process_events! unless @matches\n @matches\n end",
"def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end",
"def is_stable?\n # Every person's partner should match up\n @matches.all? { |k,v| is_matched?(k, v) }\n end",
"def near_matches(player_code)\n imperfect_indices = find_imperfect_indices(player_code)\n\n checked = []\n near_matches = 0\n\n imperfect_indices.each do |i|\n imperfect_indices.each do |j|\n unchecked = checked.none? { |digit| self[i] == digit }\n is_match = self[i] == player_code[j]\n\n if i != j && unchecked && is_match\n checked << self[i]\n near_matches += 1\n break\n end\n end\n end\n\n near_matches\n end",
"def color_matches(loc=@counter)\n code = get_code_remainder(loc)\n guess = get_guess_remainder(loc)\n x = 0\n y = 0\n index = 0\n totalmatches = 0\n matches = 0\n guess.each{|g|\n code.each{ |c| \n if c == g && matches == 0\n matches += 1\n guess[x] = 0\n code[y] = 5\n end\n y += 1\n }\n y = 0\n totalmatches += 1 if matches > 0\n matches = 0\n x += 1\n }\n totalmatches\n end",
"def matches_at?(position, sequence)\n length.times do |t|\n sub_pos = position+t\n return false if sequence[sub_pos].cat != @right_symbols[t]\n end\n return true\n end",
"def grid_search grid, target\n match = []\n i = 0\n\n grid.each_with_index do |x,xi|\n x.each_with_index do |y,yi|\n if y == target[i][i] && grid[xi][yi+1] == target[i][i+1] && grid[xi][yi+2] == target[i][i+2]\n match << [xi,yi]\n end\n # if y == target[i+1][i] && grid[xi][yi+1] == target[i+1][i+1]\n # match << [xi,yi]\n # end\n end\n end\n match\n\n # if match.size == target.size\n # puts \"YES\"\n # else\n # puts 'NO'\n # end\nend",
"def contains?(primary_grid, match_grid)\n\tmatch_columns = match_grid.first.length\n\tcolumns_start = 0\n\tcolumns_end = columns_start + match_columns - 1\n\twhile columns_end < primary_grid.first.length\n\t\tmatch_row = 0\n\t\tprimary_grid.each do |primary_row|\n\t\t\tprimary_slice = primary_row[columns_start..columns_end]\n\t\t\tif match_grid[match_row] == primary_slice\n\t\t\t\tmatch_row += 1\n\t\t\t\treturn true if match_row == match_grid.length\n\t\t\tend\n\t\tend\n\t\tcolumns_start += 1; columns_end += 1\n\tend\n\tfalse\nend",
"def offset_matches_rule?(offset, rule_offset); end",
"def offset_matches_rule?(offset, rule_offset); end",
"def num_near_matches(guess_object)\n pegs = guess_object.pegs\n count = 0\n pegs.each_with_index do |char, i|\n count += 1 if @pegs.include?(char) && char != @pegs[i]\n end\n count\n end",
"def matches\n parse\n end",
"def near_matches(other_code)\n num_matches = 0\n matches = []\n i = 0\n while (i < self.pegs.length)\n j = 0\n while (j < other_code.pegs.length)\n if(self[i] == other_code[j])\n if(i != j)\n unless (matches.include?(self[i]))\n num_matches += 1\n matches << self[i]\n end\n else\n if(matches.include?(self[i]))\n num_matches -= 1\n end\n end\n end\n j += 1\n end\n i += 1\n end\n num_matches\n end",
"def matches_at_offset(input, input_start_offset)\n reset_current_states\n\n matches = []\n (input_start_offset...input.length).each do |offset|\n token = input[offset]\n self << token\n matches << MatchRef.new(input, input_start_offset..offset) if accept?\n end\n matches\n end",
"def matches\n\t\t\tcompetition.matches\n\t\tend",
"def receive_match(position1, position2)\n @matched_cards[position1] = true\n @matched_cards[position2] = true\n end",
"def num_near_matches(guess)\n counter = 0\n guess.pegs.each { |peg| counter += 1 if @pegs.include?(peg) }\n counter - num_exact_matches(guess)\n end",
"def offset_after_match\n offset + match_length\n end",
"def all_positions_full?\n available_positions.empty?\n end",
"def match(p0) end",
"def match(p0) end",
"def position_available(marker_pos, player1_obj, player2_obj)\n # test - marker_pos - index has a limit of 1 to 9\n return false if marker_pos.negative? || (marker_pos > 8)\n\n # test - new move - does not overlap any previous moves done.\n return true if (player1_obj.moves_arr[marker_pos].zero? && player2_obj.moves_arr[marker_pos].zero?) == true\n\n false\nend",
"def matches( input )\n matches = Array.new\n\n input.shorter.each_with_index do |char, idx|\n input.window_range( idx ).each do |widx|\n if input.longer[widx] == char then\n matches << widx\n break\n end\n end\n end\n\n return matches\n end",
"def match(nodes, offset)\n if offset >= nodes.length\n return min_repeats.zero? ? offset : nil\n end\n\n count = 0\n nodes[offset...nodes.length].each_with_index do |n, i|\n next if n.ignorable?\n\n return returnable(nodes, i + offset + 1) if count == max_repeats\n\n if n.traversible? && n.name == seeking\n count += 1\n return returnable(nodes, i + offset + 1) if count == max_repeats\n\n next\n end\n\n return count >= min_repeats ? returnable(nodes, i + offset) : nil\n end\n count < min_repeats ? nil : returnable(nodes, nodes.length) # all nodes were consumed\n end",
"def exact_matches\n matches = 0\n 4.times{ |x| matches += 1 if @num_guess[x] == @code[x] }\n matches\n end",
"def seek_pos lines, series\n i, j = 0, 0\n best_match = [nil, nil]\n while line = lines[i]\n i += 1\n if line !~ /^\\s*$/\n indent, _, _, pattern = series[j]\n return [i, j] if !indent # max match\n if line =~ pattern\n j += 1\n best_match = [i, j] if !best_match[1] or best_match[1] < j\n else\n leading = line[/^\\s*/].size\n # when 0?\n if leading > 0 and leading < indent.size\n i -= 1\n j = leading / 2 - 1\n end\n end\n end\n end\n best_match\nend",
"def all_neighbords(base_word)\n \n matches = four_letter_words.select do |match_word|\n are_neighbors?(base_word, match_word)\n end \n\n return matches\n \nend",
"def match\n @match\n end",
"def match_points(match, player)\n scores = Result.where(:match_id => match)\n score_1 = scores.first\n score_2 = scores.last\n if score_1[:player_id] == player\n if score_1[:score] == 3 && score_2[:score] == 2\n points = 6\n elsif score_1[:score] == 3 && score_2[:score] == 1\n points = 6\n elsif score_1[:score] == 3 && score_2[:score] == 0\n points = 7\n elsif score_1[:score] == 2 && score_2[:score] == 3\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 3\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 3\n points = 2\n elsif score_1[:score] == 2 && score_2[:score] == 0\n points = 4\n elsif score_1[:score] == 2 && score_2[:score] == 1\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 2\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 2\n points = 2\n elsif score_1[:score] == 2 && score_2[:score] == 2\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 0\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 1\n points = 2\n elsif score_1[:score] == 1 && score_2[:score] == 1\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 0\n points = 2\n elsif score_2[:score] == -1\n points = 6\n elsif score_1[:score] == -1\n points = 0\n end\n elsif score_2[:player_id] == player\n if score_2[:score] == 3 && score_1[:score] == 2\n points = 6\n elsif score_2[:score] == 3 && score_1[:score] == 1\n points = 6\n elsif score_2[:score] == 3 && score_1[:score] == 0\n points = 7\n elsif score_2[:score] == 2 && score_1[:score] == 3\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 3\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 3\n points = 2\n elsif score_2[:score] == 2 && score_1[:score] == 0\n points = 4\n elsif score_2[:score] == 2 && score_1[:score] == 1\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 2\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 2\n points = 2\n elsif score_2[:score] == 2 && score_1[:score] == 2\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 0\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 1\n points = 2\n elsif score_2[:score] == 1 && score_1[:score] == 1\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 0\n points = 2\n elsif score_1[:score] == -1\n points = 6\n elsif score_2[:score] == -1\n points = 0\n end\n end\n return points\n end",
"def match_range(range, match); end",
"def are_neighbors?(word1,word2)\n counter = 0\n 4.times do |index|\n if word1|index| == word2|index|\n counter+=0\n end \n end \n return counter == 3\nend",
"def match?(textlines)\n matches = {}\n matchcount = 0\n \n # check each line against each string\n textlines.each do |line| \n \n # strip all chars that aren't alphanumeric, incl spaces -- this helps hugely with OCR junk\n stripped = line.upcase.gsub(/[^A-Z]/,\"\")\n \n # try to match this line against each string. store the original (unstripped) line if match\n @linematchers.each do |matcher, thresh|\n if !matches.has_key?(matcher)\n if matcher.match(stripped) < thresh\n matches[matcher] = line\n matchcount+= 1\n if matchcount == @k\n #break #comment this break if you want to return all lines matched, not just the first k\n end\n end\n end\n end \n end\n \n # assemble matched lines together and return, if we matched at least k. useful for debugging!\n # otherwise return nil\n if (matchcount >= @k)\n matchedlines = \" -- \"\n matches.each do |matcher, line|\n matchedlines += line.to_s.strip + \" -- \"\n end\n return matchedlines\n else\n return nil\n end\n end",
"def matcher_search(m, empty_offset: false)\n r = rows.select { |r| r[matcher_i] == m }\n if empty_offset\n r.empty? ? [offset] : r\n else\n r\n end\n end",
"def flag_match_found\n @xn_context.match_found = true\n end",
"def exact_matches(guess)\n pegs.zip(guess.pegs).count { |a, b| a == b }\n end",
"def matches(query)\n @matches ||= search(query)\n end",
"def queue_matches\n\n end",
"def match_range sq1, sq2, how \n\t\tmatches = 0\n\n\t\twater_count = 0\n\t\trange = (-radius..radius)\n\t\trange.each do |row|\n\t\t\tFiber.yield\n\n\t\t\trange.each do |col|\n\t\t\t\tsq_a = sq1.rel [ row, col ]\n\t\t\t\tsq_b = sq2.rel target_coord( row, col, how )\n\n\t\t\t\tnext if sq_a.region.nil? or sq_b.region.nil?\n\n\t\t\t\tif sq_a.water? == sq_b.water?\n\t\t\t\t\tmatches += 1\n\t\t\t\t\twater_count += 1 if sq_a.water?\n\t\t\t\telse\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\tend\n\t\tend\n\n\t\t# Mark matches without water as not valid\n\t\tmatches = 0 if water_count == 0\n\n\t\tmatches\n\tend",
"def find_matchs(round, season)\n if round.nil?\n return []\n end\n\n season = self.current_season if season.nil?\n rounds = []\n rounds = season.rounds.collect {|r| r if\n r.number <= round.number}\n matchs = []\n rounds.each do |r|\n if !r.nil?\n r.match_generals.each {|m| matchs << m if m.guest == self or\n m.local == self}\n end\n end\n matchs\n end",
"def matches()\n sql = \"SELECT matches.* FROM matches WHERE away_team_id = #{@id} OR home_team_id = #{@id};\"\n matches = SqlRunner.run( sql )\n result = matches.map { |match| Match.new(match) }\n return result\n end",
"def points\n return 0 if match.invalid_result?\n return 4 if self.score == match.score\n return 3 if self.goals_diff == match.goals_diff\n return 2 if self.winner == match.winner\n return 0\n end",
"def exact_match(guess)\n\t\t\t# keeps track of which indices have been matched\n\t\t\t@indices = [0,1,2,3]\n\t\t\t# creates array of the matching indices in guess and @code\n\t\t\t@indices.delete_if {|i| guess[i] == @code[i] }\n\t\t\t# returns number of exact matches\n\t\t\t4 - @indices.length\n\t\tend",
"def aggressive\n\t# make a matches array. this returns the equivalent of the matches[] block above\n\tm=[]\n\n\n\t# return the matches array, even if it's emtpy\n\tm\nend",
"def position_result\n hurdle_match.rank.index(self) + 1\n end",
"def match\n \n # Identify matching cells, track them\n \n # Match skill names\n i = 0\n \n 5.times do |search_row_i|\n 5.times do |result_row_i|\n # Match skill name (column = 0)\n match_keyword(i, [search_row_i, 0], [result_row_i, 0])\n \n if match_id_exists?(i)\n \n # Match skill years experience\n match_integer(i, [search_row_i, 1], [result_row_i, 1])\n \n # Match skill details\n match_keyword_array(i, [search_row_i, 2], [result_row_i, 2])\n end\n \n i += 1\n end\n end\n \n # Match additional job-related stuff (job type, job location)\n \n \n # Calculate points\n calc_skill_names([[0, 1], [5, 6]], false, 50, 10)\n calc_skill_names([[2, 3, 4], [7, 8, 9], [10, 15, 20], [11, 16, 21]], (pct > 0), 40, 10) \n calc_skill_names([[12, 13, 14], [17, 18, 19], [22, 23, 24]], (pct > 0), 30, 10)\n \n calc_additional_attributes({:years_experience_pct => 5, :skill_details_first_pct => 2.5, :skill_details_additional_pct => 1})\n \n # puts \"---------- PCT: \" + @pct.to_s\n \n end",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def matches\n attributes.fetch(:matches)\n end",
"def look_for_win\n Game::LINES.each do |winning_line|\n markers = group_positions_by_marker(winning_line)\n if markers[marker].length == 2 and markers.keys.include?(nil)\n puts markers.keys\n choice = markers[nil].first\n return choice\n end\n end\n false\n end",
"def matches\n @subject.matches\n end",
"def match\n true\n end",
"def contain_match_at_indices(word, indices, guess)\n\t\t#Set secret_word to word from candidate_words\n\t\t#so we can use ComputerPlayer#check_guess method\n\t\t@secret_word = word\n\t\tmatching_indices = check_guess(guess)\n\t\t(indices == matching_indices) ? true : false\t\t\n\tend",
"def hit_itself?\n # list.uniq removes all repeated elements from a list\n @positions.uniq.length != @positions.length\n end",
"def exact_matches(other_code)\n exact_matches = 0\n @seq.each_with_index do |letter, index|\n exact_matches += 1 if self.is_exact_match?(other_code, index)\n end\n exact_matches\n end",
"def args_match(matchers, candidates, match_data = {})\n matchers.each do |m|\n case m.function\n when :'?'\n return false if candidates.empty?\n match_data[m.literal] = candidates.shift\n when :'_'\n return false if candidates.empty?\n return false unless candidates.shift.literal == m.literal\n when :'[]'\n return false if candidates.empty?\n match_data[m.literal] = candidates\n candidates = []\n else\n return false if candidates.empty?\n return false unless do_match(m, candidates.shift, match_data)\n end\n end\n candidates.empty?\n end",
"def compound_match(fragments, target)\r\n a = fragments.uniq.combination(2).find { |a, b| a + b == target || b + a == target }\r\n return unless a\r\n b = [fragments.index(a[0]), fragments.index(a[1])]\r\n [a[0], a[1], target.start_with?(a[0]) ? b : b.reverse]\r\n end",
"def return_match\n\t\treturn @matched\n\tend",
"def match; end",
"def match; end",
"def match_result(item, x_pos, y_pos)\n scan_area = @radar_scan.crop(x_pos, y_pos, item.width, item.height)\n match = item.match(scan_area)\n return unless match >= @accuracy\n\n next_x_pos, next_match = scan_proximity(item, match, x_pos, y_pos)\n @result_collector.run(item, next_x_pos, y_pos, next_match)\n end",
"def each\n position = (0..@max_size - 1)\n\n loop do\n match = @mapper.call(@buffer[position])\n\n if match.nil?\n position = (position.begin..position.end - 1)\n position = slide_unmatched_window(position) if position.end < position.begin\n else\n yield match\n position = slide_matched_window(position)\n end\n\n break if position.first >= @buffer.size\n end\n end"
] | [
"0.694176",
"0.6779318",
"0.6534157",
"0.64967436",
"0.6483444",
"0.63267237",
"0.6311977",
"0.6306766",
"0.6263883",
"0.62590885",
"0.6214159",
"0.6184969",
"0.61677545",
"0.6165823",
"0.61492443",
"0.61165196",
"0.61048514",
"0.6076623",
"0.60729676",
"0.60236967",
"0.6012155",
"0.5998364",
"0.5987678",
"0.5982499",
"0.5982499",
"0.5982499",
"0.5982499",
"0.5982499",
"0.5982499",
"0.5980385",
"0.5952704",
"0.59371686",
"0.5932219",
"0.5928911",
"0.5910615",
"0.5895139",
"0.5893543",
"0.5879776",
"0.58678967",
"0.5844425",
"0.58379877",
"0.5833102",
"0.5807255",
"0.5805485",
"0.57942116",
"0.57853353",
"0.57745534",
"0.5767761",
"0.5759929",
"0.5759929",
"0.5759364",
"0.57522273",
"0.57521445",
"0.5747171",
"0.5745536",
"0.5743029",
"0.57398313",
"0.57275116",
"0.572236",
"0.57136935",
"0.57136935",
"0.5694658",
"0.5689331",
"0.5689037",
"0.5686316",
"0.5679986",
"0.56733716",
"0.5657457",
"0.56507194",
"0.56151503",
"0.56043833",
"0.55996096",
"0.5597967",
"0.5591437",
"0.558878",
"0.55877423",
"0.55841845",
"0.55799663",
"0.5579507",
"0.5570302",
"0.5569065",
"0.55669266",
"0.55658597",
"0.5564838",
"0.5560313",
"0.5559968",
"0.55536145",
"0.5548455",
"0.55398434",
"0.5521624",
"0.5503024",
"0.54923666",
"0.5484659",
"0.54708004",
"0.54676706",
"0.5464261",
"0.54607195",
"0.54607195",
"0.54587686",
"0.54585177"
] | 0.61427236 | 15 |
Delete the leastpreferred candidate from the matches array | def free!
return false if matches.empty?
match_preference_indexes = matches.map { | match | preferences.index match }
max = match_preference_indexes.max # The index of the match with the lowest preference
candidate_to_reject = preferences[ max ]
# Delete from both sides
candidate_to_reject.matches.delete self
self.matches.delete candidate_to_reject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim(leaderboard, spectrum, n)\n lb_map = {}\n leaderboard.each do |peptide|\n linear_score = cyclopeptide_scoring_linear(peptide, spectrum)\n lb_map[peptide] = linear_score\n end\n sorted = lb_map.sort_by {|k,v| v}.reverse\n #puts sorted.join(\" \")\n for j in n..leaderboard.size-1\n if sorted[j][1] < sorted[n-1][1]\n #puts \"deleting #{sorted[j][0]}\"\n leaderboard.delete(sorted[j][0])\n end \n end\n leaderboard\nend",
"def delete_matched(matcher, options = nil)\n key = expand_key(matcher)\n\n begin\n @gibson.mdel key\n rescue\n 0\n end\n end",
"def prune\n @set.clear\n end",
"def remove_duplicate_matches(matches)\r\n # Sort the items.\r\n # Sort the array without matches[0], since we need it to\r\n # stay in place no matter what.\r\n if matches.length>0\r\n matches[1..-2] = matches[1..-2].sort.uniq\r\n end\r\n matches\r\n end",
"def remove_candidate k\n\t\tif !@solved\n\t\t\t@candidates.delete k\n\t\t\tif @candidates.size == 1\n\t\t\t\treturn @candidates.to_a[0]\n\t\t\tend\n\t\tend\n\t\treturn 0\n\tend",
"def phase1_reduce\n removed_all = []\n\n # 1.3i - remove any that match 1.3i\n @best_proposals.each_with_index do |p,i|\n slice_point = @people_prefs[i].index(p) + 1\n removed_from_i = @people_prefs[i].slice!(slice_point, @people_prefs[i].count)\n removed_all << removed_from_i\n end\n\n # 1.3ii - remove user i from the list of those he had removed above\n removed_all.each_with_index do |list,i|\n list.each do |ignored_user|\n @people_prefs[ignored_user].delete(i)\n end\n end\n\n @people_prefs\n end",
"def delete_least_common\n lc = least_common_word\n self.word_counts.delete(lc) unless lc.nil? || self.word_counts.nil?\n end",
"def delete_matched(matcher, options = T.unsafe(nil)); end",
"def delete_matched\n raise NotImplementedError, \"#{self.class} does not support delete_matched\"\n end",
"def delete_matches(to_delete, array)\n to_delete = to_delete.reverse # so indexes don't shift down as items are being deleted\n to_delete.each do |num|\n array.delete_at(num)\n end\n array\n end",
"def candidates_of(file)\n @table.candidates_of(file).delete(file)\n end",
"def identify_and_destroy_choices_with_no_first_place_votes(choices_with_first_place_votes)\n\n first_choice_ids = []\n choice_ids = []\n #first_choice_rankings only have choices with first choices\n choices_with_first_place_votes.each { |ranking|\n if ranking[0]\n #extracting choice_id\n first_choice_ids.push(ranking[0][\"choice_id\"])\n end}\n\n self.choices.each { |choice|\n choice_ids.push(choice.id)}\n\n #remove choices with first place votes\n choices_with_no_first_place_votes_ids = choice_ids - first_choice_ids\n \n choices_with_no_first_place_votes_ids.each { |id|\n choice = Choice.find(id)\n\n choice.destroy\n\n }\n end",
"def delete_matched(matcher, options = nil)\n @redis.keys(\"#{VALUE_PREF}_*\").map{|key| key[(VALUE_PREF.size + 1)..-1] }.grep(matcher).each do |key| \n delete_entry(key, options)\n end.size\n end",
"def delete_unknown\n Jhead.call(\"-du\", @match, @pattern)\n end",
"def subtractSet(chosenCards)\n @cardsOnTable.each { |c|\n if c = chosenCards[0]\n @cardsOnTable.delete_at(0)\n elsif c = chosencards[1]\n @cardsOnTable.delete_at(1)\n elsif c = chosenCards[2]\n @cardsOnTable.delete_at(2)\n end\n }\n end",
"def delete_matched(matcher, options = nil)\n raise NotImplementedError.new(\"#{self.class.name} does not support delete_matched\")\n end",
"def match(array)\n array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end",
"def remove_players\n @players, broke_players = @players.partition{ |p| p.wallet >= @table_minimum }\n broke_players.each{ |p|\n puts \"#{p.name}, you no longer have enough money to meet the table minimum. Better luck next time.\"\n linebreak\n }\n end",
"def prune_using_preferences(matching_elements, opts = {})\n fail Error, \"Not suppurting explicit_preferences\" if opts[:explicit_preferences]\n # prefer element with lower number; 1 - means assembly instance, 2 means its parent, ...\n closest_depth = matching_elements.map(&:depth).min\n matching_elements.select { |element| element.depth == closest_depth }.map(&:aug_component)\n end",
"def delete_min_priority\n loc = delete_min_locator\n loc and [loc.value, loc.priority]\n end",
"def destroy_candidates\n candidates.each do |candidate|\n candidate.destroy\n end\n end",
"def prune_question_set(round_id)\n puts 'Entering prune_question_set()'\n round = Round.find(round_id)\n QuestionOccurrence.where(round_id: round_id).where(\"index_in_round > ?\", round.max_qo_index).each{ |qo| qo.destroy; }\n puts 'Exiting prune_question_set()'\n end",
"def remove\n\t @pieces[chosen] -= 1\n\t update_buttons chosen\n\tend",
"def delete_pose_index\n self.pose_words.clear if Pose.perform_search?\n end",
"def destroy\n # destroy related matchings\n \n @related_matchings = AppCourseMatching.where(course_id: self.id)\n @related_matchings.destroy_all\n \n #destroy itself\n super\n end",
"def delete_min_locator\n return nil if empty?\n use_min\n loc = mode_call(:find_min_loc)\n @heapsize = mode_call(:delete_loc, loc)\n loc\n end",
"def wipe_leading_adjective\n @leading_adjective = nil\n end",
"def sent_proposals\n reversed_matches = Array.new(@group_size)\n @best_proposals.each_with_index do |e, i|\n reversed_matches[e] = i if e\n end\n reversed_matches\n end",
"def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n remove_letter = source.find_all { |letter| letter.to_s.include?(thing_to_delete)}\n\n remove_letter.each { |word| source.delete(word)}\n\n p source\nend",
"def remove_sync_matches(product)\n product.master.integration_sync_matches.destroy_all\n end",
"def match(w_array)\n w_array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end",
"def my_array_deletion_method!(source, thing_to_delete)\r\n words_to_delete = source.find_all { |f| f.to_s.include?(thing_to_delete)}\r\n words_to_delete.each do |word|\r\n source.delete(word)\r\n end\r\n p source\r\nend",
"def delete_objective(data)\n @description = nil\n @collection.delete_at(@collection.find_index(data))\n end",
"def delete_scores\n end",
"def remaining_candidates\n case strategy.to_sym\n when :symmetric\n candidates.reject { | candidate | candidate.full? || candidate.exhausted_preferences? }\n when :asymmetric\n candidate_set1.values.reject { | candidate | candidate.full? || candidate.exhausted_preferences? }\n end\n end",
"def eliminate(val)\r\n @modified = true if @candidates.delete(val) != nil\r\n @value = @candidates.first if @candidates.size == 1\r\n end",
"def reset\r\n@candidates = ['Mika', 'Reggie', 'Kenneth', 'Trevor']\r\n@votes = [m=0, r=0, k=0, t=0]\r\n@canname = ''\r\n@vote =''\r\n@v=0\r\n@tie = []\r\nend",
"def good_guess(pattern)\n merge(pattern)\n @dictionary.keep_only_words_that_match(@solution)\n @possible_letters.delete(letter_in(pattern))\n end",
"def remove_fuzzy(item)\n yield_ngrams(item) do |ngram| \n @ngrams.srem(ngram, \"#{item}:#{compute_soundex_code(item)}\")\n end\n end",
"def fix_unselectable_shortest(terms, prefix, original, subject)\n list = original.list.dup\n shortest = list.min{|one, two| one.length <=> two.length}\n return if shortest.nil?\n list.delete(shortest)\n\n check_pattern = completion_matcher(terms, shortest, nil, subject)\n filter = restricted_pattern(prefix)\n if list.all?{|item| check_pattern =~ item and filter !~ item }\n original.list.replace [shortest]\n end\n end",
"def delete_item(unwanted)\r\n @arr.delete(unwanted)\r\n end",
"def unmatch_existing_match(user_id, matched_id)\n # Find User C/D's Match entry.\n selected_match = Match.where(user_id: matched_id).first\n selected_match.matched_id = nil\n selected_match.save(validate: false)\n\n # Find User A/B's Match entry.\n selector_match = Match.where(user_id: user_id).first\n selector_match.matched_id = nil\n selector_match.save(validate: false)\n end",
"def remove_weakest_individual\n sort_routes\n @routes = @routes[0..-2]\n end",
"def update_possible!()\r\n\r\n #falls es keine Hits gibt, werden ale Tipps geloescht, die eine der Ziffern enthalten\r\n if (@last_hits == [0,0])\r\n @digits.times do |i|\r\n\r\n @left.delete_if{ |x|\r\n x.include?(@last_guess[i])\r\n }\r\n\r\n end\r\n\r\n end\r\n\r\n #falls es keine Black Hits gibt, werden alle Tipps mit einer identischen Stelle geloescht\r\n if @last_hits[0]==0\r\n\r\n @digits.times do |i|\r\n\r\n @left.delete_if { |x|\r\n x[i]==@last_guess[i]\r\n }\r\n end\r\n\r\n end\r\n\r\n #loescht alle, deren Uebereinstimmung mit dem letzten Tipp nicht den Black Hits entspricht\r\n @left.delete_if { |x|\r\n @last_hits[0] != @mastermind.hits(@last_guess,x)[0]\r\n }\r\n\r\n #loescht alle, deren Uebereinstimmung mit dem letzten Tipp nicht den Total Hits entspricht\r\n @left.delete_if { |x|\r\n (@last_hits[0] + @last_hits[1]) != (@mastermind.hits(@last_guess,x)[0]+@mastermind.hits(@last_guess,x)[1])\r\n }\r\n\r\n end",
"def best_match(reviewer_similarity)\n sorted_list = reviewer_similarity.sort_by {|k,v| -v}\n sorted_list[0..20].each do |val|\n @best_match.push(val[0])\n end\n end",
"def preferred_available_teammates\n # self.parse_preferred_teammates\n teammates = self.preferred_teammates.split(\",\")\n teammates.each do |teammate|\n user = User.where(:email => teammate).first\n if user\n if !user.groups.empty?\n teammates.delete(teammate)\n end\n else\n teammates.delete(teammate)\n end\n end\n teammates\n end",
"def delete_max_priority\n loc = delete_max_locator\n loc and [loc.value, loc.priority]\n end",
"def similar_to(main, opts={})\n opts.merge!(default_options)\n \n cleaned = @collection.remove(main)\n\n results = order_by_similarity_score(main, cleaned)\n\n sort_results(results,opts[:size])\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|word| word.to_s.rindex(thing_to_delete) != nil}\n return source\nend",
"def delete_recommendation\n choose_country\n \n puts \"The recommendation for #{@chosen_country.name.capitalize} has been deleted from Traveler's Insight.\"\n crud_menu\n end",
"def predation matchTimes\n\t\tmatchTimes.times do |t| \n\t\t\tif @arrayChromosomes.size < 2\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tpos1=rand(@arrayChromosomes.size)\n\t\t\tpos2=rand(@arrayChromosomes.size)\n\t\t\t\n\t\t\twhile pos1 == pos2 do\n\t\t\t\tpos2=rand(@arrayChromosomes.size)\n\t\t\tend\n\t\t\t\n\t\t\tchromosome1=@arrayChromosomes[pos1]\n\t\t\tchromosome2=@arrayChromosomes[pos2]\n\t\t\tchromosome1.fitness=@@predationMatrix[chromosome1.decision][chromosome2.decision][0]\n\t\t\tchromosome2.fitness=@@predationMatrix[chromosome1.decision][chromosome2.decision][1]\n\t\t\t\n\t\t\tif chromosome1.fitness > chromosome2.fitness\n\t\t\t\t@arrayChromosomes.delete_at pos2\n\t\t\telsif chromosome1.fitness < chromosome2.fitness\n\t\t\t\t@arrayChromosomes.delete_at pos1\n\t\t\telsif chromosome1.fitness == @@predationMatrix[1][1][1]\n\t\t\t\tif not @@killTwoSelfish ###MATAR UNO ALEATORIO\n\t\t\t\t\t@arrayChromosomes.delete_at (rand(2)==0)? pos1 : pos2\n\t\t\t\telse ###MATAR LOS DOS\n\t\t\t\t\t@arrayChromosomes.delete_at pos1\n\t\t\t\t\tif pos1 < pos2\n\t\t\t\t\t\tpos2-=1\n\t\t\t\t\tend\n\t\t\t\t\t@arrayChromosomes.delete_at pos2\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\tend",
"def pbRemovePokemonAt(index)\n return false if index<0 || !$Trainer || index>=$Trainer.party.length\n haveAble = false\n for i in 0...$Trainer.party.length\n next if i==index\n haveAble = true if $Trainer.party[i].hp>0 && !$Trainer.party[i].egg?\n end\n return false if !haveAble\n $Trainer.party.delete_at(index)\n return true\nend",
"def delete( *regexs )\n self.dup.delete!( *regexs )\n end",
"def delete_min\n loc = delete_min_locator\n loc and loc.value\n end",
"def delete_at(index)\n delete_idx = @indexes.each_index.find { |i| index == @indexes[i] }\n return nil unless delete_idx\n\n @indexes.delete_at(delete_idx)\n choice = @selected.delete_at(delete_idx)\n @size -= 1\n choice\n end",
"def remove_piece(arr)\n @board[arr[0]][arr[1]][:piece] = nil\n end",
"def use_selection_sort(arr)\r\n newArr = []\r\n for i in (0...arr.length)\r\n smallest = find_smallest(arr)\r\n puts(arr[smallest])\r\n newArr.push(arr.delete_at(smallest))\r\n end\r\n return newArr\r\nend",
"def nuclear_option!\n query(\"MATCH (n) DETACH DELETE n\")\n end",
"def unranked_candidates\n if @election\n @election.candidate_ids - @ranking.flatten\n else\n []\n end\n end",
"def no_indices(guess)\n @candidate_words.reject! { |word| word.include?(guess) }\n end",
"def remove_chosen_presenter\n self.chosen_presenter = nil\n self.save\n end",
"def eliminar_pri_elem_arr(arreglo)\n arreglo[0] = nil\n arreglo.delete(nil)\n arreglo\nend",
"def delete_at(p0) end",
"def preserve_best_sentences(data)\n puts \"For each word with multiple examples below, choose the best selection:\"\n\n total_words = data.count { |d| d[:sentences].size > 1 }\n curr_word = 0\n data.select { |d| d[:sentences].size > 1 }.map! do |d|\n curr_word += 1\n puts \"#{curr_word} of #{total_words}: #{d[:word]} (#{d[:pronounciation]})\"\n d[:sentences].each_with_index do |s, i|\n puts \"#{i + 1}.\\t#{s[0]}\"\n puts \"\\t#{s[1]}\"\n end\n n = get_selection_number(\"Best sentence: \", 1, d[:sentences].size)\n selection = d[:sentences][n - 1]\n d[:sentences] = [ [ selection[0], selection[1] ] ]\n d\n end\n\n puts \"\\nDone.\"\nend",
"def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end",
"def remove_from_recommendations!\n sets = [] # SREM needed\n zsets = [] # ZREM needed\n keys = [] # DEL needed\n\n # Remove from other users' similarity ZSETs\n zsets += Recommendations.redis.keys(Recommendations::Helpers::RedisKeyMapper.similarity_set_for('*'))\n\n # Remove this user's similarity ZSET\n keys << Recommendations::Helpers::RedisKeyMapper.similarity_set_for(id)\n\n # For each ratable class...\n Recommendations.config.ratable_classes.each do |klass|\n # Remove this user from any class member's liked_by\n sets += Recommendations.redis.keys(Recommendations::Helpers::RedisKeyMapper.liked_by_set_for(klass, '*'))\n\n # Remove this user's liked/recommended sets for the class\n keys << Recommendations::Helpers::RedisKeyMapper.liked_set_for(klass, id)\n keys << Recommendations::Helpers::RedisKeyMapper.recommended_set_for(klass, id)\n end\n\n Recommendations.redis.pipelined do |redis|\n sets.each { |set| redis.srem(set, id) }\n zsets.each { |zset| redis.zrem(zset, id) }\n redis.del(*keys)\n end\n end",
"def deduct_available_guesses\n @available_guesses -= 1\n end",
"def remove_smallest(numbers)\n return numbers if numbers.empty?\n\n numbers.delete_at(numbers.index(numbers.min))\n numbers\nend",
"def combine(distances)\n\t\tif distances.class == Fixnum\n\t\t\t# This should never be the case -- we should not be\n\t\t\t# searching using just one candidate, but instead we should\n\t\t\t# have many candidates\n\t\telsif distances.class == Array\n\t\t\t# An array of distances\n\t\t\t\n\t\t\tto_remove = []\n\t\t\t\n\t\t\t(0..@candidates.size-1).each do |i|\n\t\t\t\ted = distances[i]\n\t\t\t\t#Log.ed \"#{@candidates.candidates[i].solution} has an ed of #{ed} to #{@candidates.candidates[i].misspelled}\"\n\t\t\t\tif ed >= @config[\"edit_distance_prune_at\"]\n\t\t\t\t\t# Remove the candidate if its above the pruning level\n\t\t\t\t\t# Remove only after we drop out of our loop.\n\t\t\t\t\tto_remove << i\n\t\t\t\t\t#Log.ed \"Removing, ed is too high: #{ed}.\"\n\t\t\t\telse\n\t\t\t\t\t@candidates.candidates[i].votes = ed # Here, the edit distance value is votes\n\t\t\t\tend\t\t\t\t\n\t\t\tend # Loop\n\t\tend\n\t\t\n\t\t# Now that we're out of the loop, prune the candidates\n\t\tto_remove.each do |i|\n\t\t\t@candidates.remove(i)\n\t\tend\n\t\t\n\t\t@candidates\n\tend",
"def remove_from_list\n\n # XXX key to invoke this is difficult. make it easier\n selfiles = current_or_selected_files\n sz = selfiles.size\n print \"Remove #{sz} files from used list (y)?: \"\n key = get_char\n return if key != 'y'\n\n # arr = @selected_files.map { |path| File.expand_path(path) }\n # @log.debug \"BEFORE: Selected files are: #{@selected_files}\"\n arr = selfiles.map { |path|\n if path[0] != '/'\n expand_path(path)\n else\n path\n end\n }\n if File.directory? arr.first\n @used_dirs -= arr\n select_from_used_dirs\n else\n @visited_files -= arr\n select_from_visited_files\n end\n unselect_all\n @modified = true\n # redraw_required\nend",
"def delete_matched(matcher, options = nil)\n options = merged_options(options)\n instrument(:delete_matched, matcher.inspect) do\n failsafe(:read_multi, returning: false) do\n matcher = key_matcher(matcher, options)\n begin\n with do |store|\n !(keys = store.keys(matcher)).empty? && store.del(*keys)\n end\n end\n end\n end\n end",
"def remove_errant_matches_from(pot_ex_array)\n correct_match_arr = []\n pot_ex_array.each do |example|\n constituents = example.construct_constituents_array\n constituents.each do |const_array|\n if const_array[0] == self.word && const_array[1] == self.hiragana && const_array[3] == self.reading # For this to work, the constituents have to be normalized to dictionary_forms.\n correct_match_arr << example\n end\n end\n end\n return correct_match_arr\n end",
"def delete_max\n return -1 if @count == 0\n data = @array[0]\n @array[0] = @array.pop\n @count = @array.size\n percolate_down(0)\n data\n end",
"def remove_player p\n (@players ||= []).delete p.sym\n end",
"def borra_fuzzy_match\n return if Rails.env.development_mac?\n # Borra el nombre cientifico\n FUZZY_NOM_CIEN.delete(id)\n\n # Borra los nombre comunes\n 50.times do |i|\n id_referencia = nombre_comun_a_id_referencia(i+1)\n FUZZY_NOM_COM.delete(id_referencia)\n end\n end",
"def sort_flavor\n equal = 0\n print \"What flavor do you prefer? \\n> \"\n choice = gets.chomp.downcase\n unless @recommendation == [] # to avoid an empty array going through an each do loop\n # print \"inital equal is #{equal.to_s} \\n\"\n @recommendation.each do |entry|\n # print entry.name\n entry.flavor.each do |flavor|\n if flavor == choice\n equal = equal + 1\n # print \"equal added if equal #{equal.to_s} \\n\"\n end\n end\n # print \"final equal after testing is #{equal.to_s} \\n\"\n if equal == 0\n # print \"final equal is #{equal.to_s}, so delete from recommendations\\n\"\n @recommendation.delete(entry)\n end\n equal = 0 # forget this part\n # print \"equal value is now back to #{equal.to_s}\"\n end\n end\n end",
"def delete_useless!\n @eng_sentence = @eng_sentence - @useless_eng_words\n @rus_sentence = @rus_sentence - @useless_rus_words\n end",
"def update_candidates_from(impossible_candidates, backtrack_mode = false)\n prev_cand_count = @candidates.count\n\n if backtrack_mode\n @dirty = true\n if @once\n @backuped_candidates = @candidates\n @once = false\n end\n end\n\n @candidates = (Set.new(@candidates) - Set.new(impossible_candidates)).to_a\n\n\n\n @candidates.count != prev_cand_count\n end",
"def find_unseen\n unseen.replace(full_deck)\n (my_hand + op_hand + my_lands.values +\n op_lands.values + discards.values).flatten.each do |c|\n i = unseen.index(c) or next\n unseen.delete_at(i)\n end\n end",
"def remove_smallest(numbers)\n return numbers if numbers.empty?\n numbers.delete_at(numbers.index(numbers.min))\n numbers\nend",
"def remove(player, remove_references = false)\n if remove_references\n @players.each_value do |element|\n element.distances.reject! { |key| key == player.id }\n end\n end\n @players.delete(player.id)\n end",
"def delete!\n uniq.both_e.uniq.bulk_job { |e| e.delete! }\n uniq.bulk_job { |e| e.delete! }\n end",
"def remove(p)\n @first = counterclockwise(@first) if @first.equal?(p)\n @first = nil if @first.equal?(p)\n @neighbors.delete(p)\n end",
"def randRemove(array)\n array.delete array.sample\nend",
"def remove_smallest(numbers)\n return numbers if numbers.empty?\n numbers.clone.tap { |i| i.delete_at(numbers.index(numbers.min)) }\n end",
"def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n \n duplicate = source.dup\n\n i = 0\n while i < duplicate.length\n word = duplicate[i]\n if word.is_a?(Fixnum)\n i += 1\n next\n end\n if word.include?(thing_to_delete)\n source.delete(word)\n end\n i += 1\n end \n source\nend",
"def tile_removal(array_of_tiles)\n array_of_tiles.each do |letter|\n if @default_tiles.keys.include?(letter)\n @default_tiles[letter] -= 1\n end\n @default_tiles.delete_if {|key, value| value == 0 }\n end\n end",
"def one_week_wonders(songs)\n songs.each_with_index do |el, index|\n if el == songs[index + 1]\n songs.delete(el)\n end\n end\n songs.uniq\nend",
"def my_array_deletion_method(array, letter)\n array.delete_if { |data| data.to_s.match(letter.to_s)}\n return array\n end",
"def remove_smallest(array)\n smallest = array.min\n number = array.count(smallest)\n new_array = []\n i = 0\n for a in array\n if a != smallest\n new_array << a\n elsif a == smallest and number > 1 and i == 0\n i += 1\n elsif a == smallest and number > 1 and i > 0\n i += 1\n new_array << a\n elsif a == smallest and number == 1\n i += 1\n end\n end\n return new_array\nend",
"def prune_free_list\n i = 0\n while i < @free_rectangles.size\n j = i + 1\n while j < @free_rectangles.size\n if is_contained_in?(@free_rectangles[i], @free_rectangles[j])\n @free_rectangles.delete_at(i)\n i -= 1\n break\n end\n if is_contained_in?(@free_rectangles[j], @free_rectangles[i])\n @free_rectangles.delete_at(j)\n else\n j += 1\n end\n end\n i += 1\n end\n end",
"def cleanReservedList(reservedRooms)\n i = 0\n j = 0\n while i < reservedRooms.length()\n temp = reservedRooms[i]\n j = i + 1\n while j < reservedRooms.length()\n if temp == reservedRooms[j]\n reservedRooms.delete_at(j)\n j -=1\n end\n j +=1\n end\n i+=1\n end\nend",
"def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n #use two pointers and do slidding window technique\n pointer_a = 0\n pointer_b = 1\n while(pointer_b < a.size)\n if a[pointer_a] == a[pointer_b]\n a.delete(a[pointer_a])\n else\n pointer_a += 1\n pointer_b += 1\n end\n end\n return a[0]\nend",
"def remove_reciprocal_object(opts, o)\n return unless reciprocal = opts.reciprocal\n if opts.reciprocal_array?\n if array = o.associations[reciprocal]\n array.delete_if{|x| self === x}\n end\n else\n o.associations[reciprocal] = nil\n end\n end",
"def delete\n @array_roses.pop\nend",
"def remove_card\n self.cards.delete_at(0)\n end",
"def find_candidate_for_guessing\n unassigned_cells.sort_by { |cell|\n [cell.available_values.size, to_s]\n }.first\n end",
"def remove_duplicates(movies)\n # Iterate through the list and remove any duplicates -- they should be right next to each other\n i = 0\n while i < (movies.length - 1)\n if compare_movies(movies[i], movies[i+1]) == 0\n movies.delete_at i\n else\n i += 1\n end\n end\n\n # Lastly, return the subset of movies\n movies\nend"
] | [
"0.6545749",
"0.60591125",
"0.5935808",
"0.59275573",
"0.5898502",
"0.58506805",
"0.5818517",
"0.5804726",
"0.57909524",
"0.5759192",
"0.5740732",
"0.56597257",
"0.56142044",
"0.5611859",
"0.55642396",
"0.55610824",
"0.55266535",
"0.55067164",
"0.5456877",
"0.5454079",
"0.5441197",
"0.54292876",
"0.54206586",
"0.54204416",
"0.53340364",
"0.53251255",
"0.53245175",
"0.52913576",
"0.5285668",
"0.52457494",
"0.5223203",
"0.5221753",
"0.5210473",
"0.52069634",
"0.5196529",
"0.5190984",
"0.5177954",
"0.5172202",
"0.51533824",
"0.5152496",
"0.514874",
"0.5142072",
"0.5129198",
"0.5120546",
"0.5115022",
"0.5112171",
"0.5110433",
"0.5106861",
"0.50953794",
"0.5076233",
"0.50706846",
"0.50648606",
"0.5062857",
"0.5059958",
"0.5054981",
"0.5050281",
"0.5043229",
"0.5037553",
"0.50334376",
"0.50288564",
"0.5028099",
"0.50271946",
"0.50246704",
"0.50215596",
"0.5013029",
"0.5008175",
"0.5001331",
"0.4992018",
"0.49910042",
"0.49872574",
"0.49870837",
"0.49792776",
"0.4978282",
"0.49767458",
"0.4974952",
"0.49748182",
"0.49733984",
"0.4971158",
"0.496787",
"0.49652302",
"0.49608827",
"0.4957415",
"0.49480054",
"0.4945416",
"0.49438143",
"0.493626",
"0.49291667",
"0.49219912",
"0.4917382",
"0.4916433",
"0.49159423",
"0.49154952",
"0.491512",
"0.49100026",
"0.49090424",
"0.49039894",
"0.4901889",
"0.489553",
"0.48941636",
"0.488959"
] | 0.772396 | 0 |
Are there no remaining positions available for matches? | def full?
!free?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def free?\n matches.length < match_positions\n end",
"def all_positions_full?\n available_positions.empty?\n end",
"def hit_itself?\n # list.uniq removes all repeated elements from a list\n @positions.uniq.length != @positions.length\n end",
"def finished?\n #positions = {:a => 25, :b => 30}\n @position.each do |pl, pos|\n if pos >= @length\n return true\n else\n return false\n end\n end\n end",
"def full?(board) #check if the board is full\n board.each_with_index do |position, index|\n if position_taken?(board, index) == false \n return false\n end\n end\n return true\nend",
"def near_match\n (0..3).each do |guess_index|\n compare_for_near_match(guess_index)\n end\n end",
"def no_match() \n if $match_index_arr == []\n $turns = $turns - 1\n $index = $index + 1\n end\n end",
"def has_match?\n !match_x.nil? && !match_y.nil?\n end",
"def position_available(marker_pos, player1_obj, player2_obj)\n # test - marker_pos - index has a limit of 1 to 9\n return false if marker_pos.negative? || (marker_pos > 8)\n\n # test - new move - does not overlap any previous moves done.\n return true if (player1_obj.moves_arr[marker_pos].zero? && player2_obj.moves_arr[marker_pos].zero?) == true\n\n false\nend",
"def contain?(position); end",
"def empty_positions?\n @grid.flatten.any? {|pos| pos == \"_\"}\n end",
"def exact_matches(loc=@counter)\n matches = 0\n 4.times{ |x| matches += 1 if @guessgrid[loc][x] == @code[x] }\n matches\n end",
"def sunk?\n @spaces.each { |position| return true unless position.occupied }\n end",
"def crash?\n @position.length != @position.uniq.length\n end",
"def possible_positions?(already_passed = [])\n possible_positions = []\n Knight::VALID_MOVES.each do |move|\n possible_position = already_passed.last.change(move)\n if possible_position.valid? and\n not already_passed.include?(possible_position) and\n not @forbidden_positions.include?(possible_position)\n possible_positions << possible_position\n end\n end\n possible_positions\n end",
"def positions_not_to_check\n @positions_not_to_check ||= begin\n positions = []\n positions.concat(do_not_check_block_arg_pipes)\n positions.concat(do_not_check_param_default)\n positions.concat(do_not_check_class_lshift_self)\n positions.concat(do_not_check_def_things)\n positions.concat(do_not_check_singleton_operator_defs)\n positions\n end\n end",
"def position_taken?\nend",
"def matches?(sequence)\n (0..(sequence.size-length)).each do |pos|\n return pos if matches_at?(pos, sequence)\n end\n return false\n end",
"def get_empty_posns \n empty_posns = []\n\n @board.rows.each_with_index do |row, idx1| \n row.each_with_index do |block, idx2| \n if @board.empty?([idx1, idx2])\n empty_posns << [idx1, idx2]\n end\n end\n end\n\n empty_posns\n end",
"def empty?( *positions )\n positions.all? { | position | get_space( position ).token =~ /_/ }\n end",
"def full?(board)\n\n full_board = [0,1,2,3,4,5,6,7,8].all? {|index| position_taken?(board, index)}\n return full_board\n\nend",
"def num_near_matches(guess_object)\n pegs = guess_object.pegs\n count = 0\n pegs.each_with_index do |char, i|\n count += 1 if @pegs.include?(char) && char != @pegs[i]\n end\n count\n end",
"def self_placements_only?\n count = 0\n placements.filled.each{|p| count += 1 if p.position.self_placement? }\n count == placements.filled.size\n end",
"def position_available\n @board[@position].strip.empty?\n end",
"def finished?\n player_positions.any? { |player, position| position >= length}\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def matches\n m = (1..9).map { |i| ss[i] }\n m.pop until m[-1] or m.empty?\n m\n end",
"def num_near_matches(guess)\n counter = 0\n guess.pegs.each { |peg| counter += 1 if @pegs.include?(peg) }\n counter - num_exact_matches(guess)\n end",
"def covering_moves?(board)\n (board.word_positions).any? do |word_posns|\n positions >= word_posns\n end\n end",
"def get_available_positions\n @state.each.with_index(1).select { |mark, index| mark.nil? }.map { |mark, index| index }\n end",
"def near_matches(player_code)\n imperfect_indices = find_imperfect_indices(player_code)\n\n checked = []\n near_matches = 0\n\n imperfect_indices.each do |i|\n imperfect_indices.each do |j|\n unchecked = checked.none? { |digit| self[i] == digit }\n is_match = self[i] == player_code[j]\n\n if i != j && unchecked && is_match\n checked << self[i]\n near_matches += 1\n break\n end\n end\n end\n\n near_matches\n end",
"def check_positions(positions)\n positions.each do |position|\n unless check_position(position)\n return false\n end\n end\n true\n end",
"def not_in_position(party)\n for battler in party\n next unless battler.exist?\n return true if battler.actual_x != battler.base_x\n return true if battler.actual_y != battler.base_y\n end\n return false\n end",
"def num_moves(start_pos, end_pos)\n return 1 if valid_move?(start_pos, end_pos)\n \n moves_from_end = valid_moves(end_pos)\n return 2 if valid_moves(start_pos).any? { |pos| moves_from_end.include?(pos) }\n return nil\nend",
"def matches_lost(user)\n matches = user.home_matches.find_all_by_ended(true) + user.away_matches.find_all_by_ended(true)\n matches.count - (matches_won(user) + matches_drawn(user))\n end",
"def matched_positions\n _response_entity.fetch(\"matchingTokens\", [])\n end",
"def free_positions\n\t\tboard.select {|position, value| value == 0}.keys\n\tend",
"def move_is_disconnected_from_existing_words?\n return false if board.empty?\n\n new_tile_positions.each do |new_tile_position|\n new_tile_row = new_tile_position[0]\n new_tile_col = new_tile_position[1]\n\n existing_tile_positions.each do |existing_tile_position|\n existing_tile_row = existing_tile_position[0]\n existing_tile_col = existing_tile_position[1]\n\n return false if (new_tile_row == existing_tile_row) && (\n new_tile_col == existing_tile_col - 1 ||\n new_tile_col == existing_tile_col + 1\n )\n\n return false if (new_tile_col == existing_tile_col) && (\n new_tile_row == existing_tile_row + 1 ||\n new_tile_row == existing_tile_row - 1\n )\n end\n end\n\n true\n end",
"def terminal?\n matches.length == 0\n end",
"def full?(board)\n # indices = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n # if indices.all? {|position| position_taken?(board, position, \"X\") || position_taken?(board, position, \"O\")}\n # return true\n # elsif board.include?(\" \")\n # return false\n if board.include?(\" \" || \"\" || nil)\n return false\n else\n return true\n end\nend",
"def find_empty_position(filled_positions, desired_play_symbol)\n actionable_cells = @board.representation.select {|k,_| filled_positions.include?(k)}\n\n if actionable_cells.values.select {|p| p == desired_play_symbol}.size == 2 &&\n actionable_cells.values.select {|p| p == nil}.size == 1\n # This only works because we already know there is only one element in the hash having a nil value.\n # Invert on a hash 'eats' non-unique values. Could use some refactoring.\n return actionable_cells.invert[nil]\n end\n\n nil\n end",
"def find_empty_positions\n empty_positions = Set.new\n (0..@board.size-1).each {|i|\n (0..@board[i].count-1).each {|j|\n if @board[i][j] == '[ ]'\n empty_positions.add([i, j])\n end\n }\n }\n empty_positions\n end",
"def multiple_pieces?\n 1 < all_coords.count { |coord| self[coord] != :empty }\n end",
"def over?\n self.assignments.remaining.count == 0 && !sets_available?\n end",
"def get_empty_locs\n empty = []\n @board.each { |index, spot| empty.push(index) if spot.nil? }\n return empty\n end",
"def try_to_mark_sunk\n matches = {}\n @sunk.each do |sz|\n @known.each do |x,y,v|\n next unless v == :hit\n matches[sz] ||= []\n would_ship_fit_in_location?(x, y, :across, sz, 0).eql?(sz) and\n matches[sz].push([x, y, :across])\n would_ship_fit_in_location?(x, y, :down, sz, 0).eql?(sz) and\n matches[sz].push([x, y, :down])\n end\n end\n\n matches.each do |sz, q|\n if q.size == @sunk.select { |s| s == sz }.size\n q.each do |entry|\n mark_sunk(sz, *entry)\n end\n @sunk -= [sz]\n end\n end\n end",
"def all_neighbords(base_word)\n \n matches = four_letter_words.select do |match_word|\n are_neighbors?(base_word, match_word)\n end \n\n return matches\n \nend",
"def valid_moves\n moves.reject { |end_pos| move_into_check?(end_pos) }\n end",
"def full\n @moves.length >= 12\n end",
"def position_taken?(index)\n\t\t!@board[index].include?(\" \")\n\tend",
"def is_not_hit?(start_time:)\n (@layer + start_time) % @index_values.count != 0\n end",
"def near_matches(guess)\n near_matches = 0\n COLORS.values.each do |color|\n near_matches += [pegs.count { |x| x == color }, \n guess.pegs.count { |x| x == color }].min\n end\n \n near_matches - exact_matches(guess)\n end",
"def semi_match(guess)\n\t\t\t# removes exact matches from guess \n\t\t\tunmatched = @indices.map {|i| guess[i]}\n\t\t\t# looks at available indices in @code and removes first instance\n\t\t\t# of a number in unmatched for each match made\n\t\t\t@indices.each {\n\t\t\t\t|i| unmatched.slice!(unmatched.index(@code[i])) if unmatched.include?(@code[i]) \n\t\t\t}\n\t\t\t# returns number of correct numbers in the incorrect place\n\t\t\t@indices.length - unmatched.length\n\t\tend",
"def valid_moves(temp_board)\n moves.select do |end_pos|\n temp_board.valid_pos?(end_pos) && temp_board.empty?(end_pos)\n end\n end",
"def candidates_included_in_all_the_others(candidates_in_correct_position)\n\tcandidates_in_correct_position.each do |small|\n\t\tok = true\n\t\tcandidates_in_correct_position.each do |big|\n\t\t\tif small!=big\n\t\t\t\tunless big.source.position.include?(small.source.position)\n\t\t\t\t\tok = false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn small if ok\n\tend\n\tnil\nend",
"def valid_moves(from)\r\n\tpossible_moves(from).select { |move| valid_position?(move) }\r\nend",
"def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end",
"def position_taken?(board, location)\n return board[location] != \" \" && board[location] != \"\"\nend",
"def scan\n x = position[0]\n y = position[1]\n !Robot.in_position(x, y).empty? || !Robot.in_position(x+1, y).empty? || !Robot.in_position(x-1,y).empty? || !Robot.in_position(x,y+1).empty? || !Robot.in_position(x,y-1).empty?\n end",
"def are_neighbors?(word1,word2)\n counter = 0\n 4.times do |index|\n if word1|index| == word2|index|\n counter+=0\n end \n end \n return counter == 3\nend",
"def aggressive\n\t# make a matches array. this returns the equivalent of the matches[] block above\n\tm=[]\n\n\n\t# return the matches array, even if it's emtpy\n\tm\nend",
"def empty_slot\n @positions.index {|i| i.nil?} || @positions.size\n end",
"def solved?\n first_empty_index.nil? && legal?\n end",
"def positionAvailable?(board,m,n)\n\t\tif board.getPosition(m,n) == \"-\"\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def absnt?\n Parslet::Atoms::Lookahead.new(self, false)\n end",
"def check_for_tie\n filled_spots = []\n i = 1\n board.each do |spot|\n if spot == i\n i += 1\n else\n filled_spots.push(i)\n i += 1\n end\n next\n end\n filled_spots.length == 9\n end",
"def position_taken?(board, desired_position)\n if [\" \", \"\", nil].include?board[desired_position]\n return false\n end\n if [\"X\", \"O\"].include?board[desired_position]\n return true\n end\nend",
"def look_for_win\n Game::LINES.each do |winning_line|\n markers = group_positions_by_marker(winning_line)\n if markers[marker].length == 2 and markers.keys.include?(nil)\n puts markers.keys\n choice = markers[nil].first\n return choice\n end\n end\n false\n end",
"def matches_at?(position, sequence)\n length.times do |t|\n sub_pos = position+t\n return false if sequence[sub_pos].cat != @right_symbols[t]\n end\n return true\n end",
"def missing_one_in_middle\n regex1 = /[1-6]x[1-6][1-6]/ # example: \" x23x5x\"\n regex2 = /[1-6][1-6]x[1-6]/ # example: \" x2x45x\"\n return ( @distribution.match(regex1) || @distribution.match(regex2) )\n=begin\n [1,2,3].each { |i| \n return true if @counts[i]>0 && @counts[i+1]==0 && counts[i+2]>0 && counts[i+3]>0\n return true if @counts[i]>0 && @counts[i+1]>0 && counts[i+2]==0 && counts[i+3]>0\n }\n return false\n=end\n end",
"def position_taken?(board, index)\n !(board.any?{ |e| e.nil?} || board.any?{ |e| e.eql? \"\"} || board[index] == \" \")\nend",
"def shots_missed\n self.positions.where(water: true, shooted: true).count\n end",
"def taken?(location)\n position(location) != \" \"\n end",
"def tourney_done?(matches)\n output = true\n matches.each do |match|\n output = false if !(match['match']['state'].eql?(\"complete\"))\n end\n return output\nend",
"def valid?(position)\n row, col = position\n position.all? {|i| i >= 0 && i< @grid.length}\n \n end",
"def checkmated?(sente) # sente is loosing\n ou = look_for_ou(sente)\n x = 1\n while (x <= 9)\n y = 1\n while (y <= 9)\n if (@array[x][y] &&\n (@array[x][y].sente != sente))\n if (@array[x][y].movable_grids.include?([ou.x, ou.y]))\n return true\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return false\n end",
"def finished?\n if @player_positions.include?(@length)\n return true\n else\n return false\n end\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def should_remain_alive?(x,y)\n alive?(x,y) && (2..3).include?(neighbours(x,y))\n end",
"def full_house?\n matched = self.matched_cards\n found_pair = false\n found_three = false\n for rank, matches in matched do\n found_pair = true if matches.count == 2\n found_three = true if matches.count == 3\n end\n return found_pair && found_three \n end",
"def get_empty_location()\n for i in 10..20\n if self.players.where(:location => i).length == 0\n return i\n end\n end\n end",
"def not_in_place?\r\n @position.nil?\r\n end",
"def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end",
"def position_taken?(board, position)\n if board[position.to_i-1] == \" \" || board[position.to_i-1] == \"\" || board[position.to_i-1] == nil # if the position is empty like so \" \" or like so \"\", or if the position has a value of nil, it has not been taken\n false\n else # otherwise, it is unavailable\n true\n end\nend",
"def neighbors?(start,word)\n\t\treturn false if start.size != word.size\n\t\tcount = 0\n\t\tlength = start.size\n\t\tlength.times do |index|\n\t\t\tif start[index..index] != word[index..index]\n\t\t\t\tcount += 1\n\t\t\tend\n\t\tend\n\t\treturn (count == 1)\n\tend",
"def valid_moves(from)\n\tpossible_moves(from).select { |move| valid_position?(move) }\nend",
"def move_available?\n total_available_moves > 0\n end",
"def position_taken? (board_array, index)\n is_free = board_array[index] == \" \" || board_array[index] == \"\" || board_array[index] == nil\n !is_free\nend",
"def all_cells_cleared?\n cell_count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n cell_count += 1\n end\n end\n end\n\n (row_count * column_count) == cell_count\n end",
"def gaps_covered_by?(board)\n row_range.all? do |row|\n col_range.all? do |col|\n @positions.include?([row, col]) || board.nonempty_space?(row, col)\n end\n end\n end",
"def has_coordinate(position)\n position.all? { |coordinate| coordinate >= 0 && coordinate < @size }\n end",
"def position_taken?(board,index)\n if board[index] == nil\n false\n elsif board[index].strip.empty?\n false\n else\n true\n end\nend",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def near_matches(other_code)\n num_matches = 0\n matches = []\n i = 0\n while (i < self.pegs.length)\n j = 0\n while (j < other_code.pegs.length)\n if(self[i] == other_code[j])\n if(i != j)\n unless (matches.include?(self[i]))\n num_matches += 1\n matches << self[i]\n end\n else\n if(matches.include?(self[i]))\n num_matches -= 1\n end\n end\n end\n j += 1\n end\n i += 1\n end\n num_matches\n end",
"def lost_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.is_looser?(self) and match.finished?\n count += 1\n end\n end\n\n count\n end"
] | [
"0.72957855",
"0.71186346",
"0.69953686",
"0.6336867",
"0.63244295",
"0.6281883",
"0.62613785",
"0.6230664",
"0.62231404",
"0.6207515",
"0.61934894",
"0.61807793",
"0.61236614",
"0.61038893",
"0.6059299",
"0.604182",
"0.60335237",
"0.60127807",
"0.6002813",
"0.5997226",
"0.5970411",
"0.59436035",
"0.59302235",
"0.59130806",
"0.5904438",
"0.5879531",
"0.5879531",
"0.5879531",
"0.5879531",
"0.5879531",
"0.5879531",
"0.5876893",
"0.58715355",
"0.5862636",
"0.5851811",
"0.58471835",
"0.58418393",
"0.5837103",
"0.58244807",
"0.58206177",
"0.58172005",
"0.5803435",
"0.5789018",
"0.5762419",
"0.5758931",
"0.57521725",
"0.5735071",
"0.5721185",
"0.5712749",
"0.5701729",
"0.5695717",
"0.5691734",
"0.56913376",
"0.5688941",
"0.56803215",
"0.5671019",
"0.565587",
"0.56556076",
"0.56482244",
"0.5645444",
"0.56401867",
"0.5640064",
"0.5639573",
"0.56311387",
"0.5626629",
"0.5625858",
"0.56216663",
"0.56210154",
"0.5620676",
"0.56202",
"0.5617756",
"0.5601344",
"0.5601263",
"0.55946183",
"0.559406",
"0.559026",
"0.55829185",
"0.5570455",
"0.55685514",
"0.5563952",
"0.55635726",
"0.5561646",
"0.5561646",
"0.55568445",
"0.5553864",
"0.55517566",
"0.5547849",
"0.5546941",
"0.55469316",
"0.5543588",
"0.5540979",
"0.5540085",
"0.5538822",
"0.5537578",
"0.5528021",
"0.5528",
"0.552769",
"0.55267936",
"0.55237734",
"0.55236995",
"0.5522294"
] | 0.0 | -1 |
Match with another Candidate ARG: `other` another Candidate instance to match with | def match!( other )
return false unless prefers?( other ) && !matched?( other )
matches << other
other.matches << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than any other match?\n when better_match?( other )\n free!\n match! other\n\n else\n false\n end\n end",
"def match(other)\n return @type.match(other)\n end",
"def match(other)\n solve == other.solve\n end",
"def my_match_with(other_user)\n self.matches.select {|a| a if a.users.include?(other_user)}.first\n end",
"def match(other)\n String.new(self).match other\n end",
"def match(other)\n raise ArgumentError.new(other) unless other.kind_of?(Expr)\n Sentence.new(self, other).decide\n end",
"def matched?( other = nil )\n return full? if other.nil?\n matches.include? other\n end",
"def ==(other)\n @candidate == other.candidate\n end",
"def match(candidates)\n\t\tself.downcase(candidates)\n\t\t@ed.match(candidates)\n\tend",
"def match(other, settings=nil)\n no_match_required = settings.nil? || settings.no_match_required?\n potential_match_attributes = {:offer_signup => other, :request_signup => self, :collection => self.collection}\n prompt_matches = []\n unless no_match_required\n self.requests.each do |request|\n other.offers.each do |offer|\n if (match = request.match(offer, settings))\n prompt_matches << match\n end\n end\n end\n return nil if settings.num_required_prompts == ALL && prompt_matches.size != self.requests.size\n end\n if no_match_required || prompt_matches.size >= settings.num_required_prompts\n # we have a match\n potential_match_attributes[:num_prompts_matched] = prompt_matches.size\n potential_match = PotentialMatch.new(potential_match_attributes)\n potential_match.potential_prompt_matches = prompt_matches unless prompt_matches.empty?\n potential_match\n else\n nil\n end\n end",
"def ==(other)\n case other\n when Match\n cf0925 == other.cf0925 && cf0925_type == other.cf0925_type\n else\n super\n end\n end",
"def *(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n \r\n if first.ok?\r\n matched += first.matched\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched += second.matched\r\n ParserResult.ok(second.output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def matches(other)\n other.kind_of?(QueryField) && other.name == @name && other.operation == @operation && other.boost == @boost \n end",
"def minimal_match?(other)\n super and tolerant_match?(other, TOLERANT_MATCH_ATTRS)\n end",
"def better_match?( other )\n return true if prefers?( other ) && free?\n preference_index = preferences.index other\n match_preference_indexes = matches.map { | match | preferences.index match }\n preference_index and match_preference_indexes.any? { |i| i > preference_index }\n end",
"def refute_match(matcher, obj, msg = T.unsafe(nil)); end",
"def /(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n if first.ok?\r\n matched = matched + first.matched\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n ParserResult.ok(first.output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def match\n extract!\n policy_failure_match! || self\n end",
"def match(object); end",
"def match(left, right)\n IdentityParade::Match.new(left, right).score\n end",
"def match\n self.class.match.with_instance(self)\n end",
"def assert_match(value, other)\n flunk(\"#{value.inspect} =~ #{other.inspect}\") unless other =~ Regexp.new(value)\n success\n end",
"def accepts?(other)\n true\n end",
"def evaluate(control, candidate)\n control == candidate ? :match : :mismatch\n end",
"def match_with(matchable)\r\n @partner = matchable\r\n matchable.partner = self\r\n end",
"def match; end",
"def match; end",
"def &(other)\n pp = PositionalParams.merge_for_intersection(positional_params, other.positional_params) rescue return\n kp = keyword_params & other.keyword_params or return\n Params.new(positional_params: pp, keyword_params: kp)\n end",
"def similarity_to other, threshold = nil\n Babushka::Levenshtein.distance self, other, threshold\n end",
"def assert_valid_other(other)\n unless other.repository == repository\n raise ArgumentError, \"+other+ #{self.class} must be for the #{repository.name} repository, not #{other.repository.name}\"\n end\n\n unless other.model == model\n raise ArgumentError, \"+other+ #{self.class} must be for the #{model.name} model, not #{other.model.name}\"\n end\n end",
"def =~(other)\n (other = other.to_wires_event if other.respond_to? :to_wires_event) ? \n (([:*, other.type].include? self.type) and \n (not self.kwargs.each_pair.detect{|k,v| other.kwargs[k]!=v}) and\n (not self.args.each_with_index.detect{|a,i| other.args[i]!=a})) :\n super\n end",
"def matches?(value, context); end",
"def match\n @argument_matchers[0...-1].each_with_index do |argument_matcher, index|\n @argument_matchers[index + 1].successor = argument_matcher\n end\n\n chain_matcher = @argument_matchers.last\n chain_matcher.check_to_assing_and_match(@data)\n end",
"def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end",
"def matched?(other_user)\n matched.include?(other_user)\n end",
"def match(input); end",
"def similar?(other)\n other && other.to == @to && other.from == @from && other.label == @label\n end",
"def action_comparer other_text=\"\", params={}\n\t\tac = ActionComparer.new params\n\t\tac.similar? self, other_text\n\tend",
"def case_insensitive_match=(_arg0); end",
"def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end",
"def propose! other\n if other.single?\n #first engagement for other\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n current_pref = other.pref_list.preference_of(other.engaged_to)\n my_pref = other.pref_list.preference_of(self)\n #the lower the index, the more preferred\n if my_pref < current_pref\n #found better matching\n other.jilt!\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n #reject this engagement\n return false\n end\n end\n end",
"def match(p0) end",
"def match(p0) end",
"def matchingCandidates(token)\n candidates(@currentNode, token)\n end",
"def do_match(input)\n @matched = input.match(@on)\n end",
"def visit_other_type\n value = compiler.compile_as_atom(node)\n compile_value_match(value)\n end",
"def best_match_from(other)\n other.max_by do |their_type|\n best_type = self.by_precedence.find do |our_type|\n their_type =~ our_type\n end\n if best_type.nil?\n 0\n else\n best_type.quality * their_type.quality\n end\n end\n end",
"def or(other)\n other\n end",
"def update(other)\n self.class.new(\n must: must + other.must,\n should: should + other.should,\n must_not: must_not + other.must_not,\n minimum_should_match: other.minimum_should_match\n )\n end",
"def wont_be_equivalent_to(criterion, msg=nil)\n EqualityAssay.refute!(self, criterion, :message=>msg, :backtrace=>caller)\n end",
"def equals(one, two)\n matched_by(one, two)\n matched_by(two, one)\n end",
"def match(other, anchor, fuzz=Pixel(0))\n each { |p| return false if !other[anchor + p].approx(self[p], fuzz)}\n true\n end",
"def =~(other)\n other = coerce(other)\n (other &&\n (name == other.name) &&\n (version.to_s == other.version.to_s) &&\n (platform_string == other.platform_string))\n end",
"def update!(**args)\n @exact_match = args[:exact_match] if args.key?(:exact_match)\n end",
"def match(target, source, opts = {})\n params = parameters(opts)\n\n if params[source]\n equal(target, source, opts)\n elsif params[\"#{source}~=\"]\n output[target] = transform(params[\"#{source}~=\"], opts)\n end\n\n output\n end",
"def super_match(*args)\n return unless match = match(args.first) \n returning match do |m|\n args[1..-1].each_with_index { |name, index| m.meta_def(name) { self[index+1] } }\n end\n end",
"def matcher=(_arg0); end",
"def override_condition_matching?(_subject, _name, _value)\n true\n end",
"def eql? other\n object_id == other.object_id || \n (self.class == other.class &&\n specification == other.specification && \n candidate_types == other.candidate_types && \n candidate_types_excluded == other.candidate_types_excluded && \n candidate_objects == other.candidate_objects && \n join_points_matched == other.join_points_matched &&\n join_points_not_matched == other.join_points_not_matched)\n end",
"def |(other)\n RLSM::RegExp.new \"#@string|#{other.string}\"\n end",
"def match=(_); end",
"def matches?(other)\n operable_values == other.operable_values\n end",
"def compare_to_approach(*args)\n\n end",
"def match\n @match\n end",
"def match_characteristics(other)\n chr = characteristics\n ochr = other.characteristics\n chr and ochr and chr.tissue_side == ochr.tissue_side and chr.tissue_site == ochr.tissue_site\n end",
"def accept?(fuzz_match)\n\t\t\t\ttrue\n\t\t\tend",
"def chosen(already, owner, other)\n\t\tif already && already.owner_id == owner.id && current_user\n\t\t\t\"chosen\"\n\t\telse\n\t\t\tother\n\t\tend\n\tend",
"def match\n ->(r, i) { i.match(r) }.curry\n end",
"def match_node(node, *args)\n match_nodes([node], *args)\n end",
"def post_match() end",
"def match()\n end",
"def match(input)\n input \n end",
"def post_match\n m = @match\n m.post_match if (not m.equal?(nil))\n end",
"def >=(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n if first.ok?\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n ParserResult.ok(first.output, matched: first.matched, remaining: second.remaining)\r\n else\r\n first\r\n end\r\n else\r\n ParserResult.fail(input)\r\n end\r\n end\r\n end",
"def default_match_criteria\n match_criteria = Proc.new do |dict_entry, tag_entry|\n same_headword = (dict_entry.headword_trad == tag_entry.headword_trad) || (dict_entry.headword_simp == tag_entry.headword_simp)\n if same_headword\n # Now process the pinyin and see if we match\n tag_pinyin = tag_entry.pinyin.gsub(\" \",\"\")\n dict_pinyin = dict_entry.pinyin.gsub(\" \",\"\")\n if dict_entry.meaning_txt.downcase.index(\"surname\")\n same_pinyin = (dict_pinyin == tag_pinyin)\n else\n same_pinyin = (dict_pinyin.downcase == tag_pinyin.downcase)\n end\n \n # If we didn't match right away, also check for the funny tone changes \n if (same_pinyin == false and (tag_pinyin.index(\"yi2\") or tag_pinyin.index(\"bu2\")))\n same_pinyin = (dict_pinyin.downcase == tag_pinyin.downcase.gsub(\"yi2\",\"yi1\").gsub(\"bu2\",\"bu4\"))\n end\n \n # The return keyword will F everything up!\n (same_headword and same_pinyin)\n else\n false\n end\n end\n return match_criteria\n end",
"def refute_equivalent(criterion, act, msg=nil)\n EqualityAssay.refute!(act, criterion, :message=>msg, :backtrace=>caller)\n end",
"def eql?(other) self.class == other.class and target==other.target and source==other.source; end",
"def eql?(other) self.class == other.class and target==other.target and source==other.source; end",
"def match?(other)\n name == other.name if other.is_a? Atomic\n end",
"def similar_for_mission(other_mission)\n self.class.where(canonical_name: canonical_name, mission_id: other_mission.try(:id)).first\n end",
"def &(other)\n a = first_param\n b = other.first_param\n\n case\n when a.is_a?(RequiredPositional) && b.is_a?(RequiredPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(OptionalPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(RestPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.nil?\n nil\n when a.is_a?(OptionalPositional) && b.is_a?(RequiredPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(OptionalPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(RestPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.nil?\n self.drop_first & other\n when a.is_a?(RestPositional) && b.is_a?(RequiredPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self & other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(OptionalPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self & other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(RestPositional)\n AST::Types::Intersection.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first & other.drop_first)&.with_first_param(RestPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.nil?\n self.drop_first & other\n when a.nil? && b.is_a?(RequiredPositional)\n nil\n when a.nil? && b.is_a?(OptionalPositional)\n self & other.drop_first\n when a.nil? && b.is_a?(RestPositional)\n self & other.drop_first\n when a.nil? && b.nil?\n optional_keywords = {}\n\n (Set.new(self.optional_keywords.keys) & Set.new(other.optional_keywords.keys)).each do |keyword|\n optional_keywords[keyword] = AST::Types::Intersection.build(\n types: [\n self.optional_keywords[keyword],\n other.optional_keywords[keyword]\n ]\n )\n end\n\n required_keywords = {}\n self.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword)\n case\n when other.required_keywords.key?(keyword)\n required_keywords[keyword] = AST::Types::Intersection.build(types: [t, other.required_keywords[keyword]])\n when other.rest_keywords\n optional_keywords[keyword] = AST::Types::Intersection.build(types: [t, other.rest_keywords])\n end\n end\n end\n other.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword)\n case\n when self.required_keywords.key?(keyword)\n required_keywords[keyword] = AST::Types::Intersection.build(types: [t, self.required_keywords[keyword]])\n when self.rest_keywords\n optional_keywords[keyword] = AST::Types::Intersection.build(types: [t, self.rest_keywords])\n end\n end\n end\n self.required_keywords.each do |keyword, t|\n unless required_keywords.key?(keyword)\n case\n when other.required_keywords.key?(keyword)\n required_keywords[keyword] = AST::Types::Intersection.build(types: [t, other.required_keywords[keyword]])\n when other.rest_keywords\n required_keywords[keyword] = AST::Types::Intersection.build(types: [t, other.rest_keywords])\n else\n return\n end\n end\n end\n other.required_keywords.each do |keyword, t|\n unless required_keywords.key?(keyword)\n case\n when self.required_keywords.key?(keyword)\n required_keywords[keyword] = AST::Types::Intersection.build(types: [t, self.required_keywords[keyword]])\n when self.rest_keywords\n required_keywords[keyword] = AST::Types::Intersection.build(types: [t, self.rest_keywords])\n else\n return\n end\n end\n end\n\n rest = case\n when self.rest_keywords && other.rest_keywords\n AST::Types::Intersection.build(types: [self.rest_keywords, other.rest_keywords])\n else\n nil\n end\n\n Params.new(\n required: [],\n optional: [],\n rest: nil,\n required_keywords: required_keywords,\n optional_keywords: optional_keywords,\n rest_keywords: rest)\n end\n end",
"def is_correct?\n self.match.final_result == selected_result\n end",
"def submatcher; end",
"def submatcher; end",
"def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end",
"def receive_match(pos_1, pos_2)\n @matched_cards[pos_1] = true\n @matched_cards[pos_2] = true\n end",
"def similarity(other, *args)\n signature.similarity(other.signature, *args)\n end",
"def similar_to?(other)\n self.composition == other.composition\n end",
"def <(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\"\r\n output = []\r\n remaining = input\r\n\r\n if first.ok?\r\n matched = first.matched\r\n output += first.output\r\n remaining = first.remaining\r\n end\r\n\r\n second = other.run(remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n output = [*output, second.output]\r\n ParserResult.ok(output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n end\r\n end",
"def match\n true\n end",
"def respond_to_partnership_request_from(matchable)\r\n if unmatched?\r\n Marry::Me.logger.debug \"#{self} accepts partnership with #{matchable}\"\r\n match_with(matchable)\r\n elsif better_partner? matchable\r\n Marry::Me.logger.debug \"#{self} has left #{@partner} for #{matchable}\"\r\n @partner.free\r\n match_with matchable\r\n else\r\n Marry::Me.logger.debug \"#{self} rejects partnership with #{matchable}\"\r\n end\r\n end",
"def refute_match(exp, act, msg=nil)\n MatchFailure.refute(act, exp, :message=>msg, :backtrace=>caller)\n end",
"def or other_result\n result = dup\n result.matched = hash_union(matched, other_result.matched)\n result.not_matched = hash_union(not_matched, other_result.not_matched)\n result\n end",
"def receive_match(pos_one, pos_two)\n @matches.push(pos_one, pos_two)\n @known_cards.delete_if { |k,v| v.include?(pos_one) || v.include?(pos_two) } #it is deleting that k/v from known_c!!!\n end",
"def on_matched\n end",
"def one?(parameter, other)\n (send(parameter)) ^ (other.send(parameter))\n end",
"def match_in_owner_scope(others)\n others.detect do |other|\n self.class == other.class and specimen_type == other.specimen_type and pathological_status == other.pathological_status and\n characteristics and characteristics.matches?(other.characteristics)\n end\n end",
"def resolve(subject, token, continued: false)\r\n available = context_from(subject)\r\n return Matches.new([], '', token) if available.empty?\r\n if continued\r\n return Matches.execute(available, token, continued: continued)\r\n elsif nested?(token)\r\n drill = denest(available, token)\r\n drill.keep_if{ |e| accept?(e) }\r\n return Matches.new(drill, token, '') unless drill.length != 1\r\n return Matches.new([], '', token)\r\n end\r\n result = available.select{ |e| e.match?(token) }\r\n result = available.select{ |e| e.match?(token, fuzzy: true) } if result.empty?\r\n result.keep_if{ |e| accept? e }\r\n Matches.new(result, (result.empty? ? '' : token), (result.empty? ? token : ''))\r\n end",
"def test_strict_match_criteria\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")\n cedict_entry = CEdictEntry.new\n cedict_entry.parse_line(\"工作 工作 [gong1 zuo4] /job/work/construction/task/CL:個|个[ge4],份[fen4],項|项[xiang4]/\")\n \n result = entry.default_match_criteria.call(cedict_entry,entry)\n assert(true,result)\n end",
"def exact_matches(other_code)\n exact_matches = 0\n @seq.each_with_index do |letter, index|\n exact_matches += 1 if self.is_exact_match?(other_code, index)\n end\n exact_matches\n end"
] | [
"0.6603004",
"0.6441187",
"0.6122854",
"0.6087162",
"0.6007609",
"0.5985993",
"0.5949671",
"0.58849823",
"0.58587086",
"0.57798433",
"0.570371",
"0.56930345",
"0.5680121",
"0.56729513",
"0.5651722",
"0.55331445",
"0.55325097",
"0.55183464",
"0.5515873",
"0.5504669",
"0.5494981",
"0.5493225",
"0.5422808",
"0.53591615",
"0.5341992",
"0.5240713",
"0.5240713",
"0.52385473",
"0.52107894",
"0.5183578",
"0.5171828",
"0.51710665",
"0.5171007",
"0.51611775",
"0.5157206",
"0.51408255",
"0.51364416",
"0.5127752",
"0.5127326",
"0.51203",
"0.5114338",
"0.5109454",
"0.5109454",
"0.509838",
"0.50867236",
"0.50801647",
"0.50640863",
"0.5047349",
"0.5046341",
"0.50093126",
"0.5005081",
"0.5003792",
"0.49988553",
"0.4985928",
"0.49781537",
"0.49761295",
"0.49696752",
"0.49628478",
"0.49545273",
"0.49533153",
"0.49459815",
"0.4932436",
"0.49283576",
"0.49268818",
"0.49247697",
"0.48995173",
"0.4898817",
"0.48981684",
"0.4897603",
"0.4889214",
"0.48773685",
"0.48751122",
"0.48642963",
"0.48625675",
"0.48611164",
"0.48604843",
"0.48592854",
"0.48592854",
"0.48573643",
"0.48508367",
"0.48507565",
"0.48499453",
"0.48498312",
"0.48498312",
"0.48440218",
"0.4840894",
"0.48378935",
"0.48368365",
"0.48224038",
"0.48140138",
"0.48075196",
"0.4806649",
"0.48041642",
"0.4801595",
"0.47940022",
"0.47928703",
"0.4792569",
"0.47859478",
"0.47855058",
"0.47795057"
] | 0.6870588 | 0 |
If no argument is passed: Do we have at least as many matches as available `match_positions`? If another Candidate is passed: Is that candidate included in the matches? ARG: `other` [optional] another Candidate instance | def matched?( other = nil )
return full? if other.nil?
matches.include? other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than any other match?\n when better_match?( other )\n free!\n match! other\n\n else\n false\n end\n end",
"def better_match?( other )\n return true if prefers?( other ) && free?\n preference_index = preferences.index other\n match_preference_indexes = matches.map { | match | preferences.index match }\n preference_index and match_preference_indexes.any? { |i| i > preference_index }\n end",
"def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end",
"def match!( other )\n return false unless prefers?( other ) && !matched?( other )\n matches << other\n other.matches << self\n end",
"def candidates_included_in_all_the_others(candidates_in_correct_position)\n\tcandidates_in_correct_position.each do |small|\n\t\tok = true\n\t\tcandidates_in_correct_position.each do |big|\n\t\t\tif small!=big\n\t\t\t\tunless big.source.position.include?(small.source.position)\n\t\t\t\t\tok = false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn small if ok\n\tend\n\tnil\nend",
"def has_match?\n !match_x.nil? && !match_y.nil?\n end",
"def match(other, settings=nil)\n no_match_required = settings.nil? || settings.no_match_required?\n potential_match_attributes = {:offer_signup => other, :request_signup => self, :collection => self.collection}\n prompt_matches = []\n unless no_match_required\n self.requests.each do |request|\n other.offers.each do |offer|\n if (match = request.match(offer, settings))\n prompt_matches << match\n end\n end\n end\n return nil if settings.num_required_prompts == ALL && prompt_matches.size != self.requests.size\n end\n if no_match_required || prompt_matches.size >= settings.num_required_prompts\n # we have a match\n potential_match_attributes[:num_prompts_matched] = prompt_matches.size\n potential_match = PotentialMatch.new(potential_match_attributes)\n potential_match.potential_prompt_matches = prompt_matches unless prompt_matches.empty?\n potential_match\n else\n nil\n end\n end",
"def _match_arguments_options_before_matcher\n # number of arguments that are needed to fill our mandatory argument options\n mandatories_matched = @optionals_before.size\n\n # there are optionals at the end of the options, don't match the void\n if @optionals_before_has_remaining\n mandatories_matched -= 1\n end\n\n total = 0\n\n # loop through optional map\n _each_optional_before_sorted do |before|\n # are there enough arguments left to fill this optional group\n if (total + before.size + mandatories_matched) <= @argument_values.size\n total += before.size\n\n before.each do |val|\n val[:included] = true\n end\n end\n end\n\n self\n end",
"def near_match\n (0..3).each do |guess_index|\n compare_for_near_match(guess_index)\n end\n end",
"def matchingCandidates(token)\n candidates(@currentNode, token)\n end",
"def needs_playing?\n # if either both children are matches and they both need relevant\n # OR\n # both children are players and both are present\n children.count {|child| child.is_a?(Match) ? child.relevant? : child.present?} == 2\n end",
"def _match_arguments\n @optionals_before = {}\n @optionals_before_has_remaining = false\n\n total_argument_values = @argument_values.size\n argument_values_index = 0\n\n _match_arguments_optionals_before\n\n @optionals_before.each do |mandatory_arg_name, optionals|\n # fill the optional argument option with a value if there are enough\n # arguments supplied (info available from optionals map)\n optionals.each do |_, optional|\n optional.each do |before|\n if before[:included]\n return nil if argument_values_index >= total_argument_values\n\n @matched_options[before[:name]] = @argument_values[argument_values_index]\n argument_values_index += 1\n end\n end\n end\n\n # only fill mandatory argument if its not the :REMAINING key\n if mandatory_arg_name != :REMAINING\n return nil if argument_values_index >= total_argument_values\n\n @matched_options[mandatory_arg_name] = @argument_values[argument_values_index]\n argument_values_index += 1\n end\n end\n\n remaining = []\n\n # left over arguments\n while argument_values_index < @argument_values.size\n remaining.push @argument_values[argument_values_index]\n argument_values_index += 1\n end\n\n remaining\n end",
"def candidatesmatch\n if current_user_candidate\n @candidate = current_user_candidate.candidate\n populate_matches_for_candidate (current_user_candidate)\n @candidate = current_user_candidate.candidate\n @match = Match.where(\n candidate: @candidate,\n job_like: nil,\n )\n end\n end",
"def minimal_match?(other)\n super and tolerant_match?(other, TOLERANT_MATCH_ATTRS)\n end",
"def has_match?(p1, p2)\n\t\t! (Match[:p1_id => p1.id, :p2_id => p2.id] or Match[:p2_id => p1.id, :p1_id => p2.id]).nil?\n\tend",
"def args_match(matchers, candidates, match_data = {})\n matchers.each do |m|\n case m.function\n when :'?'\n return false if candidates.empty?\n match_data[m.literal] = candidates.shift\n when :'_'\n return false if candidates.empty?\n return false unless candidates.shift.literal == m.literal\n when :'[]'\n return false if candidates.empty?\n match_data[m.literal] = candidates\n candidates = []\n else\n return false if candidates.empty?\n return false unless do_match(m, candidates.shift, match_data)\n end\n end\n candidates.empty?\n end",
"def near_matches(other_code)\n num_matches = 0\n matches = []\n i = 0\n while (i < self.pegs.length)\n j = 0\n while (j < other_code.pegs.length)\n if(self[i] == other_code[j])\n if(i != j)\n unless (matches.include?(self[i]))\n num_matches += 1\n matches << self[i]\n end\n else\n if(matches.include?(self[i]))\n num_matches -= 1\n end\n end\n end\n j += 1\n end\n i += 1\n end\n num_matches\n end",
"def receive_match(pos_1, pos_2)\n @matched_cards[pos_1] = true\n @matched_cards[pos_2] = true\n end",
"def match\n @argument_matchers[0...-1].each_with_index do |argument_matcher, index|\n @argument_matchers[index + 1].successor = argument_matcher\n end\n\n chain_matcher = @argument_matchers.last\n chain_matcher.check_to_assing_and_match(@data)\n end",
"def exact_matches(other_code)\n exact_matches = 0\n @seq.each_with_index do |letter, index|\n exact_matches += 1 if self.is_exact_match?(other_code, index)\n end\n exact_matches\n end",
"def matched_positions\n _response_entity.fetch(\"matchingTokens\", [])\n end",
"def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end",
"def satisfy?(o, data={})\n # Future optimizations: \n # * Shortcut matching sibling\n subject_matches = index_matches(subject, o)\n return nil if subject_matches.empty?\n \n sibling_matches = index_matches(sibling, o)\n return nil if sibling_matches.empty?\n\n subject_matches.each do |i1, data_1|\n sibling_matches.each do |i2, data_2|\n if (distance ? (i2-i1 == distance) : i2 > i1)\n data = data.merge(data_1).merge(data_2)\n return capture_match(o, data)\n end\n end\n end\n \n nil\n end",
"def is_a_match(total_in_common)\n total_in_common >= 2 ? true : false\n end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def companiesmatch\n if current_user_company\n @company = current_user_company.company\n job_id = params[:id]\n if job_id\n @job = Job.find_by(id: job_id)\n populate_matches_for_company (@job)\n @match = Match.order(\"candidate_like\").find_by(\n job: @job,\n job_like: nil,\n )\n if @match\n @match.candidate.views += 1\n @match.candidate.save\n else\n redirect_to @job, notice: \"No more candidates, womp womp\"\n return\n end\n end\n end\n end",
"def my_match_with(other_user)\n self.matches.select {|a| a if a.users.include?(other_user)}.first\n end",
"def num_matching(one_bigrams, two_bigrams, acc = 0)\n return acc if one_bigrams.empty? || two_bigrams.empty?\n\n one_two = one_bigrams.index(two_bigrams[0])\n two_one = two_bigrams.index(one_bigrams[0])\n\n if one_two.nil? && two_one.nil?\n num_matching(one_bigrams.drop(1), two_bigrams.drop(1), acc)\n else\n # If one is nil, it is set to the other\n two_one ||= one_two\n one_two ||= two_one\n\n if one_two < two_one\n num_matching(one_bigrams.drop(one_two + 1),\n two_bigrams.drop(1), acc + 1)\n else\n num_matching(one_bigrams.drop(1),\n two_bigrams.drop(two_one + 1), acc + 1)\n end\n end\n end",
"def match(left, right)\n IdentityParade::Match.new(left, right).score\n end",
"def receive_match(pos_one, pos_two)\n @matches.push(pos_one, pos_two)\n @known_cards.delete_if { |k,v| v.include?(pos_one) || v.include?(pos_two) } #it is deleting that k/v from known_c!!!\n end",
"def exact_matches(other_code)\n num_matches = 0\n self.pegs.each_with_index do |code, index|\n if(code == other_code[index])\n num_matches += 1\n end\n end\n num_matches\n end",
"def exact_matches(guess)\n pegs.zip(guess.pegs).count { |a, b| a == b }\n end",
"def receive_match(position1, position2)\n @matched_cards[position1] = true\n @matched_cards[position2] = true\n end",
"def matches?\n raise NotImplementedError, 'You must override the matches? method in your matcher.'\n end",
"def num_near_matches(guess)\n counter = 0\n guess.pegs.each { |peg| counter += 1 if @pegs.include?(peg) }\n counter - num_exact_matches(guess)\n end",
"def try_to_match(tokens, match_start)\n progress = PatternMatchProgress.progress_start\n (match_start...tokens.length).each do |i|\n token = tokens[i]\n features = token.feature.split(',')\n y = features.last\n if reWord !~ y\n if y == '、'\n next\n end\n return nil\n end\n if progress.word_start? && !jiritu_token?(features)\n return nil\n end\n n = count_char(y)\n progress = progress.add_sentence(token.surface, n)\n\n if progress.word_length_matched?\n progress = progress.mark_word_break\n elsif progress.word_length_over?\n return nil\n end\n return progress.sentence if progress.matched?\n end\n nil\n end",
"def matched?(other_user)\n matched.include?(other_user)\n end",
"def is_stable?\n # Every person's partner should match up\n @matches.all? { |k,v| is_matched?(k, v) }\n end",
"def near_match?(choice)\n @comp.code_combination.include?(choice)\n end",
"def match!\n clear!\n tighten_search_area\n @benchmark = Benchmark.measure do\n send(strategy_method)\n end\n save_match_file if highlight_match\n return has_match?\n end",
"def matches\n\t\t\tcompetition.matches\n\t\tend",
"def perform\n candidates.each { |candidate| propose(candidate) }\n @matches\n end",
"def closest_match(new_model, crucial_params, match_params)\n best_matches = []\n # for an increasing number of parameters, look for matches with all combinations of that number of match params\n # looks for the match fitting the highest number of parameters and chooses that one\n # TODO: can be optimized since certain possibilities can be nipped out of future iterations if their descendants did not have matches\n 1.upto(match_params.count - 1) do |count|\n match_found = false\n CombinatorialIterator.new(count, match_params).mapCombinations do |params|\n cur_params = crucial_params.merge(params)\n matches = new_model.class.where(cur_params)\n # logger.info \"found #{matches.count} matches for cur_params: #{cur_params.keys}\"\n if matches.any?\n match_found = true\n # logger.info \"new_model: #{new_model.inspect}\\nmatch: #{matches.first.inspect}\"\n best_matches = matches\n end\n end\n break unless match_found # stop the iteration is no matches were found for this humber of parameters\n end\n best_matches.first\n end",
"def matches\n @subject.matches\n end",
"def matches\n @matches ||= []\n end",
"def requested?(matchable)\r\n (@requested ||= []).include? matchable\r\n end",
"def matches\n process_events! unless @matches\n @matches\n end",
"def match(other, anchor, fuzz=Pixel(0))\n each { |p| return false if !other[anchor + p].approx(self[p], fuzz)}\n true\n end",
"def match?(instance)\n match_id?(instance) || match_percentage?(instance) || match_groups?(instance)\n end",
"def default_match_criteria\n match_criteria = Proc.new do |dict_entry, tag_entry|\n same_headword = (dict_entry.headword_trad == tag_entry.headword_trad) || (dict_entry.headword_simp == tag_entry.headword_simp)\n if same_headword\n # Now process the pinyin and see if we match\n tag_pinyin = tag_entry.pinyin.gsub(\" \",\"\")\n dict_pinyin = dict_entry.pinyin.gsub(\" \",\"\")\n if dict_entry.meaning_txt.downcase.index(\"surname\")\n same_pinyin = (dict_pinyin == tag_pinyin)\n else\n same_pinyin = (dict_pinyin.downcase == tag_pinyin.downcase)\n end\n \n # If we didn't match right away, also check for the funny tone changes \n if (same_pinyin == false and (tag_pinyin.index(\"yi2\") or tag_pinyin.index(\"bu2\")))\n same_pinyin = (dict_pinyin.downcase == tag_pinyin.downcase.gsub(\"yi2\",\"yi1\").gsub(\"bu2\",\"bu4\"))\n end\n \n # The return keyword will F everything up!\n (same_headword and same_pinyin)\n else\n false\n end\n end\n return match_criteria\n end",
"def match(other)\n solve == other.solve\n end",
"def match?(other)\n return false unless other.is_a?(GroupingCriteria)\n return true if ids && other.ids && ids.intersect?(other.ids)\n return true if values == other.values\n return false if values.blank? || other.values.blank?\n values.each_with_index.all? do |v, i|\n v.blank? || other.values[i].blank? || (v == other.values[i])\n end\n end",
"def super_match(*args)\n return unless match = match(args.first) \n returning match do |m|\n args[1..-1].each_with_index { |name, index| m.meta_def(name) { self[index+1] } }\n end\n end",
"def prior_matches_resolved\n if (player_id_changed? || opponent_id_changed?) && competition.matches.where(\"round < ? and winner_id IS NULL\", round).any?\n errors.add(:base, \"Resolve the winners of any previous rounds before assigning contestants to this one.\")\n end\n end",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def match_range sq1, sq2, how \n\t\tmatches = 0\n\n\t\twater_count = 0\n\t\trange = (-radius..radius)\n\t\trange.each do |row|\n\t\t\tFiber.yield\n\n\t\t\trange.each do |col|\n\t\t\t\tsq_a = sq1.rel [ row, col ]\n\t\t\t\tsq_b = sq2.rel target_coord( row, col, how )\n\n\t\t\t\tnext if sq_a.region.nil? or sq_b.region.nil?\n\n\t\t\t\tif sq_a.water? == sq_b.water?\n\t\t\t\t\tmatches += 1\n\t\t\t\t\twater_count += 1 if sq_a.water?\n\t\t\t\telse\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\tend\n\t\tend\n\n\t\t# Mark matches without water as not valid\n\t\tmatches = 0 if water_count == 0\n\n\t\tmatches\n\tend",
"def matches(needles)\n if haystack.nil?\n raise RuntimeError.new('can\\'t match before setting a haystack')\n end\n\n # create Elements\n needles = import_list(needles)\n\n # get candidate matches\n candidates = candidates_for(needles)\n vputs \" got #{candidates.length} candidates.\"\n\n # pick winners\n winners(needles, candidates)\n end",
"def loose_match_criteria\n criteria = Proc.new do |dict_entry, tag_entry|\n # These no-return statements weird me out\n contains_headword = (dict_entry.headword_simp.index(tag_entry.headword_simp).nil? == false)\n end\n return criteria\n end",
"def match_at? rexp, pos = 0\n MatchAt.match_at? self, rexp, pos\n end",
"def match_position_by_opencv\n t_image = CvMat.load(template_image.filename)\n s_image = CvMat.load(search_image.filename)\n\n result = s_image.match_template(t_image, :sqdiff_normed)\n\n point = result.min_max_loc[2]\n if point.x > 0 && point.y > 0\n self.match_result = [point.x, point.y]\n end\n return match_result\n end",
"def loose_match_criteria\n match_criteria = Proc.new do |dict_entry, tag_entry|\n same_headword = (dict_entry.headword_trad == tag_entry.headword_trad) || (dict_entry.headword_simp == tag_entry.headword_simp)\n end\n return match_criteria\n end",
"def match(candidates)\n\t\tself.downcase(candidates)\n\t\t@ed.match(candidates)\n\tend",
"def num_near_matches(guess_object)\n pegs = guess_object.pegs\n count = 0\n pegs.each_with_index do |char, i|\n count += 1 if @pegs.include?(char) && char != @pegs[i]\n end\n count\n end",
"def match(p0) end",
"def match(p0) end",
"def better_partner?(matchable)\r\n rank(matchable) > rank(@partner)\r\n end",
"def two_candidates?\n @candidates.count == 2\n end",
"def matches?(*)\n # by default nothing matches\n nil\n end",
"def accept?(fuzz_match)\n\t\t\t\ttrue\n\t\t\tend",
"def queue_matches\n\n end",
"def match_position_by_similar\n add_fuzz_to_images\n self.match_result = search_image.find_similar_region(template_image)\n return match_result\n end",
"def one_match?(candidate_categories, result_age = nil)\n return false unless candidate_categories.one?\n\n candidate_category = candidate_categories.first\n match = candidate_category.include? self, result_age\n debug \"one_match? #{match}\"\n match\n end",
"def is_correct?\n self.match.final_result == selected_result\n end",
"def match!(teams,team)\n my_rating = team_rating(team)\n best = nil\n best_team = nil\n teams.teams.each do |other|\n\n if other.members.size < other.min_for_match\n next\n end\n\n if rating = team_rating(other)\n diff = my_rating > rating ? my_rating - rating : rating - my_rating\n if best.nil? || diff < best\n best = diff\n best_team = other\n end\n end\n end\n\n if best_team\n GameMachine::Models::StartMatch.new(:team_names => [team.name,best_team.name])\n else\n nil\n end\n end",
"def find_matches\n @match_distances = Match.find_match(current_user, \"Any\", nil)\n end",
"def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def validate_matches\n return success unless (@matched_ids.present? || @unmatched_ids.present?)\n\n # common ids in matches_ids and unmatched_ids\n r = validate_matched_unmatched_records\n return r unless r.success?\n\n success\n\n end",
"def match_points(match, player)\n scores = Result.where(:match_id => match)\n score_1 = scores.first\n score_2 = scores.last\n if score_1[:player_id] == player\n if score_1[:score] == 3 && score_2[:score] == 2\n points = 6\n elsif score_1[:score] == 3 && score_2[:score] == 1\n points = 6\n elsif score_1[:score] == 3 && score_2[:score] == 0\n points = 7\n elsif score_1[:score] == 2 && score_2[:score] == 3\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 3\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 3\n points = 2\n elsif score_1[:score] == 2 && score_2[:score] == 0\n points = 4\n elsif score_1[:score] == 2 && score_2[:score] == 1\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 2\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 2\n points = 2\n elsif score_1[:score] == 2 && score_2[:score] == 2\n points = 4\n elsif score_1[:score] == 1 && score_2[:score] == 0\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 1\n points = 2\n elsif score_1[:score] == 1 && score_2[:score] == 1\n points = 3\n elsif score_1[:score] == 0 && score_2[:score] == 0\n points = 2\n elsif score_2[:score] == -1\n points = 6\n elsif score_1[:score] == -1\n points = 0\n end\n elsif score_2[:player_id] == player\n if score_2[:score] == 3 && score_1[:score] == 2\n points = 6\n elsif score_2[:score] == 3 && score_1[:score] == 1\n points = 6\n elsif score_2[:score] == 3 && score_1[:score] == 0\n points = 7\n elsif score_2[:score] == 2 && score_1[:score] == 3\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 3\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 3\n points = 2\n elsif score_2[:score] == 2 && score_1[:score] == 0\n points = 4\n elsif score_2[:score] == 2 && score_1[:score] == 1\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 2\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 2\n points = 2\n elsif score_2[:score] == 2 && score_1[:score] == 2\n points = 4\n elsif score_2[:score] == 1 && score_1[:score] == 0\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 1\n points = 2\n elsif score_2[:score] == 1 && score_1[:score] == 1\n points = 3\n elsif score_2[:score] == 0 && score_1[:score] == 0\n points = 2\n elsif score_1[:score] == -1\n points = 6\n elsif score_2[:score] == -1\n points = 0\n end\n end\n return points\n end",
"def match_result\n [match_x, match_y]\n end",
"def near_matches(guess)\n near_matches = 0\n COLORS.values.each do |color|\n near_matches += [pegs.count { |x| x == color }, \n guess.pegs.count { |x| x == color }].min\n end\n \n near_matches - exact_matches(guess)\n end",
"def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end",
"def match_args(results, queries)\n queries.map do |query|\n (results.any? { |r| r.to_s.match(query) } ? 1 : nil)\n end.compact\n end",
"def matches\n parse\n end",
"def position_available(marker_pos, player1_obj, player2_obj)\n # test - marker_pos - index has a limit of 1 to 9\n return false if marker_pos.negative? || (marker_pos > 8)\n\n # test - new move - does not overlap any previous moves done.\n return true if (player1_obj.moves_arr[marker_pos].zero? && player2_obj.moves_arr[marker_pos].zero?) == true\n\n false\nend",
"def build_match(home_team, away_team)\n raise 'Not Implemented'\n end",
"def __matches_when__(receiver)\n i = @start\n tot = @total + @start\n while i < tot\n return true if @tuple.at(i) === receiver\n i = i + 1\n end\n false\n end",
"def __matches_when__(receiver)\n i = @start\n tot = @total + @start\n while i < tot\n return true if @tuple.at(i) === receiver\n i = i + 1\n end\n false\n end",
"def matches(query)\n @matches ||= search(query)\n end",
"def match\n @match\n end",
"def positional_match_or_nil(source, re, position)\n md = source.match(re)\n matched_substr = md && md[position]\n yield(matched_substr) if matched_substr\n matched_substr\n end",
"def match?(locator)\n @match&.call(locator)\n end",
"def free?\n matches.length < match_positions\n end",
"def hit?(actual_move)\n return false unless self.length > 1\n\n with(self[0]) do |expected|\n return true if expected == \"*\"\n return true if expected == actual_move.notation\n # from/to coord matching next\n end\n \n false\n end",
"def similar_to?(other)\n self.composition == other.composition\n end",
"def match(*list)\n @match.concat(makelist(list)) unless list.empty?\n @match\n end",
"def create\n params.require(:result).sort_by{|match_id,_| match_id}.each do |match_id, attrs|\n complete = true\n match = Match.find(match_id)\n\n if attrs['team1_score'].present? and attrs['team2_score'].present?\n\n team1_score = attrs['team1_score'].split('*').first.to_i\n team2_score = attrs['team2_score'].split('*').first.to_i\n\n if match.stage <= 16\n attrs['team1_id'] = match.team1_id\n attrs['team2_id'] = match.team2_id\n\n if match.stage < 16\n if match.stage == 8\n if match.pos_in_stage == 1\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 1).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 2).first\n elsif match.pos_in_stage == 2\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 5).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 6).first\n elsif match.pos_in_stage == 3\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 3).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 4).first\n elsif match.pos_in_stage == 4\n parentMatch1 = Match.where(stage: 16, pos_in_stage: 7).first\n parentMatch2 = Match.where(stage: 16, pos_in_stage: 8).first\n end\n elsif match.stage == 4\n if match.pos_in_stage == 1\n parentMatch1 = Match.where(stage: 8, pos_in_stage: 1).first\n parentMatch2 = Match.where(stage: 8, pos_in_stage: 2).first\n else\n parentMatch1 = Match.where(stage: 8, pos_in_stage: 3).first\n parentMatch2 = Match.where(stage: 8, pos_in_stage: 4).first\n end\n else\n parentMatch1 = Match.where(stage: 4, pos_in_stage: 1).first\n parentMatch2 = Match.where(stage: 4, pos_in_stage: 2).first\n end\n\n if match.stage == 2 and match.pos_in_stage == 1\n attrs['team1_id'] = parentMatch1.loser_id\n attrs['team2_id'] = parentMatch2.loser_id\n else\n attrs['team1_id'] = parentMatch1.winner_id\n attrs['team2_id'] = parentMatch2.winner_id\n end\n\n complete = false unless attrs['team1_id'].present? and attrs['team2_id'].present?\n end\n\n if complete\n if team1_score > team2_score\n attrs['winner_id'] = attrs['team1_id']\n elsif team1_score < team2_score\n attrs['winner_id'] = attrs['team2_id']\n else\n if attrs['team2_score'].include? '*'\n attrs['winner_id'] = attrs['team2_id']\n attrs['team2_score'] = team2_score\n else\n attrs['winner_id'] = attrs['team1_id']\n attrs['team1_score'] = team1_score\n end\n end\n end\n end\n\n match.attributes = attrs\n if match.changed? and complete\n match.save\n Forecast.update_user_points(match)\n end\n else\n match.team1_score = nil\n match.team2_score = nil\n match.winner_id = nil\n\n match.save\n end\n end\n\n flash[:notice] = 'Resultados actualizados correctamente'\n redirect_to points_path\n end",
"def points\n return 0 if match.invalid_result?\n return 4 if self.score == match.score\n return 3 if self.goals_diff == match.goals_diff\n return 2 if self.winner == match.winner\n return 0\n end"
] | [
"0.6844583",
"0.60324234",
"0.59679455",
"0.5843598",
"0.5828867",
"0.57141393",
"0.57013077",
"0.5695834",
"0.5681551",
"0.56805193",
"0.5590659",
"0.55807596",
"0.55698407",
"0.5568948",
"0.5542452",
"0.55119556",
"0.5470464",
"0.5466821",
"0.5452096",
"0.5418991",
"0.54105264",
"0.5403644",
"0.5392113",
"0.53752565",
"0.534633",
"0.534209",
"0.53345025",
"0.53337216",
"0.5312712",
"0.5295549",
"0.52933407",
"0.52828145",
"0.5272647",
"0.5250484",
"0.52059174",
"0.5196223",
"0.5185934",
"0.5179773",
"0.5177248",
"0.5170799",
"0.5161432",
"0.51488537",
"0.5141685",
"0.5140902",
"0.51348937",
"0.51261544",
"0.51145625",
"0.51107347",
"0.51017743",
"0.5099028",
"0.5097115",
"0.5068005",
"0.50644743",
"0.5061843",
"0.50521374",
"0.5044928",
"0.50424796",
"0.50388396",
"0.5036271",
"0.50357956",
"0.50338954",
"0.5026949",
"0.50248516",
"0.50201654",
"0.50201654",
"0.5014284",
"0.5012823",
"0.5012796",
"0.49941474",
"0.49868795",
"0.49805108",
"0.4977101",
"0.4968495",
"0.4965676",
"0.4959612",
"0.49590778",
"0.49543974",
"0.49543974",
"0.49543974",
"0.49521512",
"0.4941613",
"0.49404892",
"0.49404073",
"0.49342987",
"0.49198845",
"0.49176013",
"0.4916364",
"0.49036485",
"0.49031118",
"0.49031118",
"0.48951545",
"0.48940367",
"0.48895994",
"0.48892736",
"0.48821452",
"0.48795706",
"0.48794383",
"0.48710975",
"0.48710006",
"0.4859764"
] | 0.6479525 | 1 |
Increment `preference_position` and return the preference at that position | def next_preference!
self.preference_position += 1
preferences.fetch preference_position
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_preference(name, value); end",
"def add_preference(name, value); end",
"def increment_position\n return unless in_list?\n # in_collection.where(:pos => my_position).\n adjust!(position_key => 1) \n save!\n end",
"def set_preference\n @preference = @user.preferences.find(params[:id])\n end",
"def preference(value)\n fresh.tap do |criteria|\n criteria.preference_value = value\n end\n end",
"def increment_position\n return unless in_list?\n set_list_position(current_position + 1)\n end",
"def preference_value(preferences)\n preferences.param(key)\n end",
"def add_preference(name, value)\n @options[:prefs][name] = value\n end",
"def increment_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i + 1\n end",
"def increment_position\n return unless in_list?\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(1)\n end",
"def set_preference\n preference = Preference.find(params[:id])\n end",
"def update_position\n if self.simple_acts_as_list_scope.length == 0\n self.position = 1\n else\n self.position = self.simple_acts_as_list_scope.last.position + 1\n end\n end",
"def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end",
"def set_preference\n @preference = Preference.find(params[:id])\n end",
"def preference\n redirect_to NextPageFinder.get_next_page current_user: current_user, next_response: @response\n end",
"def assign_pid\n start = Setting.starting_pid\n\n self.pid = if Pilot.exists?\n last = Pilot.order(pid: :asc).last\n (last.pid >= start ? last.pid + 1 : start)\n else\n start\n end\n end",
"def place\n event.placings.find_index(self) + 1\n end",
"def position_result\n hurdle_match.rank.index(self) + 1\n end",
"def get_preference(prefs_section, pref)\n driver.getPref(prefs_section, pref)\n end",
"def pref(key)\n if pref = preferences.find_by(key: key)\n pref.value\n else\n Droom.user_default(key)\n end\n end",
"def to(position)\n first position + 1\n end",
"def to(position)\n first position + 1\n end",
"def get_pref(key)\n data = @prefs_fetched ? @prefs_cache : prefs\n data[key]\n end",
"def set_pref(key, value)\n preferences.where(key: key).first_or_create.set(value)\n end",
"def get_local_preference_by_type(type)\n\tcase type\n\twhen \"upstream\"\n\t\tp = 100\n\twhen \"downstream\"\n\t\tp = 300\n\twhen \"peering\"\n\t\tp = 200\n\tend\n\n\treturn p\nend",
"def advance\n @current += 1 unless at_end?\n return previous\n end",
"def set_position \n if organization.goals.reload.present?\n self.position = organization.goals.maximum(:position) + 1\n else\n self.position = 1\n end\n end",
"def preference(key)\n pref = preferences.where(key: key).first_or_initialize\n pref.value = Droom.user_default(key) unless pref.persisted?\n pref\n end",
"def choose_position(position, p)\n\t\tcases = %w[A1 A2 A3 B1 B2 B3 C1 C2 C3]\n\t\tindex = cases.index position\n\t\tput_in(index, p)\n\tend",
"def next_hint\n transaction do\n idx = self.current_hint\n update_attribute(:current_hint, (idx += 1) == hints.size ? 0 : idx)\n end\n\n hints[current_hint]\n end",
"def preference_for setting\n\n if preferences = self.preference\n pref = preferences.attributes[setting.to_s]\n return pref unless pref.empty?\n end\n\n Preference.default_for setting\n end",
"def exhausted_preferences?\n preference_position >= preferences.size - 1\n end",
"def preferred(property_name)\n preferred = nil\n last_pref = 101\n select(property_name).each do |field|\n pref = 101\n\n if field.key?('TYPE') && field['TYPE'].has('PREF')\n pref = 1\n elsif field.key?('PREF')\n pref = field['PREF'].value.to_i\n end\n\n if pref < last_pref || preferred.nil?\n preferred = field\n last_pref = pref\n end\n end\n\n preferred\n end",
"def increment_order!\n @current += 1\n end",
"def current_position\n return 1 if Task.all.empty?\n Task.maximum('position') + 1\n end",
"def set_position \n if goal.objectives.reload.present?\n self.position = goal.objectives.maximum(:position) + 1\n else\n self.position = 1\n end\n end",
"def set_user_preference\n @user_preference = UserPreference.find(params[:id])\n end",
"def placement_at(position)\n @checkpoint_placements[position.to_s]\n end",
"def position_for_index(index)\n to_move = self.triplocations[index]\n return to_move.position if to_move\n return 1 if self.triplocations.empty?\n self.triplocations.last.position + 1\n end",
"def add_position\n self.position = self.max_position + 1\n end",
"def next\n peek.tap { @position += 1 }\n end",
"def p_update_position_via(index, group)\n relationships = self.property_relations\n relationships |= self.property_relations.select { |r| r[:position] != nil && r[:group_id] == group.id }\n last = relationships.count \n relationships.each do |r|\n if r.position.nil?\n r.position = last -= 1\n r.save\n else\n if r.position > index\n r.position -= 1 \n r.save\n end\n end\n end\n end",
"def ask_pref(preference, prompt)\n prefs[preference] = ask_wizard(prompt)\nend",
"def [](pref)\n ensure_preferences_loaded\n @@greader_preferences[pref.to_s.gsub('_', '-')]\n end",
"def next_value\n value = $options.send(getter)\n return (value + @values[:increment]).clamp(@values[:min], @values[:max]) if @type == :slider\n value_index = @values.index(value)\n new_value = @values[(value_index || 0) + 1]\n new_value = @values.first if new_value.nil?\n return new_value\n end",
"def preferences_field\n :preferences\n end",
"def update_install_preference\n if current_user.present?\n current_user.update_install_preference(preference_param)\n\n head(200)\n else\n head(404)\n end\n end",
"def succ(value)\n index = self[value].to_i + 1\n (index >= size) ? first : @ordered_elements[index]\n end",
"def preference(method, data = {})\n call_endpoint(Endpoint::Preference, method, data)\n end",
"def get_point\n @right_answers += 1\n end",
"def increment_positions_on_higher_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} + 1)\", \"#{:position} < #{send(:position).to_i}\"\n )\n end",
"def pos\n @position[:current]\n end",
"def set_position\n if last_recipient = message.recipients.find(:first, :conditions => {:kind => kind}, :order => 'position DESC')\n self.position = last_recipient.position + 1\n else\n self.position = 1\n end\n end",
"def next_faceup_position\n return 1 if (faceup == [])\n faceup.last.faceup_position + 1\n end",
"def pitcher_update(conclusion)\n state = Celluloid::Actor[:\"state_#{@game_uuid}\"]\n cfg = state.setting\n mult = cfg[:\"pitcher_rank_multiplier_#{conclusion}\".to_sym]\n min = cfg[:pitcher_minimum_rank]\n raise \"pitcher_rank_multiplier_#{conclusion} not in Settings\" unless (mult && min)\n temp = @pitcher_rank * mult\n @pitcher_rank = [temp, min].max\n end",
"def increment_queue_position\n return unless in_queue?\n update_attribute queue_position_column, self.send(queue_position_column).to_i + 1\n end",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def pref(name, fallback = nil)\n @@prefs ||= {}\n name = name.to_s\n @@prefs[name] ||= Preference.where(key: name).first.try(:value) || fallback\n end",
"def reArrangePreference(userPreference, rrAllocation)\n\t\tunless userPreference[0].blank?\n\t\t\trrAllocation.each do |shiftId, pickedRolehash|\n\t\t\t\tpickedRolehash.each do |role, allocatedUsers|\n\t\t\t\t\tunless userPreference[0][role].blank?\n\t\t\t\t\t\tunPreferedUsers = userPreference[0][role]\n\t\t\t\t\t\tcurSftUnPreferedUsers = allocatedUsers & unPreferedUsers\n\t\t\t\t\t\tif userPreference[shiftId].blank? #|| userPreference[shiftId][role].blank?\n\t\t\t\t\t\t\tuserPreference[shiftId] = { role => curSftUnPreferedUsers} \n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tunless userPreference[shiftId][role].blank?\n\t\t\t\t\t\t\t\tuserPreference[shiftId][role] = userPreference[shiftId][role] + curSftUnPreferedUsers\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tuserPreference[shiftId][role] = curSftUnPreferedUsers\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tuserPreference\n\tend",
"def show\n @preference_category = PreferenceCategory.find_by_name(params[:id].titleize)\n @preferences = @preference_category.preferences.positioned.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @preference }\n end\n end",
"def update_position(index)\n relationships = self.group_relations\n last = relationships.count \n relationships.each do |r|\n if r.position.nil?\n r.update_attribute(:position, last -= 1)\n else\n if r.position > index\n r.update_attribute(:position, r.position - 1)\n end\n end\n end\n end",
"def update_install_preference(preference)\n if ALLOWED_INSTALL_PREFERENCES.include?(preference)\n self.install_preference = preference\n save\n else\n false\n end\n end",
"def set_default_position\n if position.nil?\n self.position = (self.guide.present? ? guide.questions.count + 1 : 0)\n end\n end",
"def procession_position\n procession.index(self).to_i + 1\n end",
"def procession_position\n procession.index(self).to_i + 1\n end",
"def increment_positions_on_lower_items(position)\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} >= #{position}\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} >= #{position}\")\n end \n end",
"def next_item\n index = self.simple_acts_as_list_scope.index(self)\n self.simple_acts_as_list_scope[index + 1]\n end",
"def index\n project.pick_windows.index(self) + 1\n end",
"def modify_question_position(question, new_position)\n old_position = question.position\n if(new_position != nil && new_position != old_position)\n last_position = Question.all.order(position: :desc).first.position\n # If the position submitted by the user is greater than the last position in the survey,\n # just make the question the last one in the survey.\n questions_between = []\n if(new_position > last_position)\n new_position = last_position\n questions_between = Question.where(\"position >= ?\", old_position).order(position: :desc)\n questions_between.each do |q|\n q.position -= 1\n end\n else\n if(new_position < old_position)\n questions_between = Question.where(\"position >= ? AND position < ?\", new_position, old_position).order(position: :desc)\n questions_between.each do |question|\n question.position += 1\n end\n else\n questions_between = Question.where(\"position > ? AND position <= ?\", old_position, new_position).order(position: :desc)\n questions_between.each do |question|\n question.position -= 1\n end\n end\n end\n questions_between.each do |question|\n question.save!\n end\n end\n return \"\", \"\"\n end",
"def set_preference\n begin\n @preference = Preference.find(params[:id])\n rescue\n flash[:danger] = \"You don't have permission for this action.\"\n redirect_to preferences_path\n end\n end",
"def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end",
"def set_default_position\n if position.nil?\n self.position = (question.present? ? question.answers.count + 1 : 0)\n end\n end",
"def get_pos(pos)\n build_pos_hash if @pos_hash.empty?\n @pos_hash[pos_to_sym(pos)]\n end",
"def new_capturing_group_position(old_position)\n increment = 0\n added_capturing_groups_after_group.each do |after_n_groups, count|\n increment += count if after_n_groups < old_position\n end\n old_position + increment\n end",
"def update\n\n respond_to do |format|\n @preference = @user.preferences.update(preference_params)[0]\n if @preference.valid?\n format.html { redirect_to user_preference_path(@user, @preference), notice: 'Preference was successfully updated.' }\n format.json { render :show, status: :ok, location: @preference }\n else\n format.html { redirect_to edit_user_preference_path(@user, @preference), alert: @preference.errors[:schedule][0] }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_preference(prefs_section, pref, value)\n driver.setPref(prefs_section, pref, value.to_s)\n end",
"def position_to_index(position)\n position - 1\n end",
"def update\n @preference = Preference.find(params[:id])\n \n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n flash[:notice] = 'Preference was successfully updated.'\n format.html { redirect_to(admin_preference_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def increment_positions_on_higher_items\n # return unless in_list?\n # acts_as_list_class.update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{scope_condition} AND #{position_column} < #{send(position_column).to_i}\") \n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n update_all(\"#{position_column} = (#{position_column} + 1)\", \"#{position_column} < #{send(position_column).to_i}\")\n end \n end",
"def increase_variable(index, value = 1, default: 0)\n\t\t\t@variables[index] = @variables[index] ? @variables[index] + value : default + value\n\t\tend",
"def update_proposal_counter_cache option, value\n return unless valid?\n return unless status.blank?\n return unless vote_proposal.published?\n\n record = vote_proposal.find_counter_cache_record(option)\n if user.confirmed?\n count = record.confirmed_vote_count || 0\n count = count + value\n record.update_column(:confirmed_vote_count, count)\n else\n count = record.anonymous_vote_count || 0\n count = count + value\n record.update_column(:anonymous_vote_count, count)\n end \n end",
"def next_starting_position\n\t\tpos = @starting_positions[@pos_idx]\n\t\t@pos_idx = (@pos_idx + 1) % @starting_positions.length\n\t\tpos\n\tend",
"def at(position)\n self[position]\n end",
"def position_by_data(data)\r\n position = @high_scores.rindex(data)\r\n position += 1 if position\r\n end",
"def preference_id\n user.uuid\n end",
"def succ\n @last_prime_index += 1\n compute_primes unless @last_prime_index < @primes.size\n @primes[@last_prime_index]\n end",
"def succ\n if (@type == \"t\" && @number == 4) || (@type != \"t\" && @number == 9)\n number = 1\n elsif @type == \"t\" && @number == 7\n number = 5\n else\n number = @number + 1\n end\n return Pai.new(@type, number)\n end",
"def new_rank\n row + @board.active_piece.rank_direction\n end",
"def new_rank\n row + @board.active_piece.rank_direction\n end",
"def read_preference\n @read_preference ||= options[:read]\n end",
"def update\n preferred_position = PreferredPosition.find(params[:id])\n if preferred_position.update(preferred_position_params)\n render json: preferred_position, status: 200, location: [:api, preferred_position]\n else\n failed_to_update(preferred_position, \"preferred_position\")\n end\n end",
"def position\n return @position\n end",
"def position\n return @position\n end",
"def next_track\n reload\n @tracks[@current_track_index + 1]\n end",
"def card_order_at(placement)\n return placement if placement.is_a?(Integer)\n\n # default to 'beginning', which goes after the first pinned card\n if master_template?\n order = 0\n else\n order = collection_cards.pinned.maximum(:order) || 0\n end\n if placement == 'end'\n order = collection_cards.maximum(:order) || -1\n order += 1\n end\n order\n end",
"def update_preference_list (preference_list, man)\n preference_list[man].shift\n preference_list.delete man if preference_list[man].blank?\n preference_list\n end",
"def get_offset(opts)\n phash = Hash[@processors.map.with_index.to_a]\n if opts[:before]\n offset = phash[Mdoc.get_processor(opts[:before])]\n elsif opts[:after]\n offset = phash[Mdoc.get_processor(opts[:after])] + 1\n end\n offset\n end",
"def increment\n @value += 1\n end",
"def pokemon_actual\n actual = @pokemones[@pokemon_actual]\n @pokemon_actual += 1\n actual\n end",
"def make_position\n unless new_record?\n return unless prev_position = Seite.find(self.id).position\n unless self.position.nil?\n if prev_position > self.position\n Seite.update_all(\"position = position + 1\", [\"? <= position AND position < ?\", self.position, prev_position])\n elsif prev_position < self.position\n Seite.update_all(\"position = position - 1\", [\"? < position AND position <= ?\", prev_position, self.position])\n end\n end\n end\n end"
] | [
"0.5632839",
"0.5632839",
"0.55967325",
"0.54378754",
"0.5403117",
"0.53960943",
"0.5393127",
"0.53751713",
"0.5368596",
"0.5325805",
"0.5211627",
"0.5195549",
"0.51651406",
"0.51442546",
"0.5065651",
"0.49772644",
"0.4976477",
"0.4962286",
"0.4920744",
"0.49167368",
"0.49121675",
"0.49121675",
"0.4899625",
"0.48962706",
"0.48845026",
"0.48754486",
"0.48688808",
"0.48605567",
"0.48521033",
"0.48495096",
"0.4844611",
"0.48434222",
"0.48345703",
"0.4828255",
"0.48197514",
"0.48135528",
"0.47959346",
"0.47880304",
"0.47800204",
"0.47664532",
"0.4764084",
"0.47562888",
"0.47531307",
"0.4742303",
"0.4724334",
"0.46956232",
"0.46837407",
"0.46835107",
"0.46695343",
"0.4667925",
"0.46665785",
"0.4645834",
"0.4634052",
"0.4631896",
"0.46312758",
"0.46253735",
"0.46233147",
"0.4604796",
"0.45983744",
"0.4587208",
"0.45823824",
"0.45772916",
"0.45745832",
"0.45738113",
"0.45738113",
"0.4567561",
"0.45630047",
"0.45416263",
"0.45145324",
"0.45077503",
"0.45060045",
"0.4498999",
"0.44961432",
"0.44860032",
"0.44795147",
"0.44787258",
"0.44710603",
"0.44662085",
"0.44648057",
"0.4461547",
"0.44594538",
"0.4452314",
"0.4450166",
"0.44446465",
"0.44442806",
"0.44351152",
"0.44229195",
"0.4419942",
"0.4419942",
"0.44071883",
"0.44022945",
"0.4396344",
"0.4396344",
"0.4393429",
"0.43931055",
"0.43905777",
"0.43866298",
"0.43791753",
"0.43791234",
"0.43751457"
] | 0.81344205 | 0 |
Is there a preference for the passed Candidate? ARG: `other` another Candidate instance | def prefers?( other )
preferences.include? other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than any other match?\n when better_match?( other )\n free!\n match! other\n\n else\n false\n end\n end",
"def ==(other)\n @candidate == other.candidate\n end",
"def chosen(already, owner, other)\n\t\tif already && already.owner_id == owner.id && current_user\n\t\t\t\"chosen\"\n\t\telse\n\t\t\tother\n\t\tend\n\tend",
"def better_match?( other )\n return true if prefers?( other ) && free?\n preference_index = preferences.index other\n match_preference_indexes = matches.map { | match | preferences.index match }\n preference_index and match_preference_indexes.any? { |i| i > preference_index }\n end",
"def propose! other\n if other.single?\n #first engagement for other\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n current_pref = other.pref_list.preference_of(other.engaged_to)\n my_pref = other.pref_list.preference_of(self)\n #the lower the index, the more preferred\n if my_pref < current_pref\n #found better matching\n other.jilt!\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n #reject this engagement\n return false\n end\n end\n end",
"def default?(preference)\n self.send(preference.to_sym) == self.class.new.send(preference.to_sym)\n end",
"def candidate?\n !!candidate\n end",
"def preferred?\n self.preferred\n end",
"def is_better_match?(person, first_better, second_better)\n @preferences[person].detect { |pref| pref == first_better || pref == second_better }\n end",
"def equals(other)\n return false if not super(other)\n return self.opts == other.opts\n end",
"def is_other?\n\t\tkey == 'other'\n\tend",
"def is_other?\n\t\tkey == 'other'\n\tend",
"def connects?(other)\n other &&\n (self == other ||\n (suited? &&\n suit == other.suit &&\n (rank - other.rank).abs <= 2))\n end",
"def candidate\n @candidate\n end",
"def in_contest?(pet)\n pet.id == challenger.id || pet.id == challenged.id\n end",
"def accepts?(other)\n true\n end",
"def priority_compare(other)\n pc = simplified <=> other.simplified\n if pc.zero? || !(extensions & other.extensions).empty?\n pc =\n if (reg = registered?) != other.registered?\n reg ? -1 : 1 # registered < unregistered\n elsif (comp = complete?) != other.complete?\n comp ? -1 : 1 # complete < incomplete\n elsif (obs = obsolete?) != other.obsolete?\n obs ? 1 : -1 # current < obsolete\n elsif obs && ((ui = use_instead) != (oui = other.use_instead))\n if ui.nil?\n 1\n elsif oui.nil?\n -1\n else\n ui <=> oui\n end\n else\n 0\n end\n end\n\n pc\n end",
"def better_partner?(matchable)\r\n rank(matchable) > rank(@partner)\r\n end",
"def similar_to?(other)\n self.composition == other.composition\n end",
"def one_candidate?\n @candidates.count == 1\n end",
"def two_candidates?\n @candidates.count == 2\n end",
"def compatible_handoff?(other)\n (normal? and other.normal?) or\n ((not normal?) and (not other.normal?))\n end",
"def priority_compare(other)\n pc = simplified <=> other.simplified\n\n if pc.zero? and registered? != other.registered?\n pc = registered? ? -1 : 1\n end\n\n if pc.zero? and platform? != other.platform?\n pc = platform? ? 1 : -1\n end\n\n if pc.zero? and complete? != other.complete?\n pc = complete? ? -1 : 1\n end\n\n if pc.zero? and obsolete? != other.obsolete?\n pc = obsolete? ? 1 : -1\n end\n\n if pc.zero? and obsolete? and (use_instead != other.use_instead)\n pc = if use_instead.nil?\n -1\n elsif other.use_instead.nil?\n 1\n else\n use_instead <=> other.use_instead\n end\n end\n\n pc\n end",
"def eql? other\n object_id == other.object_id || \n (self.class == other.class &&\n specification == other.specification && \n candidate_types == other.candidate_types && \n candidate_types_excluded == other.candidate_types_excluded && \n candidate_objects == other.candidate_objects && \n join_points_matched == other.join_points_matched &&\n join_points_not_matched == other.join_points_not_matched)\n end",
"def owner_preference?\n owner_uniq_favorite_vote&.value&.>= Vote.owner_id_min_confidence\n end",
"def is?(other = nil)\n if other\n RubyVersion == other\n else\n RubyVersion\n end\n end",
"def candidate\n self['candidate']\n end",
"def accepted?\n return listing.accepted_proposal_id == id\n end",
"def reviewing?(other_user)\n reviewing.include?(other_user)\n end",
"def match(other)\n solve == other.solve\n end",
"def <=>(other)\n owner.pref_label <=> other.owner.pref_label\n end",
"def which_profile(other_user)\n #Currently runs two database queries to return the viewable profile of the other...can it be done faster/more efficiently?\n return self.next_closest_profile(self.which_ring(other_user))\n\n # if other_user == self\n # return this_profile(1)\n # elsif is_mutual_friend?(other_user) == true \n # friendship_ring = self.which_ring(other_user)\n # return this_profile(friendship_ring)\n # else\n # return self.profiles.find_by_ring(self.preference.rings)\n # end\n end",
"def compatible_with?(other)\n composition == other.composition\n end",
"def winner?(pet)\n raise \"#{pet} was not in this contest\" unless in_contest?(pet)\n winner_id == pet.id\n end",
"def succeeds?(other)\n range_precedes(other, self)\n end",
"def kind_of?(other)\n super || __getobj__.kind_of?(other)\n end",
"def who_is_it(opponent)\n opponent.user == current_user\n end",
"def applicable?\n true\n end",
"def applicable?\n true\n end",
"def opponent_of(pet)\n raise \"#{pet} was not in this contest\" unless in_contest?(pet)\n return challenger if pet.id != challenger.id\n challenged\n end",
"def candidate\n candidates.first\n end",
"def same_suit?(other)\n @suit == other.suit\n end",
"def chosen_drink_category\n @user_delivery_preferences = DeliveryPreference.find_by_user_id(self.id)\n if @user_delivery_preferences.beer_chosen == true\n return \"beer\"\n elsif @user_delivery_preferences.cider_chosen == true\n return \"cider\"\n end\n end",
"def accepted?\n verdict && verdict.accepted?\n end",
"def IS?(other, bidirectional: true)\n (@it == other) && (bidirectional ? (other == @it) : true)\n end",
"def pref?\n type? 'PREF'\n end",
"def allowed?(val)\r\n return @candidates.include?(val)\r\n end",
"def has_category_as_preference(category)\n self.categories.include?(category)\n end",
"def conflict?(other)\n return false unless self.class == other.class\n self.eql?(other) && self != other\n end",
"def chosen_provider\n if cpi = store[:chosen_provider_id] and cpi.to_s.to_sym == :deferred\n return false\n else\n User.where(id: store[:chosen_provider_id] || store[:chosen_provider_selection_id], business_id: business.id).first\n end\n end",
"def include?(other)\n cover?(other) && precision == other.precision\n end",
"def amicable_with?(other)\n factors.reduce(:+) == other &&\n other.factors.reduce(:+) == self &&\n self != other\n end",
"def same(other) \n self.suit == other.suit && self.rank == other.rank\n end",
"def eql?(other)\n self.suit == other.suit && self.value == other.value\n end",
"def choose(one, two, prioritize)\n return nil if one.nil? && two.nil?\n\n case\n when one == two\n one\n when one.nil?\n two\n when two.nil?\n one\n when ACCEPTED.any? { |word| one.end_with?(word) }\n ACCEPTED.each do |word|\n one.sub!(word, '')\n end\n one\n when ACCEPTED.any? { |word| two.end_with?(word) }\n ACCEPTED.each do |word|\n two.sub!(word, '')\n end\n two\n when REJECTED.any? { |word| two.end_with?(word) }\n one\n when REJECTED.any? { |word| one.end_with?(word) }\n two\n else\n other = one == prioritize ? two : one\n puts \" #{prioritize} (#{other})\" if Viva::DEBUG\n prioritize\n end\n end",
"def vote?\n !@proposal.nil? && !@user.nil? && \\\n !@proposal.votes.where(user_id: @user.id).exists?\n end",
"def ==(other_card)\n self.face == other_card.face \n end",
"def voted_by?(voter)\n up_voted?(voter) || down_voted?(voter)\n end",
"def determine_game_winner(p1, p2)\n winning_choices = {spock: [\"scissors\", \"rock\"], paper: [\"rock\", \"spock\"], scissors: [\"paper\", \"lizard\"], rock: [\"scissors\", \"lizard\"], lizard: [\"spock\", \"paper\"]}\n \n if p1.move == p2.move\n winner = Player.new(\"Neither\")\n elsif\n winning_choices[p1.move.to_sym].include?(p2.move.to_s)\n winner = p1\n else\n winner = p2\n end\n winner.score += 1\n return winner\n end",
"def has_been_proposed?(person)\n @matches.each do |_,v|\n return true if v == person\n end\n false\n end",
"def is_a?(other)\n if other == Mongoid::Boolean || other.class == Mongoid::Boolean\n return true\n end\n super(other)\n end",
"def candidate_qualifies?(candidate)\n checkLanguages = ['Ruby', 'Python']\n\n if candidate[:languages].select{ |language| checkLanguages.include? language }\n language = true\n else\n language = false\n end\n\n experienced = experienced? candidate\n\n\n experienced &&\n candidate[:github_points] >= 100 &&\n language &&\n candidate[:date_applied] > Date.today - 15 &&\n candidate[:age] > 17\nend",
"def look_same_as?(other)\n return nil unless other.kind_of?(self.class)\n (name == other.name) and (definition == other.definition)\n end",
"def kind_of?(other)\n super || object.kind_of?(other)\n end",
"def preferred\n return !!@discovery_document['preferred']\n end",
"def __accepted__\n defined?(accepted) ? accepted : false\n end",
"def relevant?\n @relevant.nil? ? true : @relevant\n end",
"def ==(other)\n if @rank == other.rank && @suit == other.suit\n return true\n else\n return false\n end\n end",
"def preference(value)\n fresh.tap do |criteria|\n criteria.preference_value = value\n end\n end",
"def include?(other, result_age = nil)\n return false unless other\n\n abilities_include?(other) &&\n ages_include?(other, result_age) &&\n equipment == other.equipment &&\n (men? || other.women?) &&\n (!weight? || weight == other.weight)\n end",
"def evaluate(control, candidate)\n control == candidate ? :match : :mismatch\n end",
"def other_user_profile?\n !is_owner\n end",
"def same_color?(other_suit)\n (black? && other_suit.black?) || (red? && other_suit.red?)\n end",
"def is_associated_to_somebody_else_than(another_user)\n !!(\n another_user && # User exists...\n another_user.swimmer && # It has a swimmer associated...\n @swimmer && # Ditto for this strategy's object...\n @swimmer.associated_user && # ...And their are different gogglers:\n (@swimmer.associated_user_id != another_user.id) &&\n (@swimmer.id != another_user.swimmer_id) # (additional and redundant integrity check)\n )\n end",
"def allows_comment?(a_person=nil)\n (self.active? || self.accepted?)\n end",
"def best_match_from(other)\n other.max_by do |their_type|\n best_type = self.by_precedence.find do |our_type|\n their_type =~ our_type\n end\n if best_type.nil?\n 0\n else\n best_type.quality * their_type.quality\n end\n end\n end",
"def same_suit?(other)\n if self.wild? || other.wild?\n return true \n end\n self.suit == other.suit\n end",
"def advising?(other_user)\n advisees.include?(other_user)\n end",
"def is_preferred\n attributes.fetch(:isPreferred)\n end",
"def different_color?(other_suit)\n (black? && other_suit.red?) || (red? && other_suit.black?)\n end",
"def custom_compare(a, b)\n\t\t@criteria.each do |criterion|\n\t\t\tcomparison = apply_criterion(criterion,a,b)\n\t\t\treturn comparison unless comparison.zero?\n\t\tend\n\t\t# None of the criteria resulted in non-zero. Attempt default comparison.\n\t\tbegin\n\t\t\ttie_breaker = { :expression => :itself, :options => make_options({}) }\n\t\t\treturn apply_criterion(tie_breaker,a,b)\n\t\trescue\n\t\t\treturn 0\n\t\tend\n\tend",
"def donating_to?(other_user)\n return true if self.donating_to == (other_user)\n end",
"def propose_to( other )\n proposals << other\n other.respond_to_proposal_from self\n end",
"def favoriter?\n true\n end",
"def isChoicePotentialCompletion(derivedChoice, token)\n if token.nil?\n return true\n end\n derivedChoice.start_with? token\n end",
"def applicable?\n adjustment_source && adjustment_source.eligible?(order) && super\n end",
"def poll_author?\n self.answer_choice.question.poll.author_id\n end",
"def result # :nodoc:\n winning_strategy && winning_strategy.result\n end",
"def competitor_has_result?(competitor)\n competitor.scores.any?\n end",
"def ==(other)\n return false unless other\n return false unless other.respond_to?(:target_org)\n return @target_org == other.target_org && @feeling == other.feeling \n end",
"def other_party(person)\n person == starter ? listing.author : starter\n end",
"def eql?(anOther)\n\t\tself == anOther\n\tend",
"def candidates_included_in_all_the_others(candidates_in_correct_position)\n\tcandidates_in_correct_position.each do |small|\n\t\tok = true\n\t\tcandidates_in_correct_position.each do |big|\n\t\t\tif small!=big\n\t\t\t\tunless big.source.position.include?(small.source.position)\n\t\t\t\t\tok = false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn small if ok\n\tend\n\tnil\nend",
"def one?(parameter, other)\n (send(parameter)) ^ (other.send(parameter))\n end",
"def overridden_by_department?(cop); end",
"def competitor_has_result?(competitor)\n competitor.external_result.try(:active?)\n end",
"def is_approved?\n self.approved == 'approved'\n end",
"def like?(other)\n if other.respond_to?(:simplified)\n @simplified == other.simplified\n else\n @simplified == Type.simplified(other)\n end\n end",
"def ==(other)\n cmp?(__method__, coerce(other))\n end",
"def negotiate_best_deal?\n nil\n end"
] | [
"0.7430928",
"0.636545",
"0.6227747",
"0.62044257",
"0.61707366",
"0.6098413",
"0.60582626",
"0.6042046",
"0.5794268",
"0.5698413",
"0.5522648",
"0.5522648",
"0.5487993",
"0.54670405",
"0.5453134",
"0.54225063",
"0.54152876",
"0.5410544",
"0.5353254",
"0.5337093",
"0.53259563",
"0.530087",
"0.52667344",
"0.52629167",
"0.5216789",
"0.52009434",
"0.5196835",
"0.5167267",
"0.5149986",
"0.5133277",
"0.51277196",
"0.51103854",
"0.5094131",
"0.5092509",
"0.5091844",
"0.5084784",
"0.5081134",
"0.5078374",
"0.50783056",
"0.5046543",
"0.50462496",
"0.5043421",
"0.5032429",
"0.5016849",
"0.5011208",
"0.4991849",
"0.49905488",
"0.49871543",
"0.49765635",
"0.4972401",
"0.49710757",
"0.49668685",
"0.4962839",
"0.49617317",
"0.4952716",
"0.49406856",
"0.49256057",
"0.4913328",
"0.49127102",
"0.4908779",
"0.490387",
"0.4901109",
"0.4900387",
"0.48979568",
"0.48875597",
"0.48868674",
"0.48794565",
"0.48781648",
"0.48758197",
"0.48706868",
"0.48686776",
"0.48640206",
"0.48630124",
"0.4856687",
"0.48491368",
"0.48429394",
"0.4842701",
"0.48381922",
"0.48364007",
"0.48363835",
"0.48265076",
"0.48154312",
"0.48153302",
"0.48098144",
"0.48072177",
"0.48052752",
"0.48028",
"0.48020765",
"0.47991848",
"0.47939962",
"0.47848606",
"0.4776094",
"0.47715166",
"0.4770813",
"0.4769825",
"0.4761931",
"0.47594514",
"0.47577506",
"0.47560233",
"0.47547925"
] | 0.686246 | 1 |
Track that a proposal was made then ask the other Candidate to respond to a proposal ARG: `other` another Candidate instance | def propose_to( other )
proposals << other
other.respond_to_proposal_from self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than any other match?\n when better_match?( other )\n free!\n match! other\n\n else\n false\n end\n end",
"def propose! other\n if other.single?\n #first engagement for other\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n current_pref = other.pref_list.preference_of(other.engaged_to)\n my_pref = other.pref_list.preference_of(self)\n #the lower the index, the more preferred\n if my_pref < current_pref\n #found better matching\n other.jilt!\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n #reject this engagement\n return false\n end\n end\n end",
"def vote( to_proposal )\r\n sender = @voters[msg.sender]\r\n assert sender.voted? == false && to_proposal < @proposals.length\r\n sender.voted = true\r\n sender.vote = to_proposal\r\n @proposals[to_proposal].vote_count += sender.weight\r\nend",
"def chosen(already, owner, other)\n\t\tif already && already.owner_id == owner.id && current_user\n\t\t\t\"chosen\"\n\t\telse\n\t\t\tother\n\t\tend\n\tend",
"def delegate( to )\r\n sender = @voters[msg.sender] # assigns reference\r\n assert sender.voted? == false\r\n\r\n while @voters[to].delegate != Address(0) && @voters[to].delegate != msg.sender do\r\n to = @voters[to].delegate\r\n end\r\n assert to != msg.sender\r\n\r\n sender.voted = true\r\n sender.delegate = to\r\n delegate_to = @voters[to]\r\n if delegate_to.voted\r\n @proposals[delegate_to.vote].vote_count += sender.weight\r\n else\r\n delegate_to.weight += sender.weight\r\n end\r\nend",
"def new_proposal(proposal)\n @proposals = proposal\n mail to: proposal.user.email, subject: \"Thanks for submitting your proposal\"\n end",
"def inform_goal_of_new_contribution\n self.goal.check_for_completion!(self.goal_participant)\n end",
"def enqueue_communications_decision(token, player, target = nil)\n raise 'Only Game or action resolvers should call this method' if token != @action_token\n @communications_available.sort_by!(&:role)\n @upcoming_decisions.unshift(lambda {\n Decision.single_player(\n current_turn.id, player, \"Pick a card for #{target ? target.to_s : 'yourself'}?\",\n choices: @communications_available.each_with_index.map { |card, i|\n if (giver = @communications_assignments[card][0]) == player\n text = \"Yours\"\n elsif giver\n text = \"From #{giver}\"\n else\n text = \"Drawn\"\n end\n [\"pick#{i + 1}\", Choice.new(\"Pick #{card} (#{text})\") { cb_communications_assign(target || player, card) }]\n }.to_h\n )\n })\n end",
"def candidate_interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Congrats!! You have been selected for an Interview\"\n \n mail to: @candidate.email, subject: subject\n end",
"def try_to_convince_other_responders(poll)\n\t\tif poll.expert_user == self\n\t\t\t# Create a hash to remember who will have been convinced\n\t\t\thash = Hash.new()\n\t\t\tpoll.questions.each do |question|\n\t\t\t\tcurrent_array = Array.new()\n\t\t\t\thash.store(question.id, current_array)\n\n\t\t\t\tpoll.participants.each do |participant|\n\t\t\t\t\t# Save current choice in history\n\t\t\t\t\tparticipant.chosen_answer_for_question(question).history_be_chosen_by!(participant)\n\n\t\t\t\t\tunless participant == self\n\t\t\t\t\t\tunless participant.chosen_answer_for_question(question) == self.chosen_answer_for_question(question)\n\t\t\t\t\t\t\tif random_number_is_under(self.influence)\n\t\t\t\t\t\t\t\t# The participant has changed his mind\n\t\t\t\t\t\t\t\tparticipant.chosen_answer_for_question(question).be_not_chosen_by!(participant)\n\t\t\t\t\t\t\t\t# He chooses the answer chosen by the expert\n\t\t\t\t\t\t\t\tself.chosen_answer_for_question(question).be_chosen_by!(participant)\n\t\t\t\t\t\t\t\t# Add the convinced user to the hash\n\t\t\t\t\t\t\t\tcurrent_array.push(participant.first_name + \" \" + participant.name)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Returns hash\n\t\thash\n\tend",
"def create\n @vote.proposal = @proposal\n @vote.user = current_user\n @comment = @proposal.comments.new\n\n respond_to do |format|\n if @vote.save\n InformCommitteeMembers.vote_submitted(@vote)\n format.html { redirect_to @proposal, notice: 'Vote was successfully created.' }\n format.json { render json: @proposal, status: :created, location: @proposal }\n else\n format.html { render \"proposals/show\" }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vote proposal, values=[], options={}\n return unless proposal\n return unless proposal.is_a?(VoteProposal)\n # return if values.blank?\n values = [values] if values.is_a?(VoteProposalOption)\n status = options[:status]\n action = options[:action] || :add\n\n voting_users = [self]\n voting_users += mandates_from.to_a\n voting_users.map do |user|\n vote = user.vote_in_proposal(proposal) \n if not vote\n user.create_vote proposal, values, status, self\n else\n if user != self and user.has_voted?(proposal)\n # if we are voting for mandate giver but user has already\n # voted by itself do nothing \n else\n # Currently only one option is give at a time.\n option = values.first\n if vote.vote_proposal_options.detect {|opt| opt.id == option.id }\n remove_vote_option vote, [option], self\n else\n add_vote_option vote, [option], self\n end\n end\n end\n end\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 admin_candidate_interview_status_change(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Candidate has \" + @interview.candidate_status + \" interview request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end",
"def set_proposal\n @proposal = Proposal.includes(:requirements).find(params[:id])\n end",
"def prevent_self\n if current_user.proposals.include?(@proposal)\n redirect_to reviewer_event_proposals_path\n end\n end",
"def tender_proposal_choosen_as_best(the_request, the_proposal)\n @request = the_request\n @proposal = the_proposal\n mail(:to => @proposal.user.email,\n :subject => \"L'utente #{@request.user.login} ha scelto una tua offerta come migliore per la sua richiesta numero #{@request.id}\"\n )\n end",
"def absorb other\n self.about = other.about if self.about.blank?\n other.touched_pointers.each { |ref| touch ref.entity, ref.in_collection }\n other.followees.each { |followee| self.add_followee followee }\n other.followers.each { |follower| follower.add_followee self }\n other.votings.each { |voting| vote(voting.entity, voting.up) } # Transfer all the other's votes\n super\n end",
"def notify_requester(needs_review, comment)\n if proposal.requester != comment.user\n if needs_review == true\n ProposalMailer.\n proposal_updated_needs_re_review(proposal.requester, proposal, comment).\n deliver_later\n else\n ProposalMailer.\n proposal_updated_no_action_required(proposal.requester, proposal, comment).\n deliver_later\n end\n end\n end",
"def after_accepted\n # repute points\n self.repute_accept\n \n # cash rewards\n if self.kase && self.kase.offers_reward?\n self.kase.rewards.active.each do |reward|\n reward.cash!\n end\n end\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def candidate\n @candidate\n end",
"def interview_status_change(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request - \" + @interview.status\n \n mail to: @employer.email, subject: subject\n end",
"def modify_project_proposal1\n project_proposal = ProjectProposal.find(params[:project_proposal_id])\n if project_proposal.present?\n #conversation = Conversation.find(project_proposal.conversation_id)\n revison = project_proposal.create_proposal_revisions current_filmmaker, params[:description]\n if revison.present?\n revison.create_modified_proposal_milestones\tparams[:milestones]\n end\n content = render_to_string( layout: false, partial: \"/filmmakers/proposal_content\", locals: { project_proposal: project_proposal })\n #current_client.reply_to_conversation(conversation, content)\n #redirect_to :back\n end\n redirect_to :back, notice: \"Proposal has been modified!\"\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def set_proposal\n @proposal = Proposal.find(params[:id])\n end",
"def ==(other)\n @candidate == other.candidate\n end",
"def set_other\n @other = Other.find(params[:id])\n end",
"def is_approvable_by(another_user)\n return false unless is_associated_to_somebody_else_than(another_user)\n\n existing_friendship = @swimmer.associated_user.find_any_friendship_with(another_user)\n !!(\n existing_friendship &&\n existing_friendship.pending? &&\n (existing_friendship.friend_id == another_user.id) # Another user is the one *receiving* the invite\n )\n end",
"def update_vote\n @to_vote = PaperproposalVote.find(params[:id])\n @to_vote.update_attributes(params[:paperproposal_vote])\n @paperproposal = @to_vote.paperproposal\n\n unless @to_vote.save\n flash[:error] = @to_vote.errors\n redirect_to :profile\n end\n\n if @to_vote.vote == \"reject\"\n @paperproposal.board_state = \"re_prep\"\n @paperproposal.lock = false\n @paperproposal.save\n end\n\n all_none_votes = @paperproposal.paperproposal_votes.select{|vote| vote.vote == \"none\"}\n all_reject_votes = @paperproposal.paperproposal_votes.select{|vote| vote.vote == \"reject\"}\n\n if all_none_votes.empty? & all_reject_votes.empty?\n case @paperproposal.board_state\n when \"submit\"\n prepare_data_request_for_accept_state\n when \"accept\"\n @paperproposal.board_state = \"final\"\n @paperproposal.lock = false\n @paperproposal.save\n @paperproposal.datasets.each do |context|\n context.accepts_role! :proposer, @paperproposal.author\n end\n else\n #do nothing\n end\n end\n redirect_to :profile\n end",
"def accepted(opportunity_id, profile_id)\n @opportunity = Opportunity.find(opportunity_id)\n @profile = Profile.find(profile_id)\n mail(to: [@opportunity.user.email, @profile.user.email], subject: 'A Candidate has accepted your invitation to participate in a MOBEEAS Opportunity')\n end",
"def new_advicepost_accepted_advisor(advisor)\n @advisor = advisor\n mail to: @advisor.email, subject: \"New advice listing accepted\"\n end",
"def send_candidate_details(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n #changed title as per Task #41\n subject = \"Candidate has \" + @interview.candidate_status + \" your interview request\"\n #subject = \"Candidate Profile - \" + @candidate.name\n \n mail to: @employer.email, subject: subject\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def agree\n \n worker = current_worker.id\n req = params[:request]\n if not (Proposal.exists?(worker_id: worker, request_id: req))\n #@shd = Schedule.create(:worker_id => worker, :customer_id => client_id, :request_id => req, :date => fecha)\n @shd = Proposal.create(worker_id: worker, request_id: req)\n end\n\n redirect_to tecnico_agenda_trabajos_path\n\n end",
"def set_candidate\n @candidate = Candidate.find_by id: params[:id]\n authorize @candidate\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def accept_request(other_user)\n\t\treceived_relationships.find_by(friend_active_id: other_user.id).update_attribute(:accepted, true)\n\tend",
"def another_pet\n\t\tputs \"Would you like to see another pet?\"\n\t\tanswer = gets.chomp.downcase\n\t\tcase answer \n\t\t\twhen \"yes\" then adopt(Pet.new)\n\t\t\twhen \"no\"\n\t\t\t\tputs \"Here is a copy of your adoption records.\"\n\t\t\t\tputs $record_keeper\n\t\t\telse\n\t\t\t\tputs \"Pardon?\"\n\t\t\t\tanother_pet\n\t\tend\n\tend",
"def set_candidate\n @candidate = params[:id] ? Candidate.find(params[:id]) : Candidate.new(candidate_params)\n end",
"def tender_new_proposal_for_request_owner_email(the_request, the_proposal)\n @request = the_request\n @proposal = the_proposal\n mail(:to => @request.user.email,\n :subject => \"L'utente #{@proposal.user.login} ha postato una nuova offerta per la tua richiesta numero #{@request.id}\"\n )\n end",
"def update\n respond_to do |format|\n if @proposal.accepted == true\n format.html { redirect_to @proposal, notice: 'The Proposal Can Not Be Changed After It Has Been Assigned' }\n end\n unless params[:proposal][:bts].nil? || params[:proposal][:bts].count == 0\n @proposal.bts.clear\n params[:proposal][:bts].each do |bt|\n @proposal.bts << bt\n end\n end\n unless params[:proposal][:focus_points].nil? || params[:proposal][:focus_points].count == 0\n @proposal.focus_points.clear\n params[:proposal][:focus_points].each do |fp|\n @proposal.focus_points << fp\n end\n end\n if @proposal.update(proposal_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposal }\n else\n format.html { render :edit }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n @candidate = Candidate.includes(:user, :resume).find(params[:id])\n end",
"def propose\n response = CoachClient::Request.put(url, username: @user1.username,\n password: @user1.password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotProposed.new(self), 'Could not propose partnership'\n end\n set_user_confirmed(response.to_h)\n self\n end",
"def notify\n reviewers = proposal.reviewers.reject{|r| r.id == user_id }\n Notification.create_for(reviewers, proposal: proposal, message: \"Internal comment on #{proposal.title}\")\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_proposal\n unless params[:id].nil?\n @proposal = Proposal.find(params[:id])\n else\n @proposal = Proposal.find(params[:proposal_id])\n end\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def new\n @proposal = current_user.proposals.build\n end",
"def on_receive\n # handle wrong session and extract value\n tmp = self.value.split(\":\")\n return if $sessionID != tmp[0].to_i\n self.value = tmp[1..-1].join(\":\")\n if self.value == \"\" then self.value = nil end\n # get on with the real work\n\n if self.id == $currentProposalID\n $numAcceptances += 1\n if not self.value.nil?\n $acceptances.push(eval(self.value)) # self.value is of the form [id,val]\n end\n self.state_changed(\"promise recorded for #{self.id} with value #{self.value}\")\n if $numAcceptances > $connector.size.to_f / 2\n bestVal = $acceptances.max_by {|x| x[0]} [1] # defaults to nil\n self.state_changed(\"quorum reached for #{self.id} with value #{bestVal}\")\n $connector.each do |c|\n msg = AcceptRequestMessage.new($currentProposalID, \"#{$sessionID}:#{bestVal}\")\n msg.conn = c\n c.send_data(msg.to_sendable)\n c.dispatch_event(:on_send, [msg])\n end\n end\n end\n end",
"def prepare_data_request_for_accept_state\n authors_of_data_columns_request = @paperproposal.author_paperproposals\n # Todo erstmal alle\n #.select{|element| element.kind == \"main\"}\n data_request_votes = authors_of_data_columns_request.\n map{|adr| PaperproposalVote.new(:user => adr.user, :project_board_vote => false)}\n @paperproposal.paperproposal_votes << data_request_votes\n @paperproposal.board_state = \"accept\"\n unless @paperproposal.save\n flash[:errors] = @paperproposal.errors.full_messages\n end\n end",
"def create\n @proposal = listing.proposals.build(params[:proposal])\n\n #prolly a better way to do this\n @proposal.proposer_id = current_user.id\n\n respond_to do |format|\n if @proposal.save\n format.html { redirect_to listing_proposal_url(@listing, @proposal), notice: 'Proposal was successfully created.' }\n format.json { render json: @proposal, status: :created, location: @proposal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept!(person, message=nil)\n if (in_dispute_period? || contested?) && person_can_respond?(person) && response_for(person) != true\n message = nil if message.blank?\n self.class.transaction do\n BountyClaimEvent::BackerAccepted.create!(\n bounty_claim: self,\n person: person,\n description: message\n )\n response = BountyClaimResponse.find_or_create_by_claim_and_person(self, person, true, message)\n\n self.reload\n end\n end\n end",
"def tender_proposal_discarded_as_best(the_request, the_proposal)\n @request = the_request\n @proposal = the_proposal\n mail(:to => @proposal.user.email,\n :subject => \"L'utente #{@request.user.login} ha scelto un'altra offerta come migliore per la sua richiesta numero #{@request.id}\"\n )\n end",
"def admitcard\n @events_candidate = @event.events_candidates.where(:candidate_id => @candidate.id).first\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def show\n @proposal = Proposal.find(params[:id])\n\n @proposal.votes.each do |v|\n if v.user == current_user\n @vote = v\n end\n end\n if can? :vote, @proposal\n if @vote.nil?\n @vote = @proposal.votes.new\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n unless current_user.proposals.map {|p| p.id.to_s} .include? @proposal.id.to_s\n redirect_to proposal_path, :flash => { :error => 'Sem permissão, proposta não é sua.'}\n return\n end\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\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: \"takeoff@interviewjet.com\", subject: subject\n \n \n end",
"def create_peer_ship\n\t\tif self.replied == true\n\t\t\tuser_id = self.user_id\n\t\t\tuser2_id = self.to\t\t\t\n\t\t\tPeership.create(:user_id => user_id, :user2_id => user2_id) unless Peership.exists?(user_id, user2_id) \t\t\t\n\t\tend\n\t\t#Delete request object unless user did not make a selection \n\t\tPeerRequest.destroy(self.id) unless self.replied == nil \t\t\n\tend",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end",
"def update\n @proposal = Proposal.find(params[:id])\n old_priority = @proposal.priority\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n new_priority = @proposal.priority\n\n # insert proposal in order \n if new_priority > old_priority\n @proposal.insert_at_priority(@proposal.priority, \"ASC\")\n else\n @proposal.insert_at_priority(@proposal.priority, \"DESC\")\n end\n\n format.html { redirect_to proposals_path, notice: 'Proposal was successfully created.' }\n format.json { head :no_content }\n else\n format.html { redirect_to proposals_path, notice: 'Proposal submission unsuccessful, most probably because of duplication. ' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_candidate\n \t@election = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Role::Candidate.includes(:person).find(params[:id])\n end",
"def setup( num_proposals )\r\n @chairperson = msg.sender\r\n @voters = Mapping.of( Address => Voter )\r\n @proposals = Array.of( Proposal, num_proposals )\r\n\r\n @voters[@chairperson].weight = 1\r\nend",
"def vote(candidates) sleep(1) end",
"def current_partner_voucher\n if (partner_voucher = current_voucher) && current_voucher.is_a?(PartnerMembershipVoucher)\n partner_voucher.consignee_confirmation = @person if @person\n partner_voucher\n end\n end",
"def waiver_submitted\n requested_decision\n end",
"def set_pay_other\n @pay_other = PayOther.find(params[:id])\n end",
"def donate_to(other_user)\n self.create_active_donorship(donated_to_id: other_user.id)\n end",
"def set_vote_candidate\n @vote_candidate = VoteCandidate.find(params[:id])\n end",
"def proposals_by_person(person)\n person=Person.find_by_id(person) if person.is_a? Fixnum\n self.proposals.select {|p| p.people.include? person}\n end",
"def accepted_receiver\n self.receiver ||= if accepted_response = self.responses.accepted.first\n accepted_response.person\n end\n end",
"def announce\n cli.say \"Preparing a pull request for #{config.github_repo}/#{git.current_branch} to #{config.github_repo}/#{destination_branch}.\"\n end",
"def accept_candidate\n authorize(@job_candidate)\n @job_candidate.accepted!\n tracker = Mixpanel::Tracker.new(ENV[\"NT_MIXPANEL_TOKEN\"])\n tracker.track('employer-' + current_employer.email, 'accepted candidate')\n CandidateMailer.send_job_hire(@job_candidate.candidate.email, @job_candidate.job).deliver_later\n redirect_to employer_jobs_path, notice: 'Successfully accepted, an email was sent to the candidate.'\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def challenged!\n user.challenge_for_pet(pet_contests.last)\n end",
"def submit\n @proposal = current_user.proposals.find(params[:id])\n\n if request.post?\n @proposal.submit!\n\n redirect_to proposals_path\n end\n end",
"def sign_agreement_update\n @candidate = Candidate.find(params[:id])\n @is_verify = false\n rendered_called = agreement_update_private(\n Candidate.covenant_agreement_event_key,\n 'signed_agreement',\n I18n.t('label.sign_agreement.signed_agreement')\n )\n return if rendered_called\n\n @resource = @candidate\n render :sign_agreement\n end",
"def create\n @proposal = Proposal.new(params[:proposal])\n @proposal.group_id = current_user.my_group.id\n\n # check of duplicate proposal by the same group for the same project\n # done in the model\n\n if @proposal.description.blank?\n redirect_to :back, notice: \"Cannot submit an empty project bid\"\n return \n else\n\n respond_to do |format|\n if @proposal.save\n\n # insert proposal in order \n @proposal.insert_at_priority(@proposal.priority)\n\n format.html { redirect_to proposals_path, notice: 'Proposal was successfully created.' }\n format.json { render json: @proposal, status: :created, location: @proposal }\n else\n format.html { redirect_to proposals_path, notice: 'Proposal submission unsuccessful, most probably because of duplication. ' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def respond_to_partnership_request_from(matchable)\r\n if unmatched?\r\n Marry::Me.logger.debug \"#{self} accepts partnership with #{matchable}\"\r\n match_with(matchable)\r\n elsif better_partner? matchable\r\n Marry::Me.logger.debug \"#{self} has left #{@partner} for #{matchable}\"\r\n @partner.free\r\n match_with matchable\r\n else\r\n Marry::Me.logger.debug \"#{self} rejects partnership with #{matchable}\"\r\n end\r\n end"
] | [
"0.7188241",
"0.6226746",
"0.6129741",
"0.5652433",
"0.557418",
"0.5371597",
"0.5369692",
"0.5364737",
"0.53149235",
"0.5302787",
"0.5280947",
"0.52681935",
"0.5231875",
"0.52081865",
"0.51805854",
"0.51798797",
"0.5179091",
"0.517543",
"0.51699144",
"0.51572734",
"0.5151744",
"0.51472914",
"0.5142851",
"0.51339203",
"0.51271933",
"0.51271933",
"0.51271933",
"0.51271933",
"0.51271933",
"0.51271933",
"0.51271933",
"0.51236266",
"0.5122709",
"0.5113617",
"0.509271",
"0.5070407",
"0.50675964",
"0.50655234",
"0.5056109",
"0.5056109",
"0.5052721",
"0.5028864",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.5011023",
"0.50108534",
"0.50016606",
"0.5001257",
"0.49987647",
"0.4986344",
"0.49814495",
"0.49810606",
"0.49741107",
"0.49724418",
"0.49669912",
"0.49659327",
"0.49659327",
"0.49659327",
"0.49620786",
"0.4961969",
"0.496001",
"0.4959275",
"0.4949758",
"0.49319732",
"0.4927843",
"0.49162316",
"0.491169",
"0.489608",
"0.48834008",
"0.48769224",
"0.48764455",
"0.4875011",
"0.48687276",
"0.48659894",
"0.48535216",
"0.48332363",
"0.48305833",
"0.48298943",
"0.48282847",
"0.48274863",
"0.4825364",
"0.48199463",
"0.48148108",
"0.48050743",
"0.48035935",
"0.47960198",
"0.47943354",
"0.47863728",
"0.47783124",
"0.477831",
"0.47780383"
] | 0.7088853 | 1 |
Given another candidate, respond properly based on current state ARG: `other` another Candidate instance | def respond_to_proposal_from( other )
case
# Is there a preference for the candidate?
when !prefers?( other )
false
# Are there available positions for more matches?
when free?
match! other
# Is the passed Candidate a better match than any other match?
when better_match?( other )
free!
match! other
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chosen(already, owner, other)\n\t\tif already && already.owner_id == owner.id && current_user\n\t\t\t\"chosen\"\n\t\telse\n\t\t\tother\n\t\tend\n\tend",
"def ==(other)\n @candidate == other.candidate\n end",
"def candidate\n @candidate\n end",
"def absorb other\n self.about = other.about if self.about.blank?\n other.touched_pointers.each { |ref| touch ref.entity, ref.in_collection }\n other.followees.each { |followee| self.add_followee followee }\n other.followers.each { |follower| follower.add_followee self }\n other.votings.each { |voting| vote(voting.entity, voting.up) } # Transfer all the other's votes\n super\n end",
"def method_missing(name, *args, &block)\n @candidate.send(name, *args, &block)\n end",
"def set_other\n @other = Other.find(params[:id])\n end",
"def accepts?(other)\n true\n end",
"def update\n @candidate = @alliance.candidates.find(params[:id])\n\n authorize! :update, @candidate\n\n if @candidate.log_and_update_attributes(candidate_params)\n flash[:notice] = \"Muutokset tallennettu.\"\n else\n flash[:alert] = \"Muutosten tallentaminen epäonnistui!\"\n render :action => :edit and return\n end\n\n respond_with(@alliance) do |format|\n format.html { redirect_to advocates_alliance_path(@alliance) }\n end\n end",
"def set_candidate\n @candidate = params[:id] ? Candidate.find(params[:id]) : Candidate.new(candidate_params)\n end",
"def propose! other\n if other.single?\n #first engagement for other\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n current_pref = other.pref_list.preference_of(other.engaged_to)\n my_pref = other.pref_list.preference_of(self)\n #the lower the index, the more preferred\n if my_pref < current_pref\n #found better matching\n other.jilt!\n @engaged_to = other\n other.engaged_to = self\n return true\n else\n #reject this engagement\n return false\n end\n end\n end",
"def another_pet\n\t\tputs \"Would you like to see another pet?\"\n\t\tanswer = gets.chomp.downcase\n\t\tcase answer \n\t\t\twhen \"yes\" then adopt(Pet.new)\n\t\t\twhen \"no\"\n\t\t\t\tputs \"Here is a copy of your adoption records.\"\n\t\t\t\tputs $record_keeper\n\t\t\telse\n\t\t\t\tputs \"Pardon?\"\n\t\t\t\tanother_pet\n\t\tend\n\tend",
"def set_candidate\n @candidate = Candidate.find_by id: params[:id]\n authorize @candidate\n end",
"def collision(other)\n\t\tif other.is_a?(Torpedo)\n\t\t\tother.collision(self)\n\t\tend\n\tend",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def initialize candidate, options = {}\n raise \"Candidate must be something!\" if !candidate\n @candidate, @options = candidate, options\n execute\n end",
"def handle_winner(p1,p2)\n winner = winner?(p1,p2)\n if winner == p1\n give_cards_to_winner(p1, p2)\n p1.take_own_hand\n elsif winner == p2\n give_cards_to_winner(p2, p1)\n p2.take_own_hand\n end\n end",
"def candidate?\n !!candidate\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:candidate_id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def propose_to( other )\n proposals << other\n other.respond_to_proposal_from self\n end",
"def verify_hand_off_to(other)\n raise ArgumentError, \"cannot hand off to node: #{other} because it is useful\" unless other.useless?\n raise ArgumentError, \"uncompatible handoff between #{self} and #{other}\" unless compatible_handoff?(other)\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def set_candidate\n @candidate = Candidate.find(params[:id])\n end",
"def connects?(other)\n other &&\n (self == other ||\n (suited? &&\n suit == other.suit &&\n (rank - other.rank).abs <= 2))\n end",
"def respond_to_partnership_request_from(matchable)\r\n if unmatched?\r\n Marry::Me.logger.debug \"#{self} accepts partnership with #{matchable}\"\r\n match_with(matchable)\r\n elsif better_partner? matchable\r\n Marry::Me.logger.debug \"#{self} has left #{@partner} for #{matchable}\"\r\n @partner.free\r\n match_with matchable\r\n else\r\n Marry::Me.logger.debug \"#{self} rejects partnership with #{matchable}\"\r\n end\r\n end",
"def match!( other )\n return false unless prefers?( other ) && !matched?( other )\n matches << other\n other.matches << self\n end",
"def validate_other!(other)\n if other.kind_of?(self.class)\n raise ArgumentError, \"other #{self.class} must belong to the same repository\" unless other.resource.repository == @resource.repository\n elsif !other.kind_of?(Hash)\n raise ArgumentError, \"other must be a #{self.class} or Hash object\"\n end\n end",
"def run_candidate\n candidate.call\n end",
"def choose_winner; end",
"def set_candidate\n \t@election = Candidate.find(params[:id])\n end",
"def victor\n return @attack_initiator if @attack_initiator.soldiers_alive.count > 0\n return @other_army if @other_army.soldiers_alive.count > 0\n end",
"def validate!(candidate)\n if candidate.class != env.response_type\n fail BadResponseProto, \"Expected response to be of type #{env.response_type.name} but was #{candidate.class.name}\"\n end\n\n candidate\n end",
"def conversar(person_one, person_two)\n person_one.hablar\n person_two.hablar\nend",
"def decide!\n return if not (consider = self.current_state.decisions)\n consider.each {|decision| break if process_decision!(decision) }\n self.current_state.name\n end",
"def switch_choice\n pokemon_to_send = @visual.show_pokemon_choice\n if pokemon_to_send\n pokemon_to_switch = @logic.battler(0, @player_actions.size)\n # The player made a choice we store the action and we check if he can make other choices\n @player_actions << { type: :switch, who: pokemon_to_switch, with: pokemon_to_send }\n pokemon_to_send.switching = true\n pokemon_to_switch.switching = true\n log_debug(\"Action : #{@player_actions.last}\") if debug? # To prevent useless overhead outside debug\n @next_update = can_player_make_another_action_choice? ? :player_action_choice : :trigger_all_AI\n else\n # If the player canceled we return to the player action\n @next_update = :player_action_choice\n end\n end",
"def opponent_of(pet)\n raise \"#{pet} was not in this contest\" unless in_contest?(pet)\n return challenger if pet.id != challenger.id\n challenged\n end",
"def equal?(other)\n raise \"Incident is not complete\" unless complete? && other.complete?\n\n screener.target.equal?(other.screener) &&\n general_info.target.equal?(other.general_info) &&\n involved_civilians.zip(other.involved_civilians).all? { |c1, c2| c1.equal? c2 } &&\n involved_officers.zip(other.involved_officers).all? { |o1, o2| o1.equal? o2 }\n end",
"def set_candidate\n @candidate = Role::Candidate.includes(:person).find(params[:id])\n end",
"def set_s_other\n @s_other = SOther.find(params[:id])\n end",
"def match(other)\n solve == other.solve\n end",
"def candidate(&block)\n @candidate = block if block\n @candidate\n end",
"def set_other_revision\n @other_revision = params[:revision] ? find_revision(params[:revision]) : @revisions.first\n end",
"def candidate\n self['candidate']\n end",
"def update\n respond_to do |format|\n if @candidate.update(permitted_attributes @candidate)\n format.html { redirect_to @candidate, notice: \"Candidate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n if @candidate.update_attributes(params[:candidate])\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def try_to_convince_other_responders(poll)\n\t\tif poll.expert_user == self\n\t\t\t# Create a hash to remember who will have been convinced\n\t\t\thash = Hash.new()\n\t\t\tpoll.questions.each do |question|\n\t\t\t\tcurrent_array = Array.new()\n\t\t\t\thash.store(question.id, current_array)\n\n\t\t\t\tpoll.participants.each do |participant|\n\t\t\t\t\t# Save current choice in history\n\t\t\t\t\tparticipant.chosen_answer_for_question(question).history_be_chosen_by!(participant)\n\n\t\t\t\t\tunless participant == self\n\t\t\t\t\t\tunless participant.chosen_answer_for_question(question) == self.chosen_answer_for_question(question)\n\t\t\t\t\t\t\tif random_number_is_under(self.influence)\n\t\t\t\t\t\t\t\t# The participant has changed his mind\n\t\t\t\t\t\t\t\tparticipant.chosen_answer_for_question(question).be_not_chosen_by!(participant)\n\t\t\t\t\t\t\t\t# He chooses the answer chosen by the expert\n\t\t\t\t\t\t\t\tself.chosen_answer_for_question(question).be_chosen_by!(participant)\n\t\t\t\t\t\t\t\t# Add the convinced user to the hash\n\t\t\t\t\t\t\t\tcurrent_array.push(participant.first_name + \" \" + participant.name)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Returns hash\n\t\thash\n\tend",
"def enqueue_communications_decision(token, player, target = nil)\n raise 'Only Game or action resolvers should call this method' if token != @action_token\n @communications_available.sort_by!(&:role)\n @upcoming_decisions.unshift(lambda {\n Decision.single_player(\n current_turn.id, player, \"Pick a card for #{target ? target.to_s : 'yourself'}?\",\n choices: @communications_available.each_with_index.map { |card, i|\n if (giver = @communications_assignments[card][0]) == player\n text = \"Yours\"\n elsif giver\n text = \"From #{giver}\"\n else\n text = \"Drawn\"\n end\n [\"pick#{i + 1}\", Choice.new(\"Pick #{card} (#{text})\") { cb_communications_assign(target || player, card) }]\n }.to_h\n )\n })\n end",
"def assert_valid_other(other)\n unless other.repository == repository\n raise ArgumentError, \"+other+ #{self.class} must be for the #{repository.name} repository, not #{other.repository.name}\"\n end\n\n unless other.model == model\n raise ArgumentError, \"+other+ #{self.class} must be for the #{model.name} model, not #{other.model.name}\"\n end\n end",
"def choose(one, two, prioritize)\n return nil if one.nil? && two.nil?\n\n case\n when one == two\n one\n when one.nil?\n two\n when two.nil?\n one\n when ACCEPTED.any? { |word| one.end_with?(word) }\n ACCEPTED.each do |word|\n one.sub!(word, '')\n end\n one\n when ACCEPTED.any? { |word| two.end_with?(word) }\n ACCEPTED.each do |word|\n two.sub!(word, '')\n end\n two\n when REJECTED.any? { |word| two.end_with?(word) }\n one\n when REJECTED.any? { |word| one.end_with?(word) }\n two\n else\n other = one == prioritize ? two : one\n puts \" #{prioritize} (#{other})\" if Viva::DEBUG\n prioritize\n end\n end",
"def is_other?\n\t\tkey == 'other'\n\tend",
"def is_other?\n\t\tkey == 'other'\n\tend",
"def with_candidates &b\n # Multiple assignment reduces (s)teps while debugging\n outermost, @candidates, @on_admission = @candidates.nil?, (@candidates || []), (@on_admission || [])\n begin\n b.call\n rescue Exception\n # Do not accept any of these candidates, there was a problem:\n @candidates = [] if outermost\n raise\n ensure\n if outermost\n while @candidates\n # Index the accepted instances in the constellation:\n candidates = @candidates\n on_admission = @on_admission\n @candidates = nil\n @on_admission = nil\n candidates.each do |instance|\n instance.class.index_instance(self, instance)\n loggers.each{|l| l.call(:assert, instance.class, instance.identifying_role_values)}\n end\n on_admission.each do |b|\n b.call\n end\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n format.html { redirect_to @candidate, notice: \"Candidate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @candidate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def adopt_state(other_customer)\n Utils.assert_type(other_customer, \"other_customer\", Hash)\n\n res = Rx::AsyncSubject.new\n retrieve_id.subscribe_on_completed do\n _adopt_state(other_customer)\n .as_observable\n .subscribe(\n ->(payload) { res.on_next(payload) },\n ->(err) { res.on_error(err) },\n -> { res.on_completed }\n )\n end\n\n res\n end",
"def result(my_choice, opponent_choice, result)\n #puts \"#{my_choice} #{opponent_choice} #{@last_opponent_choice} #{result}\"\n @last_opponent_choice = opponent_choice\n end",
"def update_other\n mrts_qcksnd_update_other\n @sunk = @character.sunk if @character.is_a?(Game_Player)\n end",
"def pick_confirmation_name\n @candidate = Candidate.find(params[:id])\n @resource = @candidate\n end",
"def update\n authorize @other\n respond_to do |format|\n if @other.update(other_params)\n format.html { redirect_to others_url, notice: t('Record has been saved') }\n format.json { render :show, status: :ok, location: @other }\n else\n format.html {\n @other.d_names.build if @other.d_names.blank?\n render :edit\n }\n format.json { render json: @other.errors, status: :unprocessable_entity }\n end\n end\n end",
"def compatible_handoff?(other)\n (normal? and other.normal?) or\n ((not normal?) and (not other.normal?))\n end",
"def test_candidate_as_authorized_actor\n candidate = Candidate.new\n as_anything_goes_user do\n candidate.save!\n end\n \n assert_raises(ArgumentError){\n AuthorizedActor.current_actor = candidate\n }\n end",
"def accept_request(other_user)\n\t\treceived_relationships.find_by(friend_active_id: other_user.id).update_attribute(:accepted, true)\n\tend",
"def choose(message = nil, *choices, &block)\n say message if message\n super(*choices, &block)\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n set_questionnaire\n format.html { redirect_to candidates_url, notice: \"Candidate was successfully updated.\" }\n else\n format.html { redirect_to edit_candidate_url(@candidate), alert: @candidate.errors.full_messages.first }\n end\n end\n end",
"def update\n @other = Other.find(params[:id])\n\n respond_to do |format|\n if @other.update_attributes(params[:other])\n flash[:notice] = 'Other was successfully updated.'\n format.html { redirect_to(@other) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @other.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def eql? other\n object_id == other.object_id || \n (self.class == other.class &&\n specification == other.specification && \n candidate_types == other.candidate_types && \n candidate_types_excluded == other.candidate_types_excluded && \n candidate_objects == other.candidate_objects && \n join_points_matched == other.join_points_matched &&\n join_points_not_matched == other.join_points_not_matched)\n end",
"def choose(choice)\n return nil unless started? && decision_ready?(choice)\n\n update!(current_event: choice.outcome)\n current_event\n end",
"def accept!\n self.state = :accepted\n end",
"def in_contest?(pet)\n pet.id == challenger.id || pet.id == challenged.id\n end",
"def set_candidate\n @candidate = Candidate.includes(:user, :resume).find(params[:id])\n end",
"def or(other)\n other\n end",
"def pick_confirmation_name_update\n @candidate = Candidate.find(params[:id])\n\n render_called = event_with_picture_update_private(PickConfirmationName)\n\n @resource = @candidate\n render :pick_confirmation_name unless render_called\n end",
"def admin_candidate_interview_status_change(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Candidate has \" + @interview.candidate_status + \" interview request\"\n \n mail to: \"takeoff@interviewjet.com\", subject: subject\n \n \n end",
"def update\n if @candidate.update(candidate_params)\n redirect_to (current_user.role == 'candidate' ? root_path : @candidate), notice: 'Candidate was successfully updated.'\n else\n render :edit\n end\n end",
"def create\n @candidate = Candidate.new(candidate_params)\n\n unless check_elector\n return\n end\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @vote_candidate\n respond_to do |format|\n if @vote_candidate.update(vote_candidate_params)\n format.html { redirect_to @vote_candidate, notice: 'Vote candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @vote_candidate }\n else\n format.html { render :edit }\n format.json { render json: @vote_candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delegate( to )\r\n sender = @voters[msg.sender] # assigns reference\r\n assert sender.voted? == false\r\n\r\n while @voters[to].delegate != Address(0) && @voters[to].delegate != msg.sender do\r\n to = @voters[to].delegate\r\n end\r\n assert to != msg.sender\r\n\r\n sender.voted = true\r\n sender.delegate = to\r\n delegate_to = @voters[to]\r\n if delegate_to.voted\r\n @proposals[delegate_to.vote].vote_count += sender.weight\r\n else\r\n delegate_to.weight += sender.weight\r\n end\r\nend",
"def update\n @candidate = Candidate.find(params[:id])\n\n if @candidate.update_attributes(params[:candidate])\n redirect_to admin_candidates_path, notice: 'Candidate was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @candidate.update(candidate_params)\n flash[:success] = 'Candidate was successfully updated'\n format.html { redirect_to edit_candidate_path(@candidate), notice: 'Candidate was successfully updated.' }\n format.json { render :show, status: :ok, location: @candidate }\n else\n flash[:failure] = 'Candidate updation unsuccessful'\n format.html { render :edit }\n format.json { render json: @candidate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accepted_receiver\n self.receiver ||= if accepted_response = self.responses.accepted.first\n accepted_response.person\n end\n end",
"def decision_for_new_turn(player)\n choices = @actions.select { |a| a.timing == :main_action }.map { |action|\n choice = Choice.new(action.name_and_effect, action.arguments) { |args| cb_action(player, action, args) }\n last_player = @turns.size >= 2 ? @turns[-2].active_player : nil\n\n if player.coins >= 10 && action != Action::Coup\n choice.unavailable!('You must Coup when you have at least 10 coins.')\n elsif player.coins < action.cost + tax_for(player, action)\n choice.unavailable!(\"Need #{format_costs(player, action).join(' and ')}\")\n elsif last_player == player && action.another_turn?\n choice.unavailable!('Would cause three turns in a row')\n end\n\n [action.slug, choice]\n }.to_h\n\n # If player has a disappear token, add the block option.\n if (disappear_action = @disappear_players[player])\n action_class = disappear_action.class\n tax = tax_for(player, action_class)\n name = action_class.flavor_name\n choice = Choice.new(\"Block #{name}#{\" (tax of #{tax} coin)\" if tax > 0}\") {\n cb_block_disappear(player, disappear_action, start_turn: true)\n }\n choice.unavailable!(\"Need #{format_costs(player, action_class)}\") if player.coins < tax\n choices['block'] = choice\n end\n\n Decision.single_player(\n current_turn.id, player, \"#{player}'s turn to choose an action\",\n choices: choices,\n )\n end"
] | [
"0.58686155",
"0.56267965",
"0.54296243",
"0.5399437",
"0.5344745",
"0.5316683",
"0.531268",
"0.52848715",
"0.5253057",
"0.523432",
"0.5177804",
"0.51527923",
"0.5124434",
"0.511018",
"0.511018",
"0.50795925",
"0.5076306",
"0.50705546",
"0.50595284",
"0.50595284",
"0.50595284",
"0.50576985",
"0.5055668",
"0.5046794",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5038877",
"0.5031105",
"0.50246924",
"0.5023231",
"0.5001198",
"0.49927554",
"0.49890563",
"0.49869117",
"0.49292243",
"0.49227926",
"0.49220443",
"0.4916597",
"0.49071315",
"0.48986086",
"0.48888963",
"0.4886779",
"0.48867396",
"0.48845372",
"0.48798215",
"0.4863874",
"0.48634663",
"0.48533037",
"0.483706",
"0.48349378",
"0.4809438",
"0.47989643",
"0.478682",
"0.4783049",
"0.4783049",
"0.4780479",
"0.4780427",
"0.4780427",
"0.4780427",
"0.4780427",
"0.4780427",
"0.4780427",
"0.4780427",
"0.4769316",
"0.4745029",
"0.47370827",
"0.47354063",
"0.47312495",
"0.47291973",
"0.47199833",
"0.47164014",
"0.47134992",
"0.4709833",
"0.4707125",
"0.4702117",
"0.46919802",
"0.4691192",
"0.4690597",
"0.4675356",
"0.46715516",
"0.46675918",
"0.46649355",
"0.46630794",
"0.4662858",
"0.46573496",
"0.46523958",
"0.46352792",
"0.46290562",
"0.46287605",
"0.46267465",
"0.46241882"
] | 0.68670064 | 0 |
ensure version is in "x.x.x" format | def normalize_version(str)
default = "0.0.1"
if str.nil? or str.empty?
default
elsif str.match /^(\d)+[.](\d)+[.](\d)+$/
str
elsif str.match /^((\d)+[.])*(\d)+$/
fix_version(str)
else
raise VersionError, "need a valid version number of the form 0.0.0"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_version(v)\n return true if (!version || version[0..4].gsub(\".\",\"\").to_i>=v)\n return false\n end",
"def valid_version?(arg)\n return true if arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def version_mismatch_detected\n end",
"def valid_version?(arg)\n return true if arg == false || arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def valid_version?(version)\n version =~ /\\d+\\.\\d+\\.\\d+(\\.(alpha|beta|rc)(\\.\\d+)?)?/\nend",
"def clean_version(version)\n version.gsub!(/\\A(?:version|v)\\s*/i, '') # deletes leading v or version, eg: 'v1.2.3', 'Version 1.2'\n version.gsub!(/[\\r\\n]/, '') # deletes new lines chars\n version.gsub!(/\\s+/, '-') # replaces all spaces by '-'\n version.gsub!(/[\\.]{2,}/, '.') # replaces more than one consecutive dots by one dot, eg: '0..2.1'\n\n version = \"0#{version}\" if version[0] == '.' # adds leading 0 if first char is a dot, eg: '.2.3'\n\n version\n end",
"def checkversion(major,minor,options=nil)\n caller[0]=~/`(.*?)'/\n caller_func=$1\n\n raise ZbxAPI_ExceptionVersion, \"#{caller_func} requires API version #{major}.#{minor} or higher\" if major>@major\n raise ZbxAPI_ExceptionVersion, \"#{caller_func} requires API version #{major}.#{minor} or higher\" if minor>@minor\n\n end",
"def osgi_version_for(version)\n parts = version.split(/[\\.,-]/)\n result = Array.new(3, 0)\n parts.each_index { |i|\n if (result.size == 3) then\n if (parts[i] =~ /\\d+/) then result[i] = parts[i] else result = result << parts[i] end\n else\n result[3] = [result[3], parts[i]].join(\"-\")\n end\n }\n result.join(\".\")\nend",
"def has_version?; end",
"def choose_version(version)\n if version =~ /(\\d+)\\.(\\d+)\\.(\\d+)/\n major = $1\n minor = $2\n patch = $3\n if config[:major]\n major = major.to_i + 1\n minor = 0\n patch = 0\n end\n if config[:minor]\n minor = minor.to_i + 1\n patch = 0\n end\n patch = patch.to_i + 1 if config[:patch]\n version = \"#{major}.#{minor}.#{patch}\"\n Chef::Log.debug(\"New version is #{version}\")\n else\n Chef::Log.error(\"Version is in a format I cannot auto-update\")\n exit 1\n end\n version\n end",
"def version_check\n version = params[:version]\n return render :status=>400, :json=>{:message=>\"The request must contain the a version number.\"} if version.blank?\n\n #check against current major version of app\n v = version.split(\".\")[0]\n if CURRENT_MAJOR_VERSION.to_i > v.to_i\n render :status=>600, :json=>{:status => \"Needs to upgrade to latest major version\"}\n return\n end\n render :status=>200, :json=>{:status => \"Success\"}\n end",
"def validate_version(version)\n return if SemanticPuppet::Version.valid?(version)\n\n err = \"version string cannot be parsed as a valid Semantic Version\"\n raise ArgumentError, \"Invalid 'version' field in metadata.json: #{err}\"\n end",
"def version!\r\n fail\r\n end",
"def breaking_changes?(version)\n\t\t\tDownloadTV::VERSION.split(\".\").zip(version.split(\".\")).find_index { |x, y| y > x }&.< 2\n\t\tend",
"def bump\n parts = parse_parts_from_version_string\n parts.pop while parts.any? { |part| part.alpha? }\n parts.pop if parts.size > 1\n parts[-1] = parts[-1].succ\n self.class.new(parts.join(\".\"))\n end",
"def major_version(full_version)\n full_version.match(/^(\\d+\\.\\d+\\.\\d+)\\.\\d+$/)[1]\n end",
"def major_version\n version.match(/(\\d\\.\\d)/)[0] if name.is_a? String\n end",
"def validate_namecoind(wanted_version = 32190)\n version = NMCC.getinfo['version']\n\n if version == wanted_version\n true\n else\n warn \"namecoind version is #{version}, but we usually work with version #{wanted_version}\"\n end\nrescue => ex\n warn \"validate_namecoind failed: #{ex}\"\n exit\nend",
"def jamm_version(version)\n case version.to_s.strip\n when /^0.[0-7]/\n '0.2.5'\n when /^0.8/\n '0.2.2'\n when /^1|^2.0/\n '0.2.5'\n when /^2.1.[0-1]$/\n '0.2.6'\n when /^2.1.[2-3]$/\n '0.2.8'\n when /^2.1/\n '0.3.1'\n when /^2.2/\n '0.3.1'\n when /^3.[0-9]/\n '0.3.1'\n end\nend",
"def version(arg = nil)\n set_or_return(:version,\n arg,\n kind_of: String,\n default: 'latest',\n callbacks: {\n \"Valid versions are 'latest' or 'x.y.z'\" =>\n ->(a) { valid_version?(a) }\n })\n end",
"def requires_version(cmd, version_)\n v = check_version(version_)\n unless v[0]\n raise NoMethodError, format('%s is not supported in Bugzilla %s', cmd, v[1])\n end\n end",
"def safe_version(version_name)\n \t _version = send(version_name) if respond_to?(version_name)\n \t \n\t unless _version.nil? || File.exist?(_version.path)\n\t \trecreate_versions!(version_name)\n\t end\n\t _version\n end",
"def client_meta_version(version)\n regexp = /^([0-9]+\\.[0-9]+\\.[0-9]+)(\\.?[a-z0-9.-]+)?$/\n match = version.match(regexp)\n return \"#{match[1]}p\" if (match[2])\n\n version\n end",
"def safe_explicit(version)\n return version if version.to_s == ''\n\n test_version = `bundle #{version} --version`.include?('Could not find command')\n test_version ? '' : version\n end",
"def major(version)\n res = 0\n res = Regexp.last_match(1) if version =~ /^\\s*(\\d+)\\.\\d+\\.\\d+/\n res\n end",
"def next_version\n # x.y.z\n v = version.split '.'\n # bump z\n v[-1] = v[-1].to_i + 1\n v.join '.'\nend",
"def _validate_version(v)\n if v.to_s.empty?\n results.add_error('version', 'A version is required.')\n elsif v <= Version::ZERO\n results.add_error('version', 'The version of the spec should be' \\\n ' higher than 0.')\n end\n end",
"def patch(version)\n res = 0\n res = Regexp.last_match(1) if version =~ /^\\s*\\d+\\.\\d+\\.(\\d+)/\n res\n end",
"def set_version(value)\n if value.nil?\n @version = 'latest'\n else\n return skip_resource 'Invalid character in version' unless value.to_s =~ /^(latest|[\\d\\.-]+)$/\n @version = value\n end\n end",
"def valid_version?\n !statement[\"ver\"].empty?\n end",
"def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end",
"def read_version\n # The version string is usually in one of the following formats:\n #\n # * 4.1.8r1234\n # * 4.1.8r1234_OSE\n # * 4.1.8_MacPortsr1234\n #\n # Below accounts for all of these:\n execute(\"--version\").split(\"_\")[0].split(\"r\")[0]\n end",
"def version_constraint(gem_name); end",
"def get_version(version)\n \"V#{version.gsub('-','_')}\"\n end",
"def check_current_version!\n minimum_version = get('minimum_version')\n return if Gem::Dependency.new('', \">= #{minimum_version}\")\n .match?('', VERSION)\n\n raise ClientTooOldError,\n 'The .importjs.json file you are using requires version ' \\\n \"#{get('minimum_version')}. You are using #{VERSION}.\"\n end",
"def validate_version!(version = nil)\r\n if version && (version.to_i <= 0 || version.to_i > @@maximum_version)\r\n raise InvalidVersion, \"no version #{version.inspect} in API\"\r\n end\r\n\r\n if version.nil? || version > versions.keys.max\r\n version = versions.keys.max\r\n end\r\n\r\n if versions[version] == false\r\n raise InvalidVersion, \"no version #{version.inspect} on #{self}\"\r\n end\r\n\r\n version\r\n end",
"def full_version\n return nil unless exact\n\n \"~> \".concat(version)\n end",
"def ensure_version!(version_number, platform: nil)\n if (e = edit_version(platform: platform))\n if e.version.to_s != version_number.to_s\n # Update an existing version\n e.version = version_number\n e.save!\n return true\n end\n return false\n else\n create_version!(version_number, platform: platform)\n return true\n end\n end",
"def compare_version(remote_version)\n re = /(\\d+)\\./\n remote_version && re.match(remote_version)[1] != re.match(Replica.version)[1] \n end",
"def major_version(version = nil)\n version ||= installed_version?\n return \"0\" if version.nil?\n\n version.sub(/(\\.\\d+)+$/, '')\n end",
"def test_rubygems_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :rubygems), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :==, ::Versionomy.parse('1.2b3'))\n end",
"def version_less_than_seventeen?\n verify_gem_version(celluloid_version, '0.17', operator: '<')\n end",
"def bump_major_version; end",
"def validate!(version)\n unless version.nil? || registered?(version)\n raise NotRegistered.new(\"#{version} is not a valid API version.\")\n end\n end",
"def to_version_string(version)\n version = version.to_s\n if version.match(/\\./)\n version\n else\n from_version_code(version).to_s\n end\n end",
"def major_version; end",
"def have_version?(major, minor = nil, update = nil, build = nil)\n if major.class == Float\n major = major.to_s\n end\n if major.class == String\n major,minor,update = major.split('.').collect { |x| x.to_i }\n end\n if major == @major\n return false if minor != nil && minor != @minor\n return false if update != nil && update != @update\n return false if build != nil && build != @build\n return true\n else\n return false\n end\n end",
"def test_that_it_should_bump_versions\r\n v = Bumper::Version.new\r\n assert_equal '1', v.bump_build\r\n assert_equal '0.0.0.1', v.to_s\r\n assert_equal 1, v.bump_patch\r\n assert_equal '0.0.1.0', v.to_s\r\n assert_equal 1, v.bump_minor\r\n assert_equal '0.1.0.0', v.to_s\r\n assert_equal 1, v.bump_major\r\n assert_equal '1.0.0.0', v.to_s\r\n end",
"def test_rubygems_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :rubygems), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2', :rubygems), :>, ::Versionomy.parse('1.2b1'))\n end",
"def version?(version)\n !!version_named(version.to_sym)\n end",
"def restrictive_version_specified_gem?(node); end",
"def version?(name)\n Shrine.deprecation(\"Shrine.version? is deprecated and will be removed in Shrine 3.\")\n version_names.nil? || version_names.map(&:to_s).include?(name.to_s)\n end",
"def check_version(api_version, backend_version)\n s_major, s_minor, s_fix = api_version.split('.')\n b_major, b_minor, b_fix = backend_version.split('.')\n\n unless s_major == b_major\n message = \"Backend reports API_VERSION=#{backend_version} and cannot be loaded because SERVER_API_VERSION=#{api_version}\"\n Rails.logger.error \"[#{self}] #{message}\"\n fail Errors::BackendApiVersionMismatchError, message\n end\n\n unless s_minor == b_minor\n Rails.logger.warn \"[#{self}] Backend reports API_VERSION=#{backend_version} and SERVER_API_VERSION=#{api_version}\"\n end\n\n true\n end",
"def test_parsing_with_string\n value_ = ::Versionomy.parse('1.9.2.pre.2', :rubygems)\n assert_equal([1, 9, 2, 'pre', 2, 0, 0, 0], value_.values_array)\n assert_equal('1.9.2.pre.2', value_.unparse)\n end",
"def version\n @version ||= if token.nil? || Array(packages).empty?\n '0.1.0'\n else\n packages.map do |p|\n Gem::Version.new(p['version'])\n end.sort.last.bump.to_s << '.0'\n end\n end",
"def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\nrescue Versionomy::Errors::ParseError\n return nil\nend",
"def version_for(version_string)\n Mixlib::Versioning.parse(version_string)\n end",
"def is_version(string)\n return false if string === false || string === true || string.nil?\n string.to_s.match(/^\\d+[\\d\\.a-zA-Z\\-_~]*/)\n end",
"def version\n '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit>\n end",
"def current_version\r\n version = File.read(\"VERSION\").strip\r\n fail \"Invalid version information\" unless version =~ /\\./\r\n version\r\nend",
"def valid?(ver)\n !!(ver =~ /\\A#{REGEX_FULL}\\Z/)\n end",
"def check_version_or_latest_version(version = nil)\n version ||= latest_version\n raise Ajaxlibs::Exception::VersionNotFound unless self.class::Versions.include?(version)\n version\n end",
"def is_bad_version(n)\r\n return true if n > 3\r\n false\r\nend",
"def check_banner(ip, version)\n version =~ /libssh[_-]?([\\d.]*)$/ && $1 && (v = Gem::Version.new($1))\n\n if v.nil?\n vprint_error(\"#{ip}:#{rport} - #{version} does not appear to be libssh\")\n Exploit::CheckCode::Unknown\n elsif v.to_s.empty?\n vprint_warning(\"#{ip}:#{rport} - libssh version not reported\")\n Exploit::CheckCode::Detected\n elsif v.between?(Gem::Version.new('0.6.0'), Gem::Version.new('0.7.5')) ||\n v.between?(Gem::Version.new('0.8.0'), Gem::Version.new('0.8.3'))\n vprint_good(\"#{ip}:#{rport} - #{version} appears to be unpatched\")\n Exploit::CheckCode::Appears\n else\n vprint_error(\"#{ip}:#{rport} - #{version} appears to be patched\")\n Exploit::CheckCode::Safe\n end\n end",
"def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end",
"def validate_ohai_version!\n unless gem_dep_matches?(\"ohai\", Gem::Version.new(Ohai::VERSION), *ohai_versions)\n raise Exceptions::CookbookOhaiVersionMismatch.new(Ohai::VERSION, name, version, *ohai_versions)\n end\n end",
"def test_semver_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :semver), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2.0', :semver), :>, ::Versionomy.parse('1.2b1'))\n end",
"def test_version\n assert Snarl.version >= '1.1'\n end",
"def parse_version( vers )\n @version_major = nil\n @version_minor = nil\n @version_patch = nil\n @version_extra = nil\n if vers\n vers.match(/(.*)\\.(.*)\\.(\\d*)(.*)/) do |matches|\n @version_major = matches[1]\n @version_minor = matches[2]\n @version_patch = matches[3]\n @version_extra = matches[4]\n end\n @version_plain = \"#{@version_major}.#{@version_minor}.#{@version_patch}\"\n end\n end",
"def test_parsing_with_string\n value_ = ::Versionomy.parse('1.9.2pre2', :semver)\n assert_equal([1, 9, 2, 'pre2'], value_.values_array)\n assert_equal('1.9.2pre2', value_.unparse)\n end",
"def dcl_version(version)\n return '' if version == 'ga'\n return '/beta' if version == 'beta'\n return '/alpha' if version == 'private'\n end",
"def check_versions\n super\n unless (supported_version_ids & Versions::SUPPORTED).length > 0\n raise UnsupportedVersion.new(\"\\nService @ #{@versions_uri} supports: #{supported_version_ids.join(', ')}\\n\" +\n \"Fog::Vcloud::Terremark::Ecloud supports: #{Versions::SUPPORTED.join(', ')}\")\n end\n unless supported_version_ids.include?(@version)\n @version = (supported_version_ids & Versions::SUPPORTED).sort.first\n end\n end",
"def check_version(major_version, minor_version)\n @ole.CheckVersion(major_version, minor_version)\n end",
"def test_parsing_require_all_fields\n value_ = ::Versionomy.parse('2.0', :semver)\n assert_equal([2, 0, 0, ''], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_raises(::Versionomy::Errors::ParseError) do\n value_ = ::Versionomy.parse('2.0b1', :semver)\n end\n end",
"def test_standard_to_rubygems_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2', :rubygems))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.beta.3', :rubygems))\n end",
"def version_gte_82?\n version >= v82\n end",
"def check_versions\n super\n unless (supported_version_ids & Versions::SUPPORTED).length > 0\n raise UnsupportedVersion.new(\"\\nService @ #{@versions_uri} supports: #{supported_version_ids.join(', ')}\\n\" +\n \"Fog::Vcloud::Terremark::Vcloud supports: #{Versions::SUPPORTED.join(', ')}\")\n end\n unless supported_version_ids.include?(@version)\n @version = (supported_version_ids & Versions::SUPPORTED).sort.first\n end\n end",
"def version_check_less_than(version_str_new, version_str_old)\n Gem::Version.new(version_str_old) < Gem::Version.new(version_str_new)\n end",
"def version_tag\n version_composition.join(\".\")\n end",
"def test_prerelease?(version)\n !@version.stable? && @version.major == version.major && @version.minor == version.minor && @version.patch == version.patch\n end",
"def platform_version_mac_os_x(arg)\n arg.match(/^[0-9]+\\.[0-9]+/).to_s\n end",
"def test_standard_to_rubygems_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.beta.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2', :rubygems))\n end",
"def el_min_version?(version)\n self.rhel_family? && FB::Version.new(self['platform_version']) >= self._canonical_version(version)\n end",
"def next_version #:nodoc:\n parts = version.split('.')\n parts[-1] = (parts[-1].to_i + 1).to_s\n parts.join('.')\n end",
"def check_yaml_version(config)\n # If we don't have one specified assume v1\n config[:version] ? config[:version] : \"1.0.0\"\n end",
"def test_it_has_a_version_number\n refute_nil ::ApMessageIo::VERSION\n end",
"def version_tag(text); end",
"def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end",
"def test_standard_to_semver_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0beta3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0', :semver))\n end",
"def version_gte_81?\n version >= v81\n end",
"def sub_version\n \">= \".concat(version.split('.').first(2).join('.'))\n end",
"def test_semver_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :semver), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :==, ::Versionomy.parse('1.2b3'))\n end",
"def process_version(data)\n validate_version(data['version'])\n end",
"def connectorj_ver\n new_resource.url.match(/[0-9]+\\.[0-9]+\\.[0-9]+/)[0]\n end",
"def prerelease?(version)\n !!PRERELEASE_STRINGS.detect do |string|\n version.match(/[^\\w]#{string}[^\\w]/)\n end\n end",
"def version_type(version)\n data = Settings::ProgramSettings.new.parse(\"https://github.com/Ekultek/whitewidow/blob/master/lib/misc/banner.rb\", \"td\", 57)\n arr = data.split(\" \")\n version_number = arr[7][/(\\d+\\.)?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)/]\n if version.count(\".\") <= 2\n return \"stable\".green.bold\n elsif version.length >= 3\n return \"dev\".yellow.bold\n elsif version != version_number\n return \"upgrade available\".red.bold\n else\n return \"unknown version type\".red.bold\n end\n\n end",
"def test_that_it_has_a_version_number\n refute_nil ::Malody::VERSION\n end",
"def get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end",
"def check_versions\n if @version\n unless supported_version_numbers.include?(@version.to_s)\n raise UnsupportedVersion.new(\"#{@version} is not supported by the server.\")\n end\n unless supporting_versions.include?(@version.to_s)\n raise UnsupportedVersion.new(\"#{@version} is not supported by #{self.class}\")\n end\n else\n unless @version = (supported_version_numbers & supporting_versions).sort.first\n raise UnsupportedVersion.new(\"\\nService @ #{@versions_uri} supports: #{supported_version_numbers.join(', ')}\\n\" +\n \"#{self.class} supports: #{supporting_versions.join(', ')}\")\n end\n end\n end",
"def package_version\n @semver.to_s '%M.%m.%p%s'\n end"
] | [
"0.73347974",
"0.7259682",
"0.72094333",
"0.7175039",
"0.70156807",
"0.69588107",
"0.68472767",
"0.68078417",
"0.6803388",
"0.67892855",
"0.6786683",
"0.6756367",
"0.6751995",
"0.6734794",
"0.66410625",
"0.66205883",
"0.6609274",
"0.6573203",
"0.65553063",
"0.6544871",
"0.6534641",
"0.6532574",
"0.65116096",
"0.650953",
"0.65038186",
"0.6496062",
"0.64801383",
"0.643554",
"0.6427664",
"0.6409462",
"0.6404499",
"0.6384397",
"0.6371299",
"0.6360611",
"0.6322831",
"0.63197565",
"0.631692",
"0.62978625",
"0.62851936",
"0.6282679",
"0.6281285",
"0.6275936",
"0.62707096",
"0.62636584",
"0.62579775",
"0.62561405",
"0.62403315",
"0.6236606",
"0.6209749",
"0.6208502",
"0.6198694",
"0.6194098",
"0.6193654",
"0.6193404",
"0.6173109",
"0.61655444",
"0.61552733",
"0.6146918",
"0.6144071",
"0.61432296",
"0.6137741",
"0.6130436",
"0.6127411",
"0.61237",
"0.61230797",
"0.6119052",
"0.61136097",
"0.61058867",
"0.6104098",
"0.60927653",
"0.6092422",
"0.6088638",
"0.60793096",
"0.6071808",
"0.60678065",
"0.6058681",
"0.6054397",
"0.6053933",
"0.604679",
"0.60415864",
"0.6040456",
"0.6038807",
"0.6027435",
"0.6024526",
"0.6021884",
"0.6018728",
"0.6012134",
"0.60058117",
"0.6004127",
"0.59906965",
"0.59893584",
"0.5988672",
"0.5986637",
"0.59856635",
"0.59776473",
"0.5969085",
"0.59671956",
"0.5959881",
"0.59489924",
"0.5947871"
] | 0.7015186 | 5 |
GET /tcm_patient_infos GET /tcm_patient_infos.json | def index
@tcm_patient_infos = TcmPatientInfo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patients\n patients = User.patients\n render json: { status: 200, data: patients }\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n @emergency_contacts = @patient.patient_emergency_contacts\n @progress_notes = @patient.progress_notes\n @intake_notes = @patient.intake_notes\n @treatment_plans = @patient.treatment_plans\n @termination_notes = @patient.termination_notes\n end",
"def detail\n @patient = Patient.find(params[:patient_id])\n end",
"def show\n @owner_patient = OwnerPatient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner_patient }\n end\n end",
"def show\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_history }\n end\n end",
"def index\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_cares = @patient.managed_cares.joins(:subscriber)\n @title = \"Patient Managed Care Information\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managed_cares }\n end\n end",
"def create\n @tcm_patient_info = TcmPatientInfo.new(tcm_patient_info_params)\n\n respond_to do |format|\n if @tcm_patient_info.save\n format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully created.' }\n format.json { render :show, status: :created, location: @tcm_patient_info }\n else\n format.html { render :new }\n format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n patient = get_patient(@body[\"token\"])\n if patient != @patient\n render json: {message: \"failed to authenticate\"}, status: :unprocessable_entity\n else\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n birthday: @patient.birthday,\n sex: @patient.sex,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n end\n end",
"def set_tcm_patient_info\n @tcm_patient_info = TcmPatientInfo.find(params[:id])\n end",
"def tcm_patient_info_params\n params.fetch(:tcm_patient_info, {})\n end",
"def show\n @patient = @client.patients.find(params[:id]) unless current_user.staff?\n @patient = Patient.find(params[:id]) if current_user.staff?\n \n # Build patient history (table) of cases, examinations and treatments\n @patient_history = []\n @patient.accidents.each do |accident|\n record = []\n record[0] = accident.id\n @patient_history << record if accident.chiropractic_examinations.blank?\n accident.chiropractic_examinations.each do |examination|\n record = []\n record[0] = accident.id\n record[1] = examination.id\n @patient_history << record if examination.chiropractic_treatments.blank?\n examination.chiropractic_treatments.each do |treatment|\n record = []\n record[0] = accident.id\n record[1] = examination.id\n record[2] = treatment.id\n @patient_history << record\n end\n end\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patient }\n end\n end",
"def get_patient\n @get_patient ||= patient_service.get(user.icn)\n end",
"def show\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_care = ManagedCare.find(params[:id])\n @show = true\n @title = \"Patient Managed Care Information\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @managed_care }\n end\n end",
"def get_patient\n @patient = Patient.pluck(:id,:name)\n render json: @patient\n end",
"def patientById\n @url = MYHOST + \"/api/patient/data\"\n\n @token = params[:token]\n\n @auth = \"Bearer \" + @token\n @respuesta = HTTParty.get(\n @url.to_str,\n headers: {\n \"Authorization\": @auth\n }\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n end",
"def show\n @patient = Patient.find_by(ssn: params[:id])\n if @patient.present?\n render json: @patient, status: 200\n else\n render nothing: true, status: 204\n end\n end",
"def new\n @owner_patient = OwnerPatient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner_patient }\n end\n end",
"def new\n @pageType = \"new\"\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_care = @patient.managed_cares.new\n @managed_care.patient_id = params[:patient_id]\n @subscriber = @patient.subscribers.all\n @title = \"New Managed Care Information\"\n @providers = @patient.providers\n @groups = @patient.groups \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @managed_care }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n @patients = patient_dashboard\n } \n end \n end",
"def index\n @patients = Patient.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def index\n @patients = Patient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def list\n begin\n doc = healthinfo_doc()\n @patients = Array.new\n doc.find('patient').to_a.each do |p|\n patient = Hash.new\n rn = p.find_first('RN')\n name = p.find_first('PtName')\n if rn and name\n patient[:rn] = rn.content\n patient[:name] = name.content\n @patients.push(patient)\n end\n end \n if @patients.empty?\n redirect_to :action => \"auto_complete_for_patient_rn\", :controller => \"entry/testables\", :pid => params[:id]\n logger.debug \"No matching patients from HIS HealthInfo\"\n return\n end\n rescue Exception => exc\n redirect_to :action => \"auto_complete_for_patient_rn\", :controller => \"entry/testables\", :pid => params[:id]\n logger.warn \"Could not connect to HIS HealthInfo service: #{exc.message}\"\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def new\n @patient = @client.patients.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n @visit = Visit.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def show\n @patient_sample = PatientSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def get_patient_doctor\n begin\n doctor_lists = Doctor.all.map { |doctor| { doctor_id: doctor.id, doctor_name: doctor.name } }\n patient_lists = Patient.all.map { |patient| { patient_id: patient.id, patient_name: patient.name } }\n @msg = { status: STATUS_SUCCESS, doctor_lists: doctor_lists, patient_lists: patient_lists, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end",
"def show\n @patient = Patient.find(params[:id])\n @appointments = @patient.appointments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patient }\n format.xml #show.xml.builder\n end\n end",
"def details_view_patient\n @patient = current_user.user_record\n @appointments = Appointment.all(:conditions => { :patient_id => @patient.id })\n find_reports(current_user.id)\n end",
"def index\n @patients = Patient.order('last_name ASC')\n\n #find the latest patient made\n @id = Patient.maximum(:id)\n if(@id != nil)\n @patient = Patient.find(@id)\n File.open(\"public/patient_info.json\", \"w\"){ |f| f << @patient.to_json}\n end\n end",
"def get_patient(id)\n current_resource_owner.viewable_patients.find_by(id: id)\n end",
"def client_info(patient_id, appointment_date)\n person = ActiveRecord::Base.connection.select_one <<~SQL\n SELECT\n n.given_name, n.family_name, p.birthdate, p.gender,\n i.identifier arv_number, a.value cell_number,\n s.state_province district, s.county_district ta,\n s.city_village village\n FROM person p\n LEFT JOIN person_name n ON n.person_id = p.person_id\n LEFT JOIN patient_identifier i ON i.patient_id = p.person_id\n AND i.voided = 0 AND i.identifier_type = 4\n LEFT JOIN person_attribute a ON a.person_id = p.person_id\n AND a.voided = 0 AND a.person_attribute_type_id = 12\n LEFT JOIN person_address s ON s.person_id = p.person_id\n AND s.voided = 0 WHERE p.person_id = #{patient_id}\n GROUP BY p.person_id, DATE(p.date_created)\n ORDER BY p.person_id, p.date_created;\n SQL\n\n current_outcome = get_current_outcome(patient_id)\n if current_outcome.match(/died/i) || current_outcome.match(/transfer/i) || current_outcome.match(/stop/i)\n return nil\n end\n\n {\n given_name: person['given_name'],\n family_name: person['family_name'],\n birthdate: person['birthdate'],\n gender: person['gender'],\n cell_number: person['cell_number'],\n district: person['district'],\n ta: person['ta'],\n village: person['village'],\n arv_number: (person['arv_number'].blank? ? 'N/A' : person['arv_number']),\n appointment_date: appointment_date.to_date,\n days_missed: days_missed(appointment_date.to_date),\n current_outcome: current_outcome,\n person_id: patient_id\n }\n end",
"def viewable_patients\n jurisdiction.all_patients\n end",
"def new\n @patient_history = PatientHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_history }\n end\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n @medication = @patient.medications.new\n @medications = @patient.medications.paginate(page: params[:page], per_page: 10) \n end",
"def index\n patient = Patient.find(params[:patient_id])\n @patientrecords = patient.patientrecords\n end",
"def index\n @medic_patients = MedicPatient.all\n end",
"def show\n @patientinformation = Patientinformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patientinformation }\n end\n end",
"def show\n @patient_charge = PatientCharge.find(params[:id])\n @patient_payments = @patient_charge.patient_payments\n @patient_payment = PatientPayment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_charge }\n end\n end",
"def index\n \n @patients = nil\n #Fazer a verificação se é neuropsicologo\n if current_login.has_role? :secretary\n logged_user = Secretary.first(:conditions => \"login_id = #{current_login.id}\")\n @patients = Patient.is_active.in_clinic(logged_user.clinic.id).all\n elsif current_login.has_role? :neuropsychologist\n logged_user = Neuropsychologist.first(:conditions => \"login_id = #{current_login.id}\")\n # para obter os pacientes do neuropsicolgo é necessario ir a tabela das sessoes\n appointments = Appointment.where(:neuropsychologist_id => logged_user.id)\n @patients = appointments.collect(&:patient).uniq\n end\n\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def show\n\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def new\n @patient = Patient.new\n @patient.build_person\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def index\n @human = current_user.humen.find(params[:human_id])\n @patients = @human.patients\n end",
"def show\r\n @patient = Patient.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def show\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patent }\n end\n end",
"def new\n @patient = Patient.new\n @ethnicities = Ethnicity.all\n @states = Patient::AVAILABLE_STATES\n @mortality_options = Patient::AVAILABLE_MORTALITY_OPTIONS\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def show\n @medicine_patient_relationship = MedicinePatientRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicine_patient_relationship }\n end\n end",
"def show\n @patient_group = PatientGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_group }\n end\n end",
"def show\n @dtpic = Dtpic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dtpic }\n end\n end",
"def show\n @patient_condition = PatientCondition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patient_condition }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n @patients = @owner.patients.paginate(page: params[:page])\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def update\n respond_to do |format|\n if @tcm_patient_info.update(tcm_patient_info_params)\n format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcm_patient_info }\n else\n format.html { render :edit }\n format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @patients = current_user.patients\n end",
"def details\n {\n patient_id: patient_id || '',\n lab_type: lab_type || '',\n lab_specimen_collection: specimen_collection || '',\n lab_report: report || '',\n lab_result: result || '',\n lab_created_at: created_at || '',\n lab_updated_at: updated_at || ''\n }\n end",
"def new\n @patient_sample = PatientSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n if @patient.save\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n sex: @patient.sex,\n birthday: @patient.birthday,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n else\n render json: @patient.errors, status: :unprocessable_entity\n end\n end",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def index\n if Patient == current_model\n Rails.logger.debug \"--- Looking up top-level patient info ---\"\n @objects = @authorized_user.patients\n elsif params[:patient]\n Rails.logger.debug \"--- Patient specified in request ---\"\n head :unauthorized and return unless can_access_patient?(params[:patient])\n \n @objects = current_model.where(patient_id: params[:patient])\n else\n Rails.logger.debug \"--- Patient implied ---\"\n head :bad_request and return unless patient_implicit?\n \n @objects = current_model.where(patient_id: @authorized_user.patients.first)\n end\n\n respond_to do |format|\n format.json { render json: @objects }\n format.xml { render xml: @objects }\n end\n end",
"def show\n @doctor = Doctor.find(params[:doctor_id])\n @patient = @doctor.patients.find(params[:id])\n end",
"def show\n @hospital = Hospital.find(params[:id])\n # get date - use current month as default\n if params[:theDate]\n @theDate=Date.strptime(params[:theDate],'%d/%m/%y')\n else\n @theDate= Date.today\n end\n\n \n \n # get patients who were in hospital during that month\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hospital }\n end\n end",
"def show\n if Patient == current_model\n Rails.logger.debug \"--- Looking up top-level patient info ---\"\n head :unauthorized and return unless can_access_patient?(params[:id])\n\n @object = current_model.find(params[:id])\n else\n Rails.logger.debug \"--- Patient implied ---\"\n head :bad_request and return unless patient_implicit?\n @object = current_model.find(params[:id])\n\n head :unauthorized and return unless can_access_patient?(@object.patient_id)\n end\n\n respond_to do |format|\n format.json { render json: @object }\n format.xml { render xml: @object }\n end\n end",
"def show\r\n @patient = current_doctor.patients.find(params[:id])\r\n @temperature_thresholds = current_doctor.temperature_thresholds.by_patient(@patient)\r\n @glucose_thresholds = current_doctor.glucose_thresholds.by_patient(@patient)\r\n @bloodpressure_thresholds = current_doctor.bloodpressure_thresholds.by_patient(@patient)\r\n @cardiogram_thresholds = current_doctor.cardiogram_thresholds.by_patient(@patient)\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def details\n {\n patient_id: patient_id || '',\n comment: comment || '',\n created_by: created_by || '',\n history_type: history_type || '',\n history_created_at: created_at || '',\n history_updated_at: updated_at || ''\n }\n end",
"def new\n @patient_charge = PatientCharge.new\n @patient = Patient.find params[:patient_id] unless params[:patient_id].nil?\n @horarios = Array.new\n i = 0\n while i < 13\n if i < 3\n @horarios << \"#{i+8}:00 a.m. - #{i+9}:00 a.m.\"\n elsif i == 4\n @horarios << \"#{i+8}:00 a.m. - #{i-3}:00 p.m.\"\n elsif i > 4\n @horarios << \"#{i-4}:00 p.m. - #{i-3}:00 p.m.\"\n end\n i += 1\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_charge }\n end\n end",
"def index\n @chronics = Chronic.where(\"patient_id = ?\", params[:p_id])\n end",
"def show\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_exercise }\n end\n end",
"def new\n @patientinformation = Patientinformation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patientinformation }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def destroy\n @tcm_patient_info.destroy\n respond_to do |format|\n format.html { redirect_to tcm_patient_infos_url, notice: 'Tcm patient info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def show\n pac_info = PacInfo.find(params[:id])\n render json: pac_info\n end",
"def index\n\t my_uuid = params[:uuid]\n\t\tif my_uuid == nil\n\n\t\t\t@information = Information.all\n\t\telse\n\t\t\t@information = Information.where(uuid: my_uuid).all\n\t\tend\n\t\trespond_with @information\n end",
"def get_patient\n if params[:patient_id]\n session[:patient_id] = params[:patient_id]\n @patient = Patient.find(params[:patient_id])\n elsif session[:patient_id]\n @patient = Patient.find(session[:patient_id])\n else\n @patient = nil\n end\n end",
"def index\n @patients = Patient.paginate(:page => params[:page])\n end",
"def new\r\n @patient = Patient.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end",
"def index\n if params[:search]\n session[:filter] = params[:filter]\n session[:search] = params[:search]\n @patients = @client.patients.where(\"#{params[:filter]} like ?\", \"%#{params[:search]}%\").order('id desc').page(params[:page]).per(15)\n else\n @patients = @client.patients.order('first_name').page(params[:page]).per(15)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def create_patient\n if params[:name].present? and params[:phone_number].present?\n begin\n @patient = Patient.create(params.permit(:name, :phone_number))\n @msg = { status: STATUS_SUCCESS, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email, doctor_lists: Doctor.get_lists, patient_lists: Patient.get_lists, appointments: Appointment.get_lists }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n else\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end",
"def patient_index\n @patient = Patient.find(params[:id])\n @patients_groups = @patient.patients_groups(:joins => :group, :order => \"group.group_name ASC\")\n @title = \"Patient to Group Relationship\"\n session[:return_to] = patients_groups_patients_path(@patient)\n @show = true\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients_groups }\n end\n end",
"def index\n @patients = Patient.all\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n @patientappointmentinfo = Patientappointmentinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patientappointmentinfo }\n end\n end"
] | [
"0.70554125",
"0.67892295",
"0.67892295",
"0.67892295",
"0.67364836",
"0.66602945",
"0.66163933",
"0.6597303",
"0.6548129",
"0.6547083",
"0.65153813",
"0.6514795",
"0.65094537",
"0.64854074",
"0.64829165",
"0.6451389",
"0.6451389",
"0.64378923",
"0.6431249",
"0.6373956",
"0.6369318",
"0.63419044",
"0.63381505",
"0.6299268",
"0.62978965",
"0.62928325",
"0.6286141",
"0.6275334",
"0.6270401",
"0.6268443",
"0.62587327",
"0.6240659",
"0.61941284",
"0.6173569",
"0.61724544",
"0.6162925",
"0.61615974",
"0.6134915",
"0.610584",
"0.6089586",
"0.6084965",
"0.60628814",
"0.60598123",
"0.60538894",
"0.6053508",
"0.6050588",
"0.6033048",
"0.6022081",
"0.6018592",
"0.6009861",
"0.60091317",
"0.5999044",
"0.5995734",
"0.59931755",
"0.5977067",
"0.59676236",
"0.5965825",
"0.5950213",
"0.5941512",
"0.5941032",
"0.59386665",
"0.5931109",
"0.592961",
"0.5925748",
"0.59167075",
"0.5897487",
"0.58911735",
"0.5890525",
"0.5887258",
"0.5862331",
"0.5859125",
"0.5852705",
"0.58510894",
"0.5846227",
"0.58430845",
"0.58389163",
"0.57963973",
"0.5793575",
"0.5789579",
"0.57821554",
"0.57787055",
"0.57787055",
"0.57787055",
"0.57787055",
"0.57787055",
"0.5774527",
"0.5762676",
"0.5725373",
"0.5711443",
"0.5692381",
"0.56832695",
"0.5682044",
"0.5682044",
"0.5682044",
"0.5679682",
"0.56777",
"0.5670172",
"0.5660018",
"0.56597537",
"0.56499386"
] | 0.7402122 | 0 |
GET /tcm_patient_infos/1 GET /tcm_patient_infos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tcm_patient_infos = TcmPatientInfo.all\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def patients\n patients = User.patients\n render json: { status: 200, data: patients }\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def detail\n @patient = Patient.find(params[:patient_id])\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @owner_patient = OwnerPatient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner_patient }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patient }\n end\n end",
"def show\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_history }\n end\n end",
"def patientById\n @url = MYHOST + \"/api/patient/data\"\n\n @token = params[:token]\n\n @auth = \"Bearer \" + @token\n @respuesta = HTTParty.get(\n @url.to_str,\n headers: {\n \"Authorization\": @auth\n }\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end",
"def show\n patient = get_patient(@body[\"token\"])\n if patient != @patient\n render json: {message: \"failed to authenticate\"}, status: :unprocessable_entity\n else\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n birthday: @patient.birthday,\n sex: @patient.sex,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n end\n end",
"def new\n @pageType = \"new\"\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n @emergency_contacts = @patient.patient_emergency_contacts\n @progress_notes = @patient.progress_notes\n @intake_notes = @patient.intake_notes\n @treatment_plans = @patient.treatment_plans\n @termination_notes = @patient.termination_notes\n end",
"def get_patient\n @patient = Patient.pluck(:id,:name)\n render json: @patient\n end",
"def set_tcm_patient_info\n @tcm_patient_info = TcmPatientInfo.find(params[:id])\n end",
"def index\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_cares = @patient.managed_cares.joins(:subscriber)\n @title = \"Patient Managed Care Information\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managed_cares }\n end\n end",
"def new\n @owner_patient = OwnerPatient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner_patient }\n end\n end",
"def show\n @patient = Patient.find_by(ssn: params[:id])\n if @patient.present?\n render json: @patient, status: 200\n else\n render nothing: true, status: 204\n end\n end",
"def show\n @patient_sample = PatientSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n end",
"def show\n @patient = @client.patients.find(params[:id]) unless current_user.staff?\n @patient = Patient.find(params[:id]) if current_user.staff?\n \n # Build patient history (table) of cases, examinations and treatments\n @patient_history = []\n @patient.accidents.each do |accident|\n record = []\n record[0] = accident.id\n @patient_history << record if accident.chiropractic_examinations.blank?\n accident.chiropractic_examinations.each do |examination|\n record = []\n record[0] = accident.id\n record[1] = examination.id\n @patient_history << record if examination.chiropractic_treatments.blank?\n examination.chiropractic_treatments.each do |treatment|\n record = []\n record[0] = accident.id\n record[1] = examination.id\n record[2] = treatment.id\n @patient_history << record\n end\n end\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = @client.patients.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def create\n @tcm_patient_info = TcmPatientInfo.new(tcm_patient_info_params)\n\n respond_to do |format|\n if @tcm_patient_info.save\n format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully created.' }\n format.json { render :show, status: :created, location: @tcm_patient_info }\n else\n format.html { render :new }\n format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n @visit = Visit.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n @patients = patient_dashboard\n } \n end \n end",
"def new\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_care = @patient.managed_cares.new\n @managed_care.patient_id = params[:patient_id]\n @subscriber = @patient.subscribers.all\n @title = \"New Managed Care Information\"\n @providers = @patient.providers\n @groups = @patient.groups \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @managed_care }\n end\n end",
"def index\n @patients = Patient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def index\n @patients = Patient.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def show\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_care = ManagedCare.find(params[:id])\n @show = true\n @title = \"Patient Managed Care Information\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @managed_care }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def get_patient\n @get_patient ||= patient_service.get(user.icn)\n end",
"def index\n @patients = Patient.order('last_name ASC')\n\n #find the latest patient made\n @id = Patient.maximum(:id)\n if(@id != nil)\n @patient = Patient.find(@id)\n File.open(\"public/patient_info.json\", \"w\"){ |f| f << @patient.to_json}\n end\n end",
"def new\n @patient_history = PatientHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_history }\n end\n end",
"def new\n @patient_sample = PatientSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_sample }\n end\n end",
"def show\n @patient = Patient.find(params[:id])\n @appointments = @patient.appointments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patient }\n format.xml #show.xml.builder\n end\n end",
"def new\n @patient = Patient.new\n @patient.build_person\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def get_patient(id)\n current_resource_owner.viewable_patients.find_by(id: id)\n end",
"def list\n begin\n doc = healthinfo_doc()\n @patients = Array.new\n doc.find('patient').to_a.each do |p|\n patient = Hash.new\n rn = p.find_first('RN')\n name = p.find_first('PtName')\n if rn and name\n patient[:rn] = rn.content\n patient[:name] = name.content\n @patients.push(patient)\n end\n end \n if @patients.empty?\n redirect_to :action => \"auto_complete_for_patient_rn\", :controller => \"entry/testables\", :pid => params[:id]\n logger.debug \"No matching patients from HIS HealthInfo\"\n return\n end\n rescue Exception => exc\n redirect_to :action => \"auto_complete_for_patient_rn\", :controller => \"entry/testables\", :pid => params[:id]\n logger.warn \"Could not connect to HIS HealthInfo service: #{exc.message}\"\n end\n end",
"def show\n @patient_group = PatientGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_group }\n end\n end",
"def show\n @patient_condition = PatientCondition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patient_condition }\n end\n end",
"def index\n patient = Patient.find(params[:patient_id])\n @patientrecords = patient.patientrecords\n end",
"def show\n @dtpic = Dtpic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dtpic }\n end\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n @medication = @patient.medications.new\n @medications = @patient.medications.paginate(page: params[:page], per_page: 10) \n end",
"def get_patient_doctor\n begin\n doctor_lists = Doctor.all.map { |doctor| { doctor_id: doctor.id, doctor_name: doctor.name } }\n patient_lists = Patient.all.map { |patient| { patient_id: patient.id, patient_name: patient.name } }\n @msg = { status: STATUS_SUCCESS, doctor_lists: doctor_lists, patient_lists: patient_lists, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end",
"def show\n\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def show\r\n @patient = Patient.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def client_info(patient_id, appointment_date)\n person = ActiveRecord::Base.connection.select_one <<~SQL\n SELECT\n n.given_name, n.family_name, p.birthdate, p.gender,\n i.identifier arv_number, a.value cell_number,\n s.state_province district, s.county_district ta,\n s.city_village village\n FROM person p\n LEFT JOIN person_name n ON n.person_id = p.person_id\n LEFT JOIN patient_identifier i ON i.patient_id = p.person_id\n AND i.voided = 0 AND i.identifier_type = 4\n LEFT JOIN person_attribute a ON a.person_id = p.person_id\n AND a.voided = 0 AND a.person_attribute_type_id = 12\n LEFT JOIN person_address s ON s.person_id = p.person_id\n AND s.voided = 0 WHERE p.person_id = #{patient_id}\n GROUP BY p.person_id, DATE(p.date_created)\n ORDER BY p.person_id, p.date_created;\n SQL\n\n current_outcome = get_current_outcome(patient_id)\n if current_outcome.match(/died/i) || current_outcome.match(/transfer/i) || current_outcome.match(/stop/i)\n return nil\n end\n\n {\n given_name: person['given_name'],\n family_name: person['family_name'],\n birthdate: person['birthdate'],\n gender: person['gender'],\n cell_number: person['cell_number'],\n district: person['district'],\n ta: person['ta'],\n village: person['village'],\n arv_number: (person['arv_number'].blank? ? 'N/A' : person['arv_number']),\n appointment_date: appointment_date.to_date,\n days_missed: days_missed(appointment_date.to_date),\n current_outcome: current_outcome,\n person_id: patient_id\n }\n end",
"def tcm_patient_info_params\n params.fetch(:tcm_patient_info, {})\n end",
"def show\n @patient_charge = PatientCharge.find(params[:id])\n @patient_payments = @patient_charge.patient_payments\n @patient_payment = PatientPayment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_charge }\n end\n end",
"def show\n @medicine_patient_relationship = MedicinePatientRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicine_patient_relationship }\n end\n end",
"def index\n @chronics = Chronic.where(\"patient_id = ?\", params[:p_id])\n end",
"def show\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_exercise }\n end\n end",
"def new\n @patient_charge = PatientCharge.new\n @patient = Patient.find params[:patient_id] unless params[:patient_id].nil?\n @horarios = Array.new\n i = 0\n while i < 13\n if i < 3\n @horarios << \"#{i+8}:00 a.m. - #{i+9}:00 a.m.\"\n elsif i == 4\n @horarios << \"#{i+8}:00 a.m. - #{i-3}:00 p.m.\"\n elsif i > 4\n @horarios << \"#{i-4}:00 p.m. - #{i-3}:00 p.m.\"\n end\n i += 1\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_charge }\n end\n end",
"def index\n @human = current_user.humen.find(params[:human_id])\n @patients = @human.patients\n end",
"def show\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patent }\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n if @patient.save\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n sex: @patient.sex,\n birthday: @patient.birthday,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n else\n render json: @patient.errors, status: :unprocessable_entity\n end\n end",
"def show\n @patientinformation = Patientinformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patientinformation }\n end\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def index\n \n @patients = nil\n #Fazer a verificação se é neuropsicologo\n if current_login.has_role? :secretary\n logged_user = Secretary.first(:conditions => \"login_id = #{current_login.id}\")\n @patients = Patient.is_active.in_clinic(logged_user.clinic.id).all\n elsif current_login.has_role? :neuropsychologist\n logged_user = Neuropsychologist.first(:conditions => \"login_id = #{current_login.id}\")\n # para obter os pacientes do neuropsicolgo é necessario ir a tabela das sessoes\n appointments = Appointment.where(:neuropsychologist_id => logged_user.id)\n @patients = appointments.collect(&:patient).uniq\n end\n\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end",
"def new\n @patient = Patient.new\n @ethnicities = Ethnicity.all\n @states = Patient::AVAILABLE_STATES\n @mortality_options = Patient::AVAILABLE_MORTALITY_OPTIONS\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def get_patient\n if params[:patient_id]\n session[:patient_id] = params[:patient_id]\n @patient = Patient.find(params[:patient_id])\n elsif session[:patient_id]\n @patient = Patient.find(session[:patient_id])\n else\n @patient = nil\n end\n end",
"def show\n if Patient == current_model\n Rails.logger.debug \"--- Looking up top-level patient info ---\"\n head :unauthorized and return unless can_access_patient?(params[:id])\n\n @object = current_model.find(params[:id])\n else\n Rails.logger.debug \"--- Patient implied ---\"\n head :bad_request and return unless patient_implicit?\n @object = current_model.find(params[:id])\n\n head :unauthorized and return unless can_access_patient?(@object.patient_id)\n end\n\n respond_to do |format|\n format.json { render json: @object }\n format.xml { render xml: @object }\n end\n end",
"def index\n @medic_patients = MedicPatient.all\n end",
"def details_view_patient\n @patient = current_user.user_record\n @appointments = Appointment.all(:conditions => { :patient_id => @patient.id })\n find_reports(current_user.id)\n end",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def new\n @patient_condition = PatientCondition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patient_condition }\n end\n end",
"def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end",
"def new\r\n @patient = Patient.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end",
"def show\n @hospital = Hospital.find(params[:id])\n # get date - use current month as default\n if params[:theDate]\n @theDate=Date.strptime(params[:theDate],'%d/%m/%y')\n else\n @theDate= Date.today\n end\n\n \n \n # get patients who were in hospital during that month\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hospital }\n end\n end",
"def index\n if Patient == current_model\n Rails.logger.debug \"--- Looking up top-level patient info ---\"\n @objects = @authorized_user.patients\n elsif params[:patient]\n Rails.logger.debug \"--- Patient specified in request ---\"\n head :unauthorized and return unless can_access_patient?(params[:patient])\n \n @objects = current_model.where(patient_id: params[:patient])\n else\n Rails.logger.debug \"--- Patient implied ---\"\n head :bad_request and return unless patient_implicit?\n \n @objects = current_model.where(patient_id: @authorized_user.patients.first)\n end\n\n respond_to do |format|\n format.json { render json: @objects }\n format.xml { render xml: @objects }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n @patients = @owner.patients.paginate(page: params[:page])\n end",
"def create\n @patient = Patient.new(params[:patient])\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, :notice => 'Patient was successfully created.' }\n format.json { render :json => @patient, :status => :created, :location => @patient }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\r\n @patient = current_doctor.patients.find(params[:id])\r\n @temperature_thresholds = current_doctor.temperature_thresholds.by_patient(@patient)\r\n @glucose_thresholds = current_doctor.glucose_thresholds.by_patient(@patient)\r\n @bloodpressure_thresholds = current_doctor.bloodpressure_thresholds.by_patient(@patient)\r\n @cardiogram_thresholds = current_doctor.cardiogram_thresholds.by_patient(@patient)\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @patient }\r\n end\r\n end",
"def show\n @doctor = Doctor.find(params[:doctor_id])\n @patient = @doctor.patients.find(params[:id])\n end",
"def new\n @patientinformation = Patientinformation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patientinformation }\n end\n end",
"def update\n respond_to do |format|\n if @tcm_patient_info.update(tcm_patient_info_params)\n format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcm_patient_info }\n else\n format.html { render :edit }\n format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patient_assignment = PatientAssignment.new\n @locations = Location.order(\"location_name ASC\")\n @patients = Patient.order(\"last_name ASC\")\n @devices = Device.order(\"serial_number ASC\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_assignment }\n end\n end",
"def index\n @patients = current_user.patients\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def index\n @patients = Patient.all\n end",
"def details\n {\n patient_id: patient_id || '',\n lab_type: lab_type || '',\n lab_specimen_collection: specimen_collection || '',\n lab_report: report || '',\n lab_result: result || '',\n lab_created_at: created_at || '',\n lab_updated_at: updated_at || ''\n }\n end",
"def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient }\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to patients_path, notice: 'Patient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @patient }\n else\n format.html { render action: 'new' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dtpic = Dtpic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dtpic }\n end\n end",
"def new\n @patient_group = PatientGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_group }\n end\n end",
"def create_patient\n if params[:name].present? and params[:phone_number].present?\n begin\n @patient = Patient.create(params.permit(:name, :phone_number))\n @msg = { status: STATUS_SUCCESS, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email, doctor_lists: Doctor.get_lists, patient_lists: Patient.get_lists, appointments: Appointment.get_lists }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n else\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end",
"def destroy\n @tcm_patient_info.destroy\n respond_to do |format|\n format.html { redirect_to tcm_patient_infos_url, notice: 'Tcm patient info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @patient }\n else\n format.html { render action: 'new' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n respond_to do |format|\n if @patient.save\n format.html { redirect_to new_patient_path}\n format.json { render :new, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7225858",
"0.702762",
"0.702762",
"0.702762",
"0.7006487",
"0.69137836",
"0.68889594",
"0.6773486",
"0.6773486",
"0.6765949",
"0.6754877",
"0.6745859",
"0.67421997",
"0.6732377",
"0.66520077",
"0.6649397",
"0.6593893",
"0.65794694",
"0.65771186",
"0.6571416",
"0.65298915",
"0.6527467",
"0.65197474",
"0.65167207",
"0.6513658",
"0.6498284",
"0.6492097",
"0.6485435",
"0.6481687",
"0.6464716",
"0.645896",
"0.6450904",
"0.64283943",
"0.6425469",
"0.64114654",
"0.63662463",
"0.63394105",
"0.6311043",
"0.6273766",
"0.6258124",
"0.624582",
"0.6235332",
"0.62137485",
"0.62049055",
"0.6194769",
"0.6173057",
"0.61613727",
"0.61565167",
"0.61547863",
"0.6152146",
"0.61344075",
"0.61331576",
"0.61327314",
"0.61321294",
"0.61211103",
"0.6117942",
"0.6108434",
"0.6100028",
"0.6095821",
"0.606343",
"0.6058956",
"0.6048362",
"0.604686",
"0.603594",
"0.6023667",
"0.600745",
"0.60041463",
"0.59870315",
"0.5981184",
"0.5980276",
"0.5967709",
"0.5958928",
"0.5957171",
"0.5940333",
"0.5932307",
"0.5928443",
"0.5928443",
"0.5928443",
"0.5924009",
"0.5921194",
"0.59204376",
"0.59200346",
"0.5920013",
"0.5906965",
"0.5894138",
"0.58877826",
"0.5882619",
"0.5882619",
"0.5882619",
"0.5882619",
"0.5882619",
"0.5878022",
"0.5877908",
"0.5875267",
"0.5867055",
"0.5862588",
"0.5862532",
"0.58599806",
"0.58557314",
"0.58539754",
"0.585023"
] | 0.0 | -1 |
POST /tcm_patient_infos POST /tcm_patient_infos.json | def create
@tcm_patient_info = TcmPatientInfo.new(tcm_patient_info_params)
respond_to do |format|
if @tcm_patient_info.save
format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully created.' }
format.json { render :show, status: :created, location: @tcm_patient_info }
else
format.html { render :new }
format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @patient = Patient.new(patient_params)\n if @patient.save\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n sex: @patient.sex,\n birthday: @patient.birthday,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n else\n render json: @patient.errors, status: :unprocessable_entity\n end\n end",
"def create\n @diagnosed_patient = DiagnosedPatient.new(diagnosed_patient_params)\n\n respond_to do |format|\n if @diagnosed_patient.save\n format.html { redirect_to @diagnosed_patient, notice: 'Diagnosed patient was successfully created.' }\n format.json { render :show, status: :created, location: @diagnosed_patient }\n else\n format.html { render :new }\n format.json { render json: @diagnosed_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(params[:patient])\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, :notice => 'Patient was successfully created.' }\n format.json { render :json => @patient, :status => :created, :location => @patient }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n respond_to do |format|\n if @patient.save\n format.html { redirect_to new_patient_path}\n format.json { render :new, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = @client.patients.build(params[:patient])\n \n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render json: @patient, status: :created, location: @patient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: \"Patient was successfully created.\" }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tcm_patient_info_params\n params.fetch(:tcm_patient_info, {})\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to patients_path, notice: 'Patient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @patient }\n else\n format.html { render action: 'new' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @patient }\n else\n format.html { render action: 'new' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_patient\n if params[:name].present? and params[:phone_number].present?\n begin\n @patient = Patient.create(params.permit(:name, :phone_number))\n @msg = { status: STATUS_SUCCESS, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email, doctor_lists: Doctor.get_lists, patient_lists: Patient.get_lists, appointments: Appointment.get_lists }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n else\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Novo paciente criado.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medic_patient = MedicPatient.new(medic_patient_params)\n\n respond_to do |format|\n if @medic_patient.save\n format.html { redirect_to @medic_patient, notice: 'Medic patient was successfully created.' }\n format.json { render :show, status: :created, location: @medic_patient }\n else\n format.html { render :new }\n format.json { render json: @medic_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @owner_patient = OwnerPatient.new(params[:owner_patient])\n\n respond_to do |format|\n if @owner_patient.save\n format.html { redirect_to @owner_patient, notice: 'Owner patient was successfully created.' }\n format.json { render json: @owner_patient, status: :created, location: @owner_patient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @owner_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to patient_path(@patient.name), notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: patient_path(@patient.name) }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_patient\n @patient = Patient.new(patient_params)\n if @patient.save\n msg = {:status => status, :message => 'New Patient created.', :patient_list => @patient}\n render json: msg, status: status\n else\n render :json => { :errors => @patient.errors }, :status => 422\n end\n end",
"def create\n @patient = current_physician.patients.build(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to [:physician, @patient], notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patient = @client.patients.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n @note = @patient.notes.build(params[:patient_id]) # .build used for has many (more than one record)\n @history = @patient.create_history(params[:patient_id]) # .create used for has one relationship\n @medical = @patient.create_medical(params[:patient_id])\n @patient.user_id = current_user.id\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_care = @patient.managed_cares.new\n @managed_care.patient_id = params[:patient_id]\n @subscriber = @patient.subscribers.all\n @title = \"New Managed Care Information\"\n @providers = @patient.providers\n @groups = @patient.groups \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @managed_care }\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n @patient.user = current_user\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Новый пациент добавлен.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n\t\tUsermailer.welcome(@patient).deliver\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n\t\t\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n respond_to do |format|\n if @patient.save\n flash[:success] = \"Patient was successfully created.\"\n format.html { redirect_to @patient}\n format.json { render json: @patient, status: :created, location: @patient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def create\n human = current_user.humen.find(params[:human_id])\n @patient = human.patients.new(patient_params)\n @patient.nombre = human.nombre\n @patient.ocupacion = human.ocupacion\n @patient.sexo = human.sexo\n @patient.edad = human.edad\n @patient.estado_civil = human.estado_civil \n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to ([@patient.human, @patient]), notice: 'La Ficha de Atencion ha sido creada.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_patient = ProviderPatient.new(provider_patient_params)\n\n respond_to do |format|\n if @provider_patient.save\n format.html { redirect_to @provider_patient, notice: 'Provider patient was successfully created.' }\n format.json { render :show, status: :created, location: @provider_patient }\n else\n format.html { render :new }\n format.json { render json: @provider_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n successful_response('Patient successfuly created', :created)\n else\n failure_response(format, :new, @patient)\n end\n end\n end",
"def set_tcm_patient_info\n @tcm_patient_info = TcmPatientInfo.find(params[:id])\n end",
"def create\n @doctor_patient = DoctorPatient.new(doctor_patient_params)\n\n respond_to do |format|\n if @doctor_patient.save\n format.html { redirect_to @doctor_patient, notice: 'Doctor patient was successfully created.' }\n format.json { render :show, status: :created, location: @doctor_patient }\n else\n format.html { render :new }\n format.json { render json: @doctor_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @patient = Patient.new(params[:patient])\r\n\r\n respond_to do |format|\r\n if @patient.save\r\n format.html { redirect_to(@patient, :notice => I18n.t(\"notifications.patients.create_success\")) }\r\n format.xml { render :xml => @patient, :status => :created, :location => @patient }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def patient_params\n params.require(:patient).permit(\n :treatment_number,\n :registered_on,\n :name,\n :gender,\n :age,\n :house_number,\n :street_name,\n :area,\n :village,\n :district,\n :pincode,\n :phone,\n :alternate_phone,\n :already_on_treatment,\n :prior_heart_attack,\n :heart_attack_in_last_3_years,\n :prior_stroke,\n :chronic_kidney_disease,\n :diagnosed_with_hypertension,\n :medication1_name,\n :medication1_dose,\n :medication2_name,\n :medication2_dose,\n :medication3_name,\n :medication3_dose,\n :medication4_name,\n :medication4_dose\n )\n end",
"def create\n @p\n x = Person.where(login: params[:treatment][:patient_id]).last\n \n @patient = x.patient.id\n @treatment = Treatment.new(patient_id: @patient, specialist_id: params[:treatment][:specialist_id], treatment_type: params[:treatment][:treatment_type], start_date: params[:treatment][:start_date], end_date: params[:treatment][:end_date], observation: params[:treatment][:observation])\n \n #@treatment = Treatment.new(treatment_params)\n\n respond_to do |format|\n if @treatment.save\n format.html { redirect_to @treatment, notice: 'Treatment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @treatment }\n else\n format.html { render action: 'new' }\n format.json { render json: @treatment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:firstname, :lastname, :middlename, :gender_id, :date_of_birth, :address_street_1, :address_street_2, :address_municipality, :address_territory, :address_postal_code, :address_country, :email_primary, :email_secondary, :phone_primary, :phone_secondary, :phone_mobile, :phone_alternate, :personal_id_type_id, :personal_id_code, :avatar, :name, :address,\n :allergies => [],\n :illnesses => [],\n :notes_attributes => [ :note, :author_type, :author_id, :patient_note_type_id ])\n end",
"def create\n redirect_to(root_url) && return unless current_user.can_create_patient? || current_user.can_import?\n\n # Check for potential duplicate\n unless params[:bypass_duplicate]\n duplicate_data = current_user.viewable_patients.duplicate_data(params[:patient].permit(*allowed_params)[:first_name],\n params[:patient].permit(*allowed_params)[:last_name],\n params[:patient].permit(*allowed_params)[:sex],\n params[:patient].permit(*allowed_params)[:date_of_birth],\n params[:patient].permit(*allowed_params)[:user_defined_id_statelocal])\n\n render(json: duplicate_data) && return if duplicate_data[:is_duplicate]\n end\n\n # Add patient details that were collected from the form\n patient = Patient.new(allowed_params)\n\n # Default to copying *required address into monitored address if monitored address is nil\n if patient.monitored_address_line_1.nil? || patient.monitored_address_state.nil? ||\n patient.monitored_address_city.nil? || patient.monitored_address_zip.nil?\n patient.monitored_address_line_1 = patient.address_line_1\n patient.monitored_address_line_2 = patient.address_line_2\n patient.monitored_address_city = patient.address_city\n patient.monitored_address_county = patient.address_county\n patient.monitored_address_state = patient.address_state\n patient.monitored_address_zip = patient.address_zip\n end\n helpers.normalize_state_names(patient)\n\n # NOTE: Remove head of household logic for now\n # Set the responder for this patient, this will link patients that have duplicate primary contact info\n # patient.responder = if params.permit(:responder_id)[:responder_id]\n # current_user.get_patient(params.permit(:responder_id)[:responder_id])\n # elsif ['SMS Texted Weblink', 'Telephone call', 'SMS Text-message'].include? patient[:preferred_contact_method]\n # if current_user.viewable_patients.responder_for_number(patient[:primary_telephone])&.exists?\n # current_user.viewable_patients.responder_for_number(patient[:primary_telephone]).first\n # end\n # elsif patient[:preferred_contact_method] == 'E-mailed Web Link'\n # if current_user.viewable_patients.responder_for_email(patient[:email])&.exists?\n # current_user.viewable_patients.responder_for_email(patient[:email]).first\n # end\n # end\n\n # Default responder to self if no responder condition met\n patient.responder = patient if patient.responder.nil?\n\n patient.responder = patient.responder.responder if params.permit(:responder_id)[:responder_id] && (patient.responder.responder_id != patient.responder.id)\n\n # Set the creator as the current user\n patient.creator = current_user\n\n # Set the subject jurisdiction to the creator's jurisdiction if jurisdiction is not assigned or not assignable by the current user\n valid_jurisdiction = current_user.jurisdiction.subtree_ids.include?(patient.jurisdiction_id) unless patient.jurisdiction_id.nil?\n patient.jurisdiction = current_user.jurisdiction unless valid_jurisdiction\n\n # Generate submission token for assessments\n patient.submission_token = patient.new_submission_token\n\n # Attempt to save and continue; else if failed redirect to index\n render(json: patient.errors, status: 422) && return unless patient.save\n\n # Send enrollment notification only to responders\n patient.send_enrollment_notification if patient.self_reporter_or_proxy?\n\n # Create a history for the enrollment\n History.enrollment(patient: patient, created_by: current_user.email)\n\n if params[:cc_id].present?\n close_contact = CloseContact.where(patient_id: current_user.viewable_patients).where(id: params.permit(:cc_id)[:cc_id])&.first\n close_contact.update(enrolled_id: patient.id)\n end\n\n render(json: patient) && return\n end",
"def create\n patient = params[\"patient_note\"].delete(\"patient_id\")\n @patient_note = PatientNote.new(params[:patient_note])\n @patient_note.patient = Patient.find(patient)\n\n respond_to do |format|\n if @patient_note.save\n flash[:notice] = 'PatientNote was successfully created.'\n APP_LOGGER_LOG.info \"NOTE CREATED - for PATIENT ID \" + \n @patient_note.patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\n format.html { redirect_to(@patient_note) }\n format.xml { render :xml => @patient_note, :status => :created, :location => @patient_note }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patient_note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @patient_visit = PatientVisit.new(patient_visit_params)\n\n respond_to do |format|\n if @patient_visit.save\n format.html { redirect_to @patient_visit, notice: 'Patient visit was successfully created.' }\n format.json { render :show, status: :created, location: @patient_visit }\n else\n format.html { render :new }\n format.json { render json: @patient_visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patienttest = Patienttest.new(patienttest_params)\n\n respond_to do |format|\n if @patienttest.save\n format.html { redirect_to @patienttest, notice: 'Patienttest was successfully created.' }\n format.json { render :show, status: :created, location: @patienttest }\n else\n format.html { render :new }\n format.json { render json: @patienttest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to(root_url) && return unless current_user.can_create_patient? || current_user.can_import?\n\n # Check for potential duplicate\n unless params[:bypass_duplicate]\n duplicate_data = current_user.viewable_patients.duplicate_data_detection(allowed_params)\n\n render(json: duplicate_data) && return if duplicate_data[:is_duplicate]\n end\n\n # Add patient details that were collected from the form\n patient = Patient.new(allowed_params)\n\n helpers.normalize_state_names(patient)\n # Set the responder for this patient, this will link patients that have duplicate primary contact info\n patient.responder = if params.permit(:responder_id)[:responder_id]\n current_user.get_patient(params.permit(:responder_id)[:responder_id])\n elsif ['SMS Texted Weblink', 'Telephone call', 'SMS Text-message'].include? patient[:preferred_contact_method]\n if current_user.viewable_patients.responder_for_number(patient[:primary_telephone])&.exists?\n current_user.viewable_patients.responder_for_number(patient[:primary_telephone]).first\n end\n elsif patient[:preferred_contact_method] == 'E-mailed Web Link'\n if current_user.viewable_patients.responder_for_email(patient[:email])&.exists?\n current_user.viewable_patients.responder_for_email(patient[:email]).first\n end\n end\n\n # Default responder to self if no responder condition met\n patient.responder = patient if patient.responder.nil?\n\n patient.responder = patient.responder.responder if params.permit(:responder_id)[:responder_id] && (patient.responder.responder_id != patient.responder.id)\n\n # Set the creator as the current user\n patient.creator = current_user\n\n # Set the subject jurisdiction to the creator's jurisdiction if jurisdiction is not assigned or not assignable by the current user\n valid_jurisdiction = current_user.jurisdiction.subtree_ids.include?(patient.jurisdiction_id) unless patient.jurisdiction_id.nil?\n patient.jurisdiction = current_user.jurisdiction unless valid_jurisdiction\n\n # If contact type is not set, default to \"Unknown\"\n patient.contact_type = 'Unknown' if patient.contact_type.nil?\n\n # Generate submission token for assessments\n patient.submission_token = patient.new_submission_token\n\n # Attempt to save and continue; else if failed redirect to index\n render(json: patient.errors, status: :unprocessable_entity) && return unless patient.save\n\n # Send enrollment notification only to responders\n patient.send_enrollment_notification if patient.self_reporter_or_proxy?\n\n # Create a history for the enrollment\n History.enrollment(patient: patient, created_by: current_user.email)\n\n # Create histories for lab results if present\n if allowed_params[:laboratories_attributes].present?\n patient.laboratories.order(created_at: :desc).limit(allowed_params[:laboratories_attributes].size).pluck(:id).reverse_each do |laboratory_id|\n History.lab_result(patient: patient.id, created_by: current_user.email, comment: \"User added a new lab result (ID: #{laboratory_id}).\")\n end\n end\n\n # Create histories for vaccinations if presentt\n if allowed_params[:vaccines_attributes].present?\n patient.vaccines.order(created_at: :desc).limit(allowed_params[:vaccines_attributes].size).pluck(:id).reverse_each do |vaccine_id|\n History.vaccination(patient: patient.id, created_by: current_user.email, comment: \"User added a new vaccination (ID: #{vaccine_id}).\")\n end\n end\n\n if params[:cc_id].present?\n close_contact = CloseContact.where(patient_id: current_user.viewable_patients).where(id: params.permit(:cc_id)[:cc_id])&.first\n close_contact.update(enrolled_id: patient.id)\n end\n\n render(json: patient) && return\n end",
"def create\n # Create patient based on current_user\n @patient = current_user.patients.build()\n @patient.fullname = params[:patient][:fullname]\n @patient.birthdate = params[:patient][:birthdate]\n @patient.telephone = params[:patient][:telephone]\n @patient.address = params[:patient][:address]\n @patient.injury = params[:patient][:injury]\n @patient.infection = params[:patient][:infection]\n @patient.observations = params[:patient][:observations]\n @patient.cost = params[:patient][:cost]\n\n #create an instance/object of a BasicPatient\n myPatient = BasicPatient.new(@patient.cost)\n\n #add the extra requests to the new patient\n if params[:patient][:xray].to_s.length > 0 then myPatient = XrayDecorator.new(myPatient)\n end\n if params[:patient][:mri].to_s.length > 0 then myPatient = MriDecorator.new(myPatient)\n end\n if params[:patient][:cat].to_s.length > 0 then myPatient = CatDecorator.new(myPatient)\n end\n if params[:patient][:bloods].to_s.length > 0 then myPatient = BloodDecorator.new(myPatient)\n end\n\n # populate the request details and cost\n @patient.cost = myPatient.cost\n @patient.requests = myPatient.details\n #retrieve the instance/object of the PatientLogger class\n logger = PatientLogger.new()\n logger.logInformation(\"A new Patient added:\" +@patient.fullname+ \" With the following requests:\" +@patient.requests)\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def create\n @registry_patient = Registry::Patient.new(registry_patient_params)\n\n respond_to do |format|\n if @registry_patient.save\n if registry_patient_params[:registry_patient_assistances_attributes].present?\n format.html { redirect_to registry_patient_assistance_path(@registry_patient.id), notice: 'Asistencia del paciente fue creado exitosamente.' }\n else\n format.html { redirect_to @registry_patient, notice: 'Paciente fue creado exitosamente.' }\n end\n format.json { render :show, status: :created, location: @registry_patient }\n else\n if registry_patient_params[:registry_patient_assistances_attributes].present?\n format.html { render :new_assistance_registration } \n else\n format.html { render :new }\n end\n format.json { render json: @registry_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n @patient.set_patient_code\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @microrna_patient = MicrornaPatient.new(microrna_patient_params)\n generate_code\n respond_to do |format|\n if @microrna_patient.save \n format.html { render :show}\n #format.json { render :show, status: :created, location: @microrna_patient }\n else\n format.html { render :new }\n format.json { render json: @microrna_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patient = Patient.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patient }\n end\n end",
"def patients\n patients = User.patients\n render json: { status: 200, data: patients }\n end",
"def new\n @patient = Patient.find(params[:patient_id])\n @visit = Visit.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def patient_params\n params.require(:patient).permit(:code, :first_name, :last_name, :birthday, :age, :phone, :email, :dpi, :sex, :manager, :nit, :alergies, :annotations, :status, :room_id)\n end",
"def patient_params\n params.require(:patient).permit(:first_name, :last_name, :document_number, :birth_date, :provice, :city, :status, :patient_id, :test_group_id)\n end",
"def index\n @tcm_patient_infos = TcmPatientInfo.all\n end",
"def patient_params\n params.require(:patient).permit(:user_id, :first_name, :last_name, :dob, :gender, :ndis_status, :ndis_number, :postcode, :specialties)\n end",
"def patient_params\n params.require(:patient).permit(:comment, :first_name, :last_name, :preferred_name, :dob, :birth_sex, :gender_identity, :sexual_orientation, :race, :languages, :marital_status, :employment, :hipaa, :pcp_release, :user_id, :address_1, :address_2, :zipcode, :city, :state, :mobile_phone, :home_phone, :work_phone, :other_phone, :email)\n end",
"def create\n @patient = Patient.new(patient_params)\n @users=User.all\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def new\n @pageType = \"new\"\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @owner_patient = OwnerPatient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner_patient }\n end\n end",
"def patient_params\n params.require(:patient).permit(:name, :age_type, :clinic_diagnosis,:intrance_date,\n :research_date, :is_infection, :infection_localization, :identified_pathogen,\n :pathogen_date, :antibacterial_therapy, :start_time_antibacterial_therapy,\n :volume_start_infusion, :start_infusion_solution, :is_ivl, :ivl_time, :is_sepsis,\n :sespsis_date, :is_renal_therapy, :renal_therapy, :is_operation, :final_diagnosis, :is_alive, :death_count_days, :reanimation_count_days, :hospital_count_days)\n end",
"def create\n @patientinformation = Patientinformation.new(params[:patientinformation])\n\n respond_to do |format|\n if @patientinformation.save\n format.html { redirect_to(@patientinformation, :notice => 'Patientinformation was successfully created.') }\n format.xml { render :xml => @patientinformation, :status => :created, :location => @patientinformation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientinformation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @patient = Patient.new\n @patient.build_person\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def create\n @patient_log = PatientLog.new(patient_log_params)\n\n respond_to do |format|\n if @patient_log.save\n format.html { redirect_to @patient_log, notice: 'Patient log was successfully created.' }\n format.json { render :show, status: :created, location: @patient_log }\n else\n format.html { render :new }\n format.json { render json: @patient_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:niid_id, :lab_id, :affiliation, :hosp_id, :gender, :nationarity, :date_of_birth, :date_diagnosed, :edu_background, :occupation, :marital_status, :risk, :date_of_art_init, :operator_id)\n end",
"def patient_params\n params.require(:patient).permit(:name, :surname, :medical_history, :DOB, :city)\n end",
"def create\n @person = Person.new(params[:patient][:person_attributes])\n\n respond_to do |format|\n if @person.save\n @patient = Patient.new(params[:patient].except(:person_attributes))\n @patient.person_id = @person.id\n category = Category.find_by_name \"CENAAC\"\n @patient.category_id = category.id\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render json: @patient, status: :created, location: @patient }\n else\n @patient.build_person\n @patient.person = @person\n @person.destroy\n format.html { render action: \"new\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n else\n @patient = Patient.new\n @patient.build_person\n @patient.person = @person\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(params[:patient])\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to(@patient, :notice => 'Patient was successfully created.') }\n format.xml { render :xml => @patient, :status => :created, :location => @patient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(params[:patient])\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to(@patient, :notice => 'Patient was successfully created.') }\n format.xml { render :xml => @patient, :status => :created, :location => @patient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:fecha, :nombre, :sexo, :edad, :ocupacion, :estado_civil, :descripcion_del_paciente, :anamnesis, :hora_de_inicio, :desarrollo_de_la_sesion, :hora_de_termino, :comentarios, :tag_ids => [])\n end",
"def create\n @patient = Patient.new(patient_params)\n @user = current_user\n respond_to do |format|\n if @patient.save\n PatientMailer.welcome_email(@user, @patient).deliver_now\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:name, :mrn, :dob, :email, :access_token, :refresh_token)\n end",
"def create\n authorize! :update, Nurse\n patient = Patient.find(params[:patient_id])\n @patientrecord = patient.patientrecords.create(patientrecord_params)\n respond_to do |format|\n if @patientrecord.save\n format.html { redirect_to patient_patientrecords_path, notice: 'Patientrecord was successfully created.' }\n format.json { render :show, status: :created, location: @patientrecord }\n else\n format.html { render :new }\n format.json { render json: @patientrecord.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient)\n .permit(:first_name, :last_name, :middle_name,\n :birth_at, :medical_record_no, :gender,\n :status, :location_id, :view_count, :deletion\n )\n end",
"def patient_params\n params.require(:patient).permit(:clinic, :consent, :email, :first_name, :referring_clinician, :last_name, :mobile_number, :procedure_id, :procedure_start_date, :program_status, :team_member, :response_status, :return_patient)\n end",
"def patient_params\n params.require(:patient).permit(:name, :number)\n end",
"def create\n # result = CreatePatientProfile.call(Patient.new(patient_params))\n # if result.success?\n\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient }\n flash[:success] = \"Thank you \"+@patient.firstname+\". Your account has been setup.\"\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.new(patient_params)\n @patient.operator_id = current_user.id\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @patient }\n else\n format.html { render action: 'new' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.find(params[:patient_id]) \n @managed_care = ManagedCare.new(params[:managed_care])\n @managed_care.created_user = current_user.login_name\n @subscriber = @patient.subscribers.all\n @providers = @patient.providers\n @groups = @patient.groups \n \n respond_to do |format|\n if @managed_care.save\n format.html { redirect_to patient_managed_cares_path(:patient_id =>params[:patient_id]), notice: 'Managed care was successfully created.' }\n format.json { render json: @managed_care, status: :created, location: @managed_care }\n else\n format.html { render action: \"new\" }\n format.json { render json: @managed_care.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n original_content = JSON.parse request.body.read\n if original_content.key? ('source') and (original_content['source'] == 'GeneTalk' or original_content['source'] == 'Phenobot')\n content = JSON.parse Patient.convert(original_content)\n else\n content = original_content\n end\n patient_id = content['case_data']['case_id']\n time = Time.now.strftime('%d_%m_%Y_%H_%M_%S')\n log_dir = File.join(API_LOG, patient_id.to_s)\n unless File.directory?(log_dir)\n FileUtils.mkdir_p(log_dir)\n end\n log_path = File.join(log_dir, time + '.log')\n logger = Logger.new(log_path)\n logger.info 'Receive patient data'\n\n # Log the raw JSON data\n original_f = File.join(log_dir, time + '.json')\n File.open(original_f, \"wb\") { |f| f.write(JSON.pretty_generate(original_content)) }\n\n # if a case doesnt exist, process the request and create a new case\n patient_save = true\n msg = {}\n begin\n ActiveRecord::Base.transaction do\n consumer_id = get_consumer_id()\n lab = Patient.parse_lab(content, consumer_id)\n patient = Patient.find_by(case_id: patient_id, lab_id: lab.id)\n if patient.nil?\n patient = Patient.create_patient(content, consumer_id)\n msg = { msg: MSG_CASE_CREATED }\n else\n # Check if there is pedia service running to avoid\n # overwriting the data\n p_services = patient.pedia_services\n unless p_services.empty?\n p_service = p_services.last\n p_status = p_service.pedia_status\n if p_status.workflow_running?\n msg = { msg: MSG_PEDIA_RUNNING_TRY_LATER }\n respond_to do |format|\n format.json { render plain: msg.to_json,\n status: 400,\n content_type: 'application/json'\n }\n end\n return\n end\n end\n\n # Update patient data\n patient.update_json(content['case_data'])\n msg = { msg: MSG_CASE_UPDATE }\n end\n\n dirname = File.join(\"Data\", \"Received_JsonFiles\", lab.id.to_s)\n dir = \"#{Rails.root}/#{dirname}\"\n FileUtils.mkdir(dir) unless File.directory?(dir)\n\n f = \"#{dir}/#{patient_id}.json\"\n File.open(f, \"wb\") { |f| f.write(JSON.pretty_generate(content)) }\n end\n rescue Exception => e\n logger = Logger.new(log_path)\n logger.error e.message\n e.backtrace.each { |line| logger.error line }\n patient_save = false\n msg = { msg: MSG_CASE_ERROR }\n end\n\n respond_to do |format|\n if patient_save\n format.json { render plain: msg.to_json,\n status: 200,\n content_type: 'application/json'\n }\n else\n msg = { msg: MSG_CASE_ERROR }\n format.json { render plain: msg.to_json,\n status: 400,\n content_type: 'application/json'\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tcm_patient_info.update(tcm_patient_info_params)\n format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcm_patient_info }\n else\n format.html { render :edit }\n format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n #@test.patient_id = @patient.id\n @test.patient = Patient.find(params[:patient_id])\n respond_to do |format|\n if @test.save\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was created successfully !!!' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new, notice: 'Test creation unsuccessful !!!' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient = Patient.find(params[:patient_id])\n @done_vaccination = DoneVaccination.new(done_vaccination_params)\n @done_vaccination.patient = @patient\n \n\n respond_to do |format|\n if @done_vaccination.save\n format.html { redirect_to @patient, notice: 'Done vaccination was successfully created.' }\n format.json { render :show, status: :created, location: @done_vaccination }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:first_name, :last_name, :mrn, :date_of_birth, :program, :admission_date, :discharge_date, :pharmacist_id)\n end",
"def create\n @patient = Patient.new(patient_params)\n @patient.user_id = current_user.id\n saved = @patient.save\n specialties = params[:patient][:specialties].delete_if { |v| v == \"\" }\n specialties.each do |x|\n patient_specialties = PatientSpecialty.new\n patient_specialties.patient_id = @patient.id\n patient_specialties.specialty_id = x\n patient_specialties.save\n end\n respond_to do |format|\n if saved\n format.html { redirect_to root_path, notice: \"patient was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:name, :sex, :birthday, :email, :phone, :description)\n end",
"def medic_patient_params\n params.require(:medic_patient).permit(:patient_id, :medic_id)\n end",
"def patient_params\n params.require(:patient).permit(:doctor_id, :name, :age, :gender, :birthday, :surname, :second_name,\n :address, :registration_address, :phone, :work_phone, :disability, :work_place, :work_position, :dependant, :area,\n :insurance_police_series, :insurance_police_number, :social_benefit_code, :document_series, :document_number,\n :martial_status, :education, :employment, :disability_time, :disability_date, :blood_type, :Rh_factor, :insurance_company,\n :document_name, :insurance_policy_series, :insurance_policy_number, :insurance_certificate, :allergy => [])\n end",
"def create\n @patient = Patient.new(params[:patient])\n\n respond_to do |format|\n if ignore_duplicate_patient?(@patient.attributes) and @patient.save\n session[:duplicate_patient] = {}\n flash[:notice] = 'Patient was successfully created.'\n format.html { redirect_to(@patient) }\n format.xml { render :xml => @patient, :status => :created, :location => @patient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:first_name, :last_name, :phone_number, :email, :dob, :doctor_id, :address, :rcn, :fathers_name)\n end",
"def create\n authorize(:patient)\n @patient = Patient.new(patient_params)\n\n respond_to do |format|\n if @patient.save\n if session[:admission_register]\n puts('Session admission_register use')\n format.html { redirect_to(new_admission_path(dateOfBirth: @patient.person.dateOfBirth, lastName: @patient.person.lastName),\n notice: 'Patient registration successful') }\n else\n format.html { redirect_to(patients_path, notice: 'Patient registration successful') }\n end\n else\n format.js { render :create, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient_sample = PatientSample.new(params[:patient_sample])\n\n respond_to do |format|\n if @patient_sample.save\n report_patient_sample @patient_sample\n format.html { redirect_to @patient_sample, notice: 'Sample was successfully registered' }\n format.json { render json: @patient_sample, status: :created, location: @patient_sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person_info = PersonInfo.new(person_info_params(params[:person_info]))\n\n if @person_info.save\n render json: @person_info, status: :created, location: @person_info\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def patient_params\n params.require(:patient).permit(:last_name, :first_name, :birthdate, :phone, :email, :misc)\n end",
"def patient_params\n params.require(:patient).permit(:fullname, :birthdate, :telephone, :address, :infection, :injury, :observations, :cost, :requests)\n end",
"def create\n @patient = Patient.new(patient_params)\n @patient.lifetime_total = 0.0\n respond_to do |format|\n if @patient.save\n session[:patient] = @patient.id\n format.html { redirect_to new_award_path, notice: 'Patient Saved!' }\n #format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:first_name, :middle_name, :last_name, :location_id, :birthday, :gender, :status)\n end",
"def create\n @patient_history = PatientHistory.new(params[:patient_history])\n\n respond_to do |format|\n if @patient_history.save\n format.html { redirect_to @patient_history, notice: 'Patient history was successfully created.' }\n format.json { render json: @patient_history, status: :created, location: @patient_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patient_params\n params.require(:patient).permit(:name, :surname, :address, :gender, :birthdate, :phone, :starting_therapy_day, :user_id, :health_center_id)\n end",
"def patient_params\n params.require(:patient).permit(:name, :dob, :case, :hospital, :age, :date_admission, :race, :sex, :pathologist, :physician, :attendant, :date_autopsy, :time_of_autopsy, :restrictions, :prosector, :time_of_birth, :age_day_week, :type_of_gestation, :specify_number)\n end",
"def patient_params\n params.require(:patient).permit(:first_name, :last_name, :email, :phone_number)\n end"
] | [
"0.7071312",
"0.6810582",
"0.6775352",
"0.67720807",
"0.6768563",
"0.67647874",
"0.6763522",
"0.6763522",
"0.6763522",
"0.6752355",
"0.6729753",
"0.67196226",
"0.6707423",
"0.67057556",
"0.66948557",
"0.66915494",
"0.6676042",
"0.66522706",
"0.6624962",
"0.6589317",
"0.6588298",
"0.6557193",
"0.652954",
"0.6526481",
"0.6478862",
"0.64761615",
"0.6440352",
"0.64133364",
"0.6409962",
"0.6404549",
"0.640281",
"0.6385723",
"0.63707656",
"0.6357025",
"0.63479453",
"0.63412523",
"0.6337174",
"0.63367105",
"0.6336612",
"0.63319546",
"0.63303274",
"0.6323477",
"0.6321901",
"0.6320683",
"0.6320683",
"0.6311308",
"0.6311217",
"0.63062197",
"0.6301258",
"0.6300627",
"0.6297918",
"0.6297027",
"0.629403",
"0.6273538",
"0.6258272",
"0.6245519",
"0.6242091",
"0.6238545",
"0.623625",
"0.62309307",
"0.6229997",
"0.62295437",
"0.6223391",
"0.6222846",
"0.6222598",
"0.62215537",
"0.62174845",
"0.62174845",
"0.62142503",
"0.620631",
"0.6205849",
"0.6196852",
"0.6188821",
"0.617024",
"0.6168131",
"0.6164479",
"0.6149467",
"0.6146551",
"0.6137241",
"0.6133949",
"0.61168295",
"0.61071515",
"0.610577",
"0.6101934",
"0.6100988",
"0.60983276",
"0.6095113",
"0.6083956",
"0.60817945",
"0.6080737",
"0.607638",
"0.60707223",
"0.6065402",
"0.60495925",
"0.604568",
"0.6043757",
"0.60409606",
"0.6037725",
"0.6032101",
"0.6023386"
] | 0.76556325 | 0 |
PATCH/PUT /tcm_patient_infos/1 PATCH/PUT /tcm_patient_infos/1.json | def update
respond_to do |format|
if @tcm_patient_info.update(tcm_patient_info_params)
format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully updated.' }
format.json { render :show, status: :ok, location: @tcm_patient_info }
else
format.html { render :edit }
format.json { render json: @tcm_patient_info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @patient = @client.patients.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient].except(:person_attributes))\n format.html { redirect_to people_url, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to @patient, :notice => 'Patient was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to patients_path, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n patient = get_patient(@body[\"token\"])\n if patient != @patient\n render json: {message: \"failed to authenticate\"}, status: :unprocessable_entity\n elsif @patient.update(patient_params)\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n birthday: @patient.birthday,\n sex: @patient.sex,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n else\n render json: @patient.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts @patient.name\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to patient_path(@patient.name), notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: patient_path(@patient.name) }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @microrna_patient.update(microrna_patient_params)\n format.html { redirect_to @microrna_patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @microrna_patient }\n else\n format.html { render :edit }\n format.json { render json: @microrna_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: \"Patient was successfully updated.\" }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: \"'Данные пациента обновлены.'\" }\n format.json { render :show, status: :ok, location: @patient }\n else \n format.html { render :edit}\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update_attributes(patient_params)\n format.html { redirect_to @patient, notice: 'A informacao do paciente foi atualizada.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @owner_patient = OwnerPatient.find(params[:id])\n\n respond_to do |format|\n if @owner_patient.update_attributes(params[:owner_patient])\n format.html { redirect_to @owner_patient, notice: 'Owner patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @patient = Patient.find(params[:id])\r\n respond_to do |format|\r\n if @patient.update_attributes(params[:patient])\r\n flash[:notice] = 'Patient was successfully updated.'\r\n \r\n APP_LOGGER_LOG.info \"PATIENT UPDATED - for PATIENT ID \" + \r\n @patient[:medical_record_number] + \" by USER \" + self.current_user[:login]\r\n \r\n format.html { redirect_to(@patient) }\r\n format.xml { render :xml => @patient }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n params[:patient][:illness_ids] ||= []\n params[:patient][:medicament_ids] ||= []\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n flash[:success] = \"Patient was successfully updated.\"\n format.html { redirect_to @patient }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n params[:patient][:owner_id] = devise_current_user.id.to_s \n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appointment_patient.update(appointment_patient_params)\n format.html { redirect_to @appointment_patient, notice: 'Appointment patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @appointment_patient }\n else\n format.html { render :edit }\n format.json { render json: @appointment_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n successful_response('Patient was successfuly updated.', :ok)\n else\n failure_response(format, :new, @patient)\n end\n end\n end",
"def update\n\n @patient.fullname = params[:patient][:fullname]\n @patient.birthdate = params[:patient][:birthdate]\n @patient.telephone = params[:patient][:telephone]\n @patient.address = params[:patient][:address]\n @patient.infection = params[:patient][:infection]\n @patient.injury = params[:patient][:injury]\n @patient.observations = params[:patient][:observations]\n # @patient.cost = params[:patient][:cost]\n\n\n myPatient = BasicPatient.new(@patient.cost)\n\n #add the extra requests to the new patient\n if params[:patient][:xray].to_s.length > 0 then myPatient = XrayDecorator.new(myPatient)\n end\n\n if params[:patient][:mri].to_s.length > 0 then myPatient = MriDecorator.new(myPatient)\n end\n\n if params[:patient][:cat].to_s.length > 0 then myPatient = CatDecorator.new(myPatient)\n end\n\n if params[:patient][:bloods].to_s.length > 0 then myPatient = BloodDecorator.new(myPatient)\n end\n\n # update the requests details and name\n @patient.cost = myPatient.cost\n\n @patient.requests = myPatient.details\n\n #build a hash with the updated information of the patient\n updated_information = {\n \"fullname\" => @patient.fullname,\n \"birthdate\" => @patient.birthdate,\n \"telephone\" => @patient.telephone,\n \"address\" => @patient.address,\n \"infection\" => @patient.infection,\n \"injury\" => @patient.injury,\n \"observations\" => @patient.observations,\n \"cost\" => @patient.cost,\n \"requests\" => @patient.requests\n }\n\n respond_to do |format|\n if @patient.update(updated_information)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @diagnosed_patient.update(diagnosed_patient_params)\n format.html { redirect_to @diagnosed_patient, notice: 'Diagnosed patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @diagnosed_patient }\n else\n format.html { render :edit }\n format.json { render json: @diagnosed_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:patient][:contact_mechanism_attributes] ||= {}\n params[:patient][:patient_medical_record_number_attributes] ||= {}\n params[:patient][:address_attributes] ||= {}\n @patient.attributes = params[:patient]\n\n respond_to do |format|\n if @patient.save\n flash[:notice] = 'Patient was successfully updated.'\n format.html { redirect_to(@patient) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to(@patient, :notice => 'Patient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to(@patient, :notice => 'Patient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to(@patient, :notice => 'Patient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patienttest.update(patienttest_params)\n format.html { redirect_to @patienttest, notice: 'Patienttest was successfully updated.' }\n format.json { render :show, status: :ok, location: @patienttest }\n else\n format.html { render :edit }\n format.json { render json: @patienttest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @patient = Patient.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @patient.update_attributes(params[:patient])\r\n format.html { redirect_to(@patient, :notice => I18n.t(\"notifications.patients.update_success\")) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { request.xhr?? render(nothing: true) : redirect_to([:physician, @patient], notice: 'Patient was successfully updated.') }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @medic_patient.update(medic_patient_params)\n format.html { redirect_to @medic_patient, notice: 'Medic patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @medic_patient }\n else\n format.html { render :edit }\n format.json { render json: @medic_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:patient_id]) \n @managed_care = ManagedCare.find(params[:id])\n @managed_care.updated_user = current_user.login_name\n @subscriber = @patient.subscribers.all\n @providers = @patient.providers\n @groups = @patient.groups \n \n respond_to do |format|\n if @managed_care.update_attributes(params[:managed_care])\n format.html { redirect_back_or_default patient_managed_cares_path(:patient_id =>params[:patient_id]), notice: 'Managed care was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @managed_care.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n human = current_user.humen.find(params[:human_id])\n @patient = human.patients.find(params[:id])\n @patient.nombre = human.nombre\n @patient.ocupacion = human.ocupacion\n @patient.sexo = human.sexo\n @patient.edad = human.edad\n @patient.estado_civil = human.estado_civil\n\n respond_to do |format|\n\n if @patient.update(patient_params)\n format.html { redirect_to [@patient.human,@patient], notice: 'La Ficha de Atencion ha sido actualizada.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tcm_patient_info\n @tcm_patient_info = TcmPatientInfo.find(params[:id])\n end",
"def update\n pat_id = @sample.patient_id\n respond_to do |format|\n if @sample.update(sample_params)\n @sample.patient_id = pat_id\n @sample.operator_id = current_user.id\n @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @description = Description.find(params[:id])\n\n authorize! :update, @description.patient\n \n respond_to do |format|\n if @description.patient.update(params[:patient].permit([:name, :dob, :case, :hospital, :age, :date_admission, :race, :sex, :pathologist, :physician, :attendant, :date_autopsy, :time_of_autopsy, :restrictions, :prosector, :time_of_birth, :age_day_week, :type_of_gestation, :specify_number]))\n\n\t@description.update(user_id: params[:patient][:pathologist]);\n format.html { redirect_to \"#{description_path}#home\", notice: 'Ronak: Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @description.patient }\n else\n format.html { render :edit }\n format.json { render json: @description.patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider_patient.update(provider_patient_params)\n format.html { redirect_to @provider_patient, notice: 'Provider patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider_patient }\n else\n format.html { render :edit }\n format.json { render json: @provider_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_note = PatientNote.find(params[:id])\n \n respond_to do |format|\n if @patient_note.update_attributes(params[:patient_note])\n flash[:notice] = 'PatientNote was successfully updated.'\n get_patient_by_notes\n APP_LOGGER_LOG.info \"NOTE UPDATED - for PATIENT ID \" + \n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\n \n format.html { redirect_to(@patient_note) }\n format.xml { render :xml => @patient_note }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patient_note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patientappointmentinfo = Patientappointmentinfo.find(params[:id])\n\n respond_to do |format|\n if @patientappointmentinfo.update_attributes(params[:patientappointmentinfo])\n format.html { redirect_to(@patientappointmentinfo, :notice => 'Patientappointmentinfo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patientappointmentinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_sample = PatientSample.find(params[:id])\n\n respond_to do |format|\n if @patient_sample.update_attributes(params[:patient_sample])\n format.html { redirect_to @patient_sample, notice: 'Patient sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n if @patient_history.update_attributes(params[:patient_history])\n format.html { redirect_to @patient_history, notice: 'Patient history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n if @patient_exercise.update_attributes(params[:patient_exercise])\n format.html { redirect_to @patient_exercise, notice: 'Patient exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n # Update the patient within admission form page\n if params.include?(:update_patient)\n @update_patient_successful = true\n format.js\n else\n format.html { redirect_to(patients_path, notice: 'Patient updated!') }\n end\n else\n if params.include?(:update_patient)\n @update_patient_fail = true\n # respond_with(@patient)\n format.js\n else\n respond_with(@patient)\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient_log.update(patient_log_params)\n format.html { redirect_to @patient_log, notice: 'Patient log was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_log }\n else\n format.html { render :edit }\n format.json { render json: @patient_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def update\n status_unsupported_media_type && return unless content_type_header?\n\n # Parse in the FHIR::Patient\n contents = FHIR.from_contents(request.body.string)\n status_bad_request && return if contents.nil? || !contents.valid?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n updates = Patient.from_fhir(contents).select { |_k, v| v.present? }\n resource = get_patient(params.permit(:id)[:id])\n else\n status_bad_request && return\n end\n\n status_forbidden && return if resource.nil?\n\n # Try to update the resource\n status_bad_request && return if updates.nil? || !resource.update(updates)\n\n status_ok(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end",
"def update\n respond_to do |format|\n if @doctor_patient.update(doctor_patient_params)\n format.html { redirect_to @doctor_patient, notice: 'Doctor patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @doctor_patient }\n else\n format.html { render :edit }\n format.json { render json: @doctor_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient.update(patient_params)\n if current_user.admin\n format.html { redirect_to @patient, notice: 'Patient Data was successfully updated.' }\n else\n session[:patient] = @patient.id\n format.html { redirect_to new_award_path, notice: 'Patient Saved!' }\n end\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patientinformation = Patientinformation.find(params[:id])\n\n respond_to do |format|\n if @patientinformation.update_attributes(params[:patientinformation])\n format.html { redirect_to(@patientinformation, :notice => 'Patientinformation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patientinformation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update #We can use @patient because we have the set_patient method \n if @patient.update(patient_params) \n redirect_to patient_path(@patient)\n else \n render :edit \n end \n end",
"def update\n set_appointments_patients\n respond_to do |format|\n if @appointment.update(just_appointment_params)\n format.html { redirect_to @appointment, notice: 'Appointment was successfully updated.' }\n format.json { render :show, status: :ok, location: @appointment }\n else\n format.html { render :edit }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:file]\n file = params[:file].read\n data = JSON.parse(file)\n ActiveRecord::Base.transaction do\n @patient = Patient.find_by(case_id: data['case_id'])\n if @patient.valid?\n @patient.update_json(data)\n name = params[:file].original_filename\n path = File.join(\"Data\", \"jsons\", name)\n File.open(path, \"wb\") { |f| f.write(file) }\n end\n end\n end\n if usi_params\n usi = UsiMaterialnr.find_or_create_by(patient_id:@patient.id)\n usi.usi_id = usi_params[:usi_id]\n usi.materialnr = usi_params[:materialnr]\n usi.save\n end\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_charge = PatientCharge.find(params[:id])\n\n respond_to do |format|\n if @patient_charge.update_attributes(params[:patient_charge])\n format.html { redirect_to @patient_charge, notice: 'Patient charge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @treatment_plan_note.update(treatment_plan_note_params)\n format.html { redirect_to patient_path(@treatment_plan_note.patient), notice: 'Treatment plan note was successfully updated.' }\n format.json { render :show, status: :ok, location: @treatment_plan_note }\n else\n format.html { render :edit }\n format.json { render json: @treatment_plan_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient_history.update(patient_history_params)\n format.html { redirect_to @patient_history, notice: 'Patient history was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_history }\n else\n format.html { render :edit }\n format.json { render json: @patient_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n saved = @patient.update(patient_params)\n specialties = params[:patient][:specialties].delete_if { |v| v == \"\" }\n PatientSpecialty.where(patient_id: @patient.id).each { |e| e.destroy! }\n specialties.each do |x|\n patient_specialties = PatientSpecialty.new\n patient_specialties.patient_id = @patient.id\n patient_specialties.specialty_id = x\n patient_specialties.save\n end\n respond_to do |format|\n if @patient.update(patient_params)\n format.html { redirect_to root_path, notice: \"Patient was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @patient= Patient.find(params[:id])\n \n if @patient.update(patient_params)\n @patients = Patient.order(:id)\n render :admin_view\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @pacient.update(pacient_params)\n format.html { redirect_to @pacient, notice: 'Pacient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patientrecord.update(patientrecord_params)\n format.html { redirect_to patient_patientrecords_path, notice: 'Patientrecord was successfully updated.' }\n format.json { render :show, status: :ok, location: @patientrecord }\n else\n format.html { render :edit }\n format.json { render json: @patientrecord.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_condition = PatientCondition.find(params[:id])\n\n respond_to do |format|\n if @patient_condition.update_attributes(params[:patient_condition])\n format.html { redirect_to @patient_condition, :notice => 'Patient condition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patient_condition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #@patron = Patron.find(params[:id])\n\n respond_to do |format|\n if @patron.update_attributes(params[:patron])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.patron'))\n format.html { redirect_to patron_url(@patron) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @patron.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @clinician_order = ClinicianOrder.find(params[:id])\n @Visit = Visit.find(@clinician_order.visit_id) #reconstruct patient and visit to redirect back to patient -tg\n @Patient = Patient.find(@Visit.patient_id)\n\n respond_to do |format|\n if @clinician_order.update_attributes(params[:clinician_order])\n format.html { redirect_to @Patient, notice: 'Clinician order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinician_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient_profile.update(patient_profile_params)\n format.html { redirect_to edit_patient_profile_path(@patient_profile), notice: 'Patient profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_profile }\n else\n format.html { render :edit }\n format.json { render json: @patient_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_patient(program, patient, person_id = nil)\n if person_id\n patient.person_id = person_id\n raise \"Could not update patient patient_id ##{patient_id} due to #{patient.errors.as_json}\" unless patient.save\n end\n\n dde_service(program).update_patient(patient) if use_dde_service? && dde_patient?(patient)\n\n patient\n end",
"def update \n if @patient.update(patient_param)\n redirect_to :show\n else render :edit\n end\n end",
"def update\n respond_to do |format|\n if @tap.update(tap_params)\n format.html { redirect_to taps_path, notice: 'Tap was successfully updated.' }\n format.json { head :no_content }\n else\n format.json { render json: @tap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient_visit.update(patient_visit_params)\n format.html { redirect_to @patient_visit, notice: 'Patient visit was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_visit }\n else\n format.html { render :edit }\n format.json { render json: @patient_visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_group = PatientGroup.find(params[:id])\n\n respond_to do |format|\n if @patient_group.update_attributes(params[:patient_group])\n format.html { redirect_to @patient_group, notice: 'Patient group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @telefon = Telefon.find(params[:id])\n @telefon.update_attributes(params[:telefon])\n respond_with(@telefon)\n end",
"def update\n params[:patient_risk_factor][:ethnicity_ids] ||= []\n @patient_risk_factor = PatientRiskFactor.find(params[:id])\n\t@patient = @patient_risk_factor.patient\n\n respond_to do |format|\n if @patient_risk_factor.update_attributes(params[:patient_risk_factor])\n format.html { redirect_to home_path, :notice => 'Data has been succesfully saved. Thanks for your time!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_risk_factor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient.clinic_id = params[:clinic_id]\n if @patient.update(patient_params)\n redirect_to patient_path(@patient)\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @tprimarytumor.update(tprimarytumor_params)\n format.html { redirect_to @tprimarytumor, notice: 'tprimarytumor was successfully updated.' }\n format.json { render :show, status: :ok, location: @tprimarytumor }\n else\n format.html { render :edit }\n format.json { render json: @tprimarytumor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @patient = Patient.find(params[:id])\n end",
"def update\n \n \n gender_id = params[:patient].delete(:gender_id)\n #clinic_id = params[:patient].delete(:clinic_id)\n civil_status_id = params[:patient].delete(:civil_status_id)\n handedness_id = params[:patient].delete(:handedness_id)\n login = @patient.login\n \n \n \n @patient.gender_id = gender_id\n #@patient.clinic_id = clinic_id\n @patient.civil_status_id = civil_status_id\n @patient.handedness_id = handedness_id\n\n\n begin\n Patient.transaction do\n @patient.update_attributes(params[:patient])\n end\n rescue ActiveRecord::RecordInvalid => invalid\n respond_to do |format| \n format.html { render action: \"new\" }\n end\n end\n respond_to do |format|\n format.html { redirect_to @patient, notice: 'Paciente atualizado com sucesso.' }\n end\n\n\n\n end",
"def update\n @patient = Patient.find(params[:id])\n params[:patient][:test_execution_date] = Date.strptime( params[:patient][:test_execution_date], \"%d/%m/%Y\" )\n params[:patient][:test_delivery_date] = Date.strptime( params[:patient][:test_delivery_date], \"%d/%m/%Y\" )\n\n @patient.add_line_tests_from_cart(@cart)\n kill_session(@patient.id)\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to(patients_url, :notice => 'Patient was successfully updated.') }\n format.xml { head :ok }\n else\n doctor_test_category_test_values\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @meteorological_data = MeteorologicalData.find(params[:id])\n\n respond_to do |format|\n if @meteorological_data.update_attributes(params[:meteorological_data])\n format.html { redirect_to(@meteorological_data, :notice => 'MeteorologicalData was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meteorological_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patientregistration_data = PatientregistrationData.find(params[:id])\n\n respond_to do |format|\n if @patientregistration_data.update_attributes(params[:patientregistration_data])\n format.html { redirect_to(@patientregistration_data, :notice => 'PatientregistrationData was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @patientregistration_data.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\n if registry_event_params[:registry_event_patients_attributes]\n @registry_event.registry_event_patients.delete_all\n registry_event_params[:registry_event_patients_attributes][:registry_patient_ids].each do |patient|\n @registry_event.registry_patients << Registry::Patient.find(patient)\n end\n end\n\n @selected_patient = @registry_event.registry_event_patients.map{|b| b.registry_patient_id.to_s}\n\n respond_to do |format|\n if @registry_event.update(registry_event_params.except :registry_event_patients_attributes)\n format.html { redirect_to @registry_event, notice: 'Evento fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @registry_event }\n else\n format.html { render :edit }\n format.json { render json: @registry_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tangent.update(tangent_params)\n format.html { redirect_to @tangent, notice: 'Tangent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tangent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hospital = Hospital.find(params[:id])\n\n\n respond_to do |format|\n if @hospital.update_attributes(:name=>params[:name],:namefull=>params[:namefull],:description=>params[:description])\n # format.html { redirect_to @hospital, notice: 'Hospital was successfully created.' }\n format.json { render json: [:id=>@hospital.id] , status: :ok, location: @hospital }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @hospital.errors, status: :unprocessable_entity }\n end\n end\n\n # respond_to do |format|\n # if @hospital.update_attributes(params[:hospital])\n # format.html { redirect_to @hospital, notice: 'Hospital was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @hospital.errors, status: :unprocessable_entity }\n # end\n # end\n\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_extra_pacientes.update(info_extra_paciente_params)\n format.html { redirect_to @info_extra_paciente, notice: 'Info extra actualizada.' }\n format.json { render :show, status: :ok, location: @info_extra_paciente }\n else\n format.html { render :edit }\n format.json { render json: @info_extra_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chronicle.update(chronicle_params)\n format.html { redirect_to @chronicle, notice: t('flash_message.notice.successfully_updated', model: Chronicle.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chronicle.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 original_updated_at = @patient_procedure.updated_at\n PatientProcedure.transaction do\n @patient_procedure.update patient_procedure_params\n @patient_procedure.risk.update patient_procedure_risk_params\n end\n respond_to do |format|\n if original_updated_at != @patient_procedure.updated_at\n format.html { redirect_to @patient_procedure, notice: 'Patient procedure was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_procedure }\n else\n format.html { render :edit }\n format.json { render json: @patient_procedure.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.725539",
"0.7012029",
"0.6971339",
"0.6951263",
"0.6946573",
"0.69266677",
"0.6917158",
"0.6913407",
"0.6913407",
"0.68744105",
"0.6867139",
"0.68494684",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6807592",
"0.6797563",
"0.6795822",
"0.6783024",
"0.67724586",
"0.6610057",
"0.66046476",
"0.65986973",
"0.6592092",
"0.65890276",
"0.6574358",
"0.65380836",
"0.65362275",
"0.6523044",
"0.6487709",
"0.6487709",
"0.6487709",
"0.64845973",
"0.64717895",
"0.64692646",
"0.6444314",
"0.6395429",
"0.6392485",
"0.6351077",
"0.6339232",
"0.6333",
"0.6315279",
"0.6283935",
"0.6266525",
"0.6263182",
"0.62475747",
"0.622963",
"0.6216793",
"0.6200274",
"0.61999494",
"0.6197371",
"0.61862224",
"0.61823744",
"0.617771",
"0.6167243",
"0.6159432",
"0.6157773",
"0.6155591",
"0.61504865",
"0.6108539",
"0.60981953",
"0.6067021",
"0.6055775",
"0.6039344",
"0.6037102",
"0.6034715",
"0.602946",
"0.6024231",
"0.6018346",
"0.6003327",
"0.5995643",
"0.5992982",
"0.59905404",
"0.5985184",
"0.59836704",
"0.5959682",
"0.5956357",
"0.5950558",
"0.5948909",
"0.5948462",
"0.5930657",
"0.5919017",
"0.5910092",
"0.5888936",
"0.5882217",
"0.5881109",
"0.5879015",
"0.5878942",
"0.5871183",
"0.5869741",
"0.5866434",
"0.5866199",
"0.5865997",
"0.58649534"
] | 0.7417913 | 0 |
DELETE /tcm_patient_infos/1 DELETE /tcm_patient_infos/1.json | def destroy
@tcm_patient_info.destroy
respond_to do |format|
format.html { redirect_to tcm_patient_infos_url, notice: 'Tcm patient info was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @patient.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = @client.patients.find(params[:id]) unless current_user.admin?\n @patient = Patient.find(params[:id]) if current_user.admin?\n if @patient.deleted_at.blank?\n @patient.destroy(validate: false)\n else\n @patient.revive(validate: false)\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @microrna_patient.destroy\n respond_to do |format|\n format.html { redirect_to microrna_patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnosed_patient.destroy\n respond_to do |format|\n format.html { redirect_to diagnosed_patients_url, notice: 'Diagnosed patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Paciente removido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to physician_patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @patient = Patient.find(params[:id])\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to admin_patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @owner_patient = OwnerPatient.find(params[:id])\n @owner_patient.destroy\n\n respond_to do |format|\n format.html { redirect_to owner_patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patienttest.destroy\n respond_to do |format|\n format.html { redirect_to patienttests_url, notice: 'Patienttest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully removed.', class: 'destroy' }\n format.json { head :no_content }\n end\n end",
"def destroy\n human = current_user.humen.find(params[:human_id])\n\n @patient = human.patient.new(patient_params)\n\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'La Ficha de Atencion ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"def delete_patient_by_id(patient_id)\n patient = Patient.find(patient_id)\n patient.destroy\nend",
"def delete_patient_by_id(patient_id)\n \nend",
"def destroy\n patient = get_patient(@body[\"token\"])\n if patient != @patient\n render json: {message: \"failed to authenticate\"}, status: :unprocessable_entity\n elsif @patient.destroy\n render json: {message: \"success\"}\n else\n render json: {message: \"failed\"}, status: :unprocessable_entity\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: \"Patient was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.deleted = DateTime.now\n @patient.save\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { render json: @patient }\n end\n end",
"def destroy\n @medic_patient.destroy\n respond_to do |format|\n format.html { redirect_to medic_patients_url, notice: 'Medic patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_log.destroy\n respond_to do |format|\n format.html { redirect_to patient_logs_url, notice: 'Patient log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_path (params[:patient_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_history = PatientHistory.find(params[:id])\n @patient_history.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_visit.destroy\n respond_to do |format|\n format.html { redirect_to patient_visits_url, notice: 'Patient visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_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(params, options={})\n request(\"#{base_uri(params)}/delete\", options.merge(method: :delete))\n .if_403_raise(Neutrino::Gateway::Exceptions::InvalidTenantOperation)\n .if_404_raise(Neutrino::Gateway::Exceptions::PatientNotFoundError)\n .with_general_exception_check('409', /has documents/, Neutrino::Gateway::Exceptions::PatientIdentityHasDocumentsError)\n .with_general_exception_check('409', /is not in Error/, Neutrino::Gateway::Exceptions::PatientIdentityNotInError)\n .to_hash['data_status']\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @appointment_patient.destroy\n respond_to do |format|\n format.html { redirect_to appointment_patients_url, notice: 'Appointment patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @day_statistics = @patient.day_statistics.all\n @day_statistics.delete_all\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Данные пациента удалены.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to patient_visits_path(params[:patient_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chronic.destroy\n respond_to do |format|\n format.html { redirect_to patients_path, notice: 'Chronic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doctor_patient.destroy\n respond_to do |format|\n format.html { redirect_to doctor_patients_url, notice: 'Doctor patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_history.destroy\n respond_to do |format|\n format.html { redirect_to patient_histories_url, notice: 'Patient history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_note = PatientNote.find(params[:id])\n @patient_note.destroy\n get_patient_by_notes\n APP_LOGGER_LOG.info \"NOTE DELETED - for PATIENT ID \" + \n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\n \n respond_to do |format|\n format.html { redirect_to(patient_notes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @patient = Patient.find(params[:id])\r\n @patient.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(patients_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @patient.destroy\n redirect_to root_path\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 @patientinformation = Patientinformation.find(params[:id])\n @patientinformation.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientinformations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to patient_visits_url(@patient) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n redirect_to(patients_path, notice: \"Deleted Patient\")\n end",
"def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n if @patient.errors.size > 0 then\n respond_to do |format|\n # format.html { redirect_to Patients_url }\n # format.json { head :no_content }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n else\n respond_to do |format|\n # format.html { redirect_to Patients_url }\n # format.json { head :no_content }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @patientrecord.destroy\n respond_to do |format|\n format.html { redirect_to patientrecords_url, notice: 'Patientrecord was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patientappointmentinfo = Patientappointmentinfo.find(params[:id])\n @patientappointmentinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientappointmentinfos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_condition = PatientCondition.find(params[:id])\n @patient_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_conditions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_group = PatientGroup.find(params[:id])\n @patient_group.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @patient = Patient.find(params[:id])\r\n @patient.destroy\r\n \r\n #DELETE PROFILE PIC - ADDED BY UPINDER\r\n @patientID = params[:id]\r\n @directory = File.join(RAILS_ROOT,\"public/patients/photos\")\r\n @directory = File.join(@directory,@patientID)\r\n Upload.delete(@directory)\r\n #END DELETE PROFILE PIC\r\n \r\n APP_LOGGER_LOG.info \"PATIENT DELETED - for PATIENT ID \" + \r\n @patient[:medical_record_number] + \" by USER \" + self.current_user[:login]\r\n \r\n respond_to do |format|\r\n format.html { redirect_to(patients_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n patient = TrashedPatient.get!(params[:id])\n patient.remove_from_trash\n\n head :ok\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @patientregistration_data = PatientregistrationData.find(params[:id])\n @patientregistration_data.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientregistration_datas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n @count = Patient.count-1\n format.html { redirect_to patients_url, notice: \"Estimated wait time : #{@count} hours\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n puts @iot_datum.count\n if @iot_datum.count > 0\n @deleted_rec = IotDatum.new\n @deleted_rec.workbench_number = @iot_datum.workbench_number\n @deleted_rec.part_number = @iot_datum.part_number\n @deleted_rec.target = @iot_datum.target\n @deleted_rec.lot_size = @iot_datum.lot_size\n @deleted_rec.employee_name = @iot_datum.employee_name\n @deleted_rec.shift = @iot_datum.shift\n @deleted_rec.device_id = @iot_datum.device_id\n @deleted_rec.count = @iot_datum.count\n @deleted_rec.status = 'Deleted'\n @deleted_rec.save!\n @iot_datum.destroy\n else\n @iot_datum.destroy\n end\n respond_to do |format|\n format.html { redirect_to iot_data_url, notice: 'Planner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medicine_patient_relationship = MedicinePatientRelationship.find(params[:id])\n @medicine_patient_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to medicine_patient_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patron.destroy\n\n respond_to do |format|\n format.html { redirect_to patrons_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.patron')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @managed_care = ManagedCare.find(params[:id])\n @managed_care.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_managed_cares_path(:patient_id =>params[:patient_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pacient.destroy\n respond_to do |format|\n format.html { redirect_to pacients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnostic.destroy\n respond_to do |format|\n format.html { redirect_to physician_diagnostics_path, notice: 'Diagnostic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end",
"def 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 @biometria.destroy\n respond_to do |format|\n format.html { redirect_to index_biometria_path(params[:paciente_id]), notice: 'Biometria elimino correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tangent.destroy\n respond_to do |format|\n format.html { redirect_to tangents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider_patient.destroy\n respond_to do |format|\n format.html { redirect_to provider_patients_url, notice: 'Provider patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @patient_alert = PatientAlert.find(params[:id])\r\n @patient_alert.destroy\r\n get_patient_by_alert\r\n APP_LOGGER_LOG.info \"ALERT DELETED - for PATIENT ID \" + \r\n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\r\n \r\n respond_to do |format|\r\n format.html { redirect_to(patient_alerts_url) }\r\n format.xml { head :ok }\r\n end\r\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 @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aki_diagnosis.destroy\n respond_to do |format|\n format.html { redirect_to aki_diagnoses_url, notice: 'Diagnosis aki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_location.destroy\n respond_to do |format|\n format.html { redirect_to patient_locations_url, notice: 'Patient location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.74712026",
"0.724691",
"0.7223435",
"0.72109574",
"0.72109574",
"0.72109574",
"0.72109574",
"0.7210253",
"0.7210253",
"0.7210253",
"0.7210253",
"0.72084016",
"0.7202416",
"0.7188496",
"0.7169685",
"0.7144111",
"0.7080055",
"0.7076126",
"0.7060444",
"0.7043352",
"0.70326054",
"0.7030052",
"0.7024303",
"0.7014243",
"0.7011935",
"0.700352",
"0.6999977",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69993114",
"0.69977254",
"0.6995964",
"0.69909257",
"0.6985907",
"0.6966264",
"0.6930187",
"0.69083685",
"0.6888558",
"0.6887449",
"0.6884435",
"0.6873783",
"0.6871754",
"0.68706167",
"0.68706167",
"0.68706167",
"0.6869903",
"0.6838711",
"0.6834845",
"0.6830606",
"0.6805563",
"0.67995054",
"0.67911386",
"0.6788135",
"0.6784003",
"0.6758243",
"0.67570907",
"0.67312527",
"0.6730675",
"0.6718665",
"0.6717297",
"0.67125374",
"0.6710224",
"0.66951853",
"0.6669001",
"0.665421",
"0.66535056",
"0.66397554",
"0.66099244",
"0.65965956",
"0.6594089",
"0.6587264",
"0.6584812",
"0.65772647",
"0.6576849",
"0.65748703",
"0.65665793",
"0.65591896",
"0.6558001",
"0.6551114",
"0.65506315",
"0.6550147",
"0.6543197",
"0.65370244",
"0.65320307",
"0.6523155",
"0.6516311",
"0.651556"
] | 0.7604018 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tcm_patient_info
@tcm_patient_info = TcmPatientInfo.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 set_actions\n actions :all\n end",
"def define_action_helpers?; 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 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 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 before_action \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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 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 my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; 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 duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def tcm_patient_info_params
params.fetch(:tcm_patient_info, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def 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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
is the user an admin or a customer? | def role
@role ||=
if is_admin?
:admin
else
:customer
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin?\n\tif session[:customer_id].nil?\n\t\treturn\n\telse\n signed_in? == true\n\t@current_customer == Customer.find_by_id(3)\n\tend\nend",
"def admin? ; user.instance_of? User and user.role >= 2 ; end",
"def customer?\n role?(UserRoles::CUSTOMER)\n end",
"def admin_user?\n\t\treturn self.user_category == \"admin\"\n\tend",
"def admin_user?\n \treturn self.user_category == \"admin\"\n end",
"def user_is_customer?\n (user_signed_in? && current_user.is_customer?)\n end",
"def admin?\n user.class.name == Admin.name\n end",
"def admin?\n self.user_type == TYPES[:admin]\n end",
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def is_admin?(user)\n user.admin > 0\n end",
"def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end",
"def is_admin?\n user_type == 'super_admin' || user_type == 'admin'\n end",
"def admin?\n \tself.role == \"admin\" || self.email == 'admin@mycrm.com'\n end",
"def is_customer?\n role = self.role\n\n if(role == 'customer')\n return true\n else\n return false\n end\n end",
"def admin_user?\n self.admin ==true\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def customer?\n self.role.role_type == \"customer\"\n end",
"def admin?\n user.admin?\n end",
"def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend",
"def admin?\n user_role_id == UserRole::ADMIN\n end",
"def admin?\n user = check_user\n user.role == User.role_types['Admin']\n end",
"def is_admin?\n usertype == \"admin\" and id == 0\n end",
"def admin_user?\n current_user.admin\n end",
"def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end",
"def admin?\n self.is_a? AdminUser\n end",
"def admin?\n User.admin_logged_in?\n end",
"def admin_user\n (current_user.present? && current_user.admin?)\n end",
"def admin?\n self.admin_user\n end",
"def admin?\n @user.admin?\n end",
"def user?(admin)\n admin&.id == self.admin_id\n end",
"def admin?\n self == User.first\n end",
"def admin?\n current_user && current_user.role?(\"admin\")\n end",
"def user_is_owner_or_admin?\n record.user == user || user.try(:admin?)\n end",
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def admin_user\n @current_user.admin?\n end",
"def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend",
"def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end",
"def admin_logged_in?\n User.admin_logged_in?\n end",
"def admin_logged_in?\n User.admin_logged_in?\n end",
"def admin?\n self.role == 53\n end",
"def admin?\n self == User.first\n end",
"def is_admin?\n\t\treturn self.usertype == \"admin\"\n\tend",
"def admin?\n @user = current_user.is_admin?\n end",
"def is_administrator?(user)\n user.admin == 2\n end",
"def is_admin?\n current_user ? current_user.login == 'admin' : false\n end",
"def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end",
"def is_admin?(user)\r\n self.admins.one? { |email, admin| email == user.email }\r\n end",
"def admin?\n if self.role == 'admin'\n true\n else\n false\n end\n end",
"def admin_user?\n session[:user][:uid] == APP_CONFIG[:admin]\n end",
"def admin?\n\t\tcurrent_user.try(:admin)\n\tend",
"def admin?\n @current_user.admin?\n end",
"def admin?\n current_user.admin?\n end",
"def admin?\n return !new_record? && login == 'admin'\n end",
"def admin?\n if(@current_user)\n @current_user.admin?\n end\n end",
"def current_user?(user)\n (user == self.current_user) || admin?\n end",
"def admin?\n if (User.find session[:user_id]).role == \"Admin\"\n true\n end\n end",
"def normal_user?\n self.admin ==false\n end",
"def admin?(user)\n user.role_names.include?('cmsadmin')\n end",
"def admin? \n role == 'admin'\n end",
"def admin?\n role == 1\n end",
"def admin_access?\n admin?\n end",
"def admin?\n self.role.downcase == \"admin\"\n end",
"def admin?\n self.role.downcase == \"admin\"\n end",
"def admin?\n role == \"admin\"\n end",
"def is_admin?\n admin\n end",
"def is_admin?\n admin\n end",
"def is_admin?\n admin?\n end",
"def is_admin?\n current_user.role.eql?(\"admin\")\n end",
"def admin?\n return self.role == \"admin\"\n end",
"def admin?\n return self.role == \"admin\"\n end",
"def is_admin?\n is_admin == 1\n end",
"def admin?\n current_user.admin?\n end",
"def user_is_owner_or_admin?\n record.reading.user == user || user.try(:admin?)\n end",
"def admin?\n role.to_s == \"admin\"\n end",
"def admin?\n self.role == 'Admin'\n end",
"def admin?\n self.role == 'admin'\n end",
"def admin?\n self.role == 'admin'\n end",
"def admin?\n self.role == 'admin'\n end",
"def admin?\n role == 'admin'\n end",
"def admin?\n role == 'admin'\n end",
"def admin?\n return self.email == \"a@example.com\"\n end",
"def admin?\n @current_user && @current_user.has_role?(:admin)\n end",
"def is_admin\n admin?\n end",
"def admin?\n role?(UserRoles::ADMIN)\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def current_admin?(user)\n current_user.admin?\n end",
"def admin?\n self.email == \"vinti.uiet@gmail.com\" || self.email == \"parryg@hotmail.com\"\n end",
"def admin?\n logged_in? && current_user.login == \"ej0c\"\n end",
"def current_user_is_admin?\n current_user && current_user.is_admin\n end",
"def isAdmin?\n return current_usuario != nil && current_usuario.admin\n end",
"def is_admin\n return Admin.find_by(email: session[:email]) != nil\n end",
"def is_admin?\n\t current_account.user.is_a?(Administrator)\n\tend",
"def logged_in?\n \tcurrent_customer.is_a? Customer\n end",
"def current_user_is_admin?\n roles.include?(ADMIN_ROLE)\n end",
"def admin?\n\t\tuser_session.admin?\n\tend",
"def is_admin?\n current_user && current_user.try(:admin?)\n end",
"def admin?\n logged_in? && current_user.admin?\n end",
"def admin_loggedin?\r\n @logged_in_user and @logged_in_user.admin?\r\n end",
"def admin?\n logged_in? and current_user.admin?\n end",
"def admin_logged_in?\n current_user && current_user.admin?\n end",
"def is_admin\n return current_user.role == User::ADMIN\n end"
] | [
"0.8346972",
"0.8169137",
"0.815209",
"0.8103464",
"0.8088938",
"0.80479586",
"0.8045988",
"0.7993833",
"0.7981102",
"0.79658324",
"0.79582185",
"0.7937235",
"0.7902522",
"0.7897135",
"0.7884077",
"0.7874257",
"0.7831813",
"0.782672",
"0.781979",
"0.7819062",
"0.78189355",
"0.78151953",
"0.7808357",
"0.7788198",
"0.7759903",
"0.7747521",
"0.7747228",
"0.7734424",
"0.7705046",
"0.7700371",
"0.7700057",
"0.76844615",
"0.7678613",
"0.76628274",
"0.7654048",
"0.7646642",
"0.76456225",
"0.7644741",
"0.7644741",
"0.76441735",
"0.76406515",
"0.7637003",
"0.7631553",
"0.7627911",
"0.76270896",
"0.76112074",
"0.760656",
"0.7596681",
"0.7594408",
"0.7582677",
"0.7580418",
"0.75799865",
"0.75544137",
"0.7553377",
"0.75502616",
"0.7550093",
"0.75489116",
"0.75432307",
"0.75403506",
"0.7539083",
"0.75370795",
"0.75339365",
"0.75339365",
"0.75307107",
"0.75261855",
"0.75261855",
"0.75253165",
"0.7524669",
"0.75246125",
"0.75246125",
"0.75211585",
"0.75154096",
"0.75122094",
"0.7511807",
"0.7510539",
"0.7510059",
"0.7510059",
"0.7510059",
"0.75060713",
"0.75060713",
"0.74986774",
"0.7495993",
"0.74929374",
"0.74890924",
"0.74868983",
"0.74829847",
"0.7482972",
"0.7481267",
"0.7477524",
"0.74683475",
"0.74668646",
"0.7466376",
"0.7465461",
"0.74620485",
"0.7458123",
"0.745412",
"0.74512786",
"0.7449183",
"0.74463296",
"0.74455196",
"0.7442964"
] | 0.0 | -1 |
Methode extract from RestClient maybe need some test | def process_payload(p=nil, parent_key=nil)
unless p.is_a?(Hash)
p
else
p.keys.map do |k|
key = parent_key ? "#{parent_key}[#{k}]" : k
if p[k].is_a? Hash
process_payload(p[k], key)
elsif p[k].is_a? Array
p[k].map do |v|
value = URI.escape(v.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
"#{key}[]=#{value}"
end
else
value = URI.escape(p[k].to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
"#{key}=#{value}"
end
end.join("&")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend",
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend",
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n\n begin\n response = site.get(:accept=>\"application/json\")\n # puts \"URL response: #{response}\"\n return JSON.parse(response)\n rescue => e\n e.response\n return nil\n end\nend",
"def rest_endpoint; end",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend",
"def test_twitter_api_for_success\n \n stub_request(:any, 'https://twitter.com/?refsrc=email').to_return { |request| {:body => request.body} }\n RestClient.get('https://twitter.com/?refsrc=email', 'shahrukh khan') # ===> \"abc\\n\"\n \nend",
"def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"def rest_get(base_uri,params)\n begin\n @response = RestClient.get(base_uri,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end",
"def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend",
"def rest_endpoint=(_arg0); end",
"def parse_api_request(url_endpoint)\n response = RestClient::Request.execute(\n :method => :get,\n :url => url_endpoint,\n :headers => {\"X-Mashape-Key\" => TEST_KEY,\n \"Accept\" => \"application/json\"\n })\n response_hash = JSON.parse(response)[\"api\"]\nend",
"def get_wrapper(url, headers)\n [parse_response(RestClient.get(resource + url, headers)), true]\n rescue RestClient::Exception => e\n [parse_error(e.response), false]\n end",
"def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end",
"def rest_get(url)\n JSON.parse(RestClient.get(url))\n end",
"def request_url url \n response = RestClient::Request.execute(method: :get, url: url, timeout: 500 , user_agent: \"Mozilla/5.0 (Linux; U; Android 6.0.1; zh-CN; HUAWEI RIO-AL00 Build/HuaweiRIO-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.4.5.937 Mobile Safari/537.36\" )\nend",
"def rest\n @rest ||= RestClient.new ENDPOINT[type], lgn: login, pwd: password\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\n end",
"def fetch_data(api_url)\n JSON.parse(RestClient.get(api_url))\nend",
"def login_sample()\n login_json = {\n :username => $username,\n :password => $password,\n :accessrights => $api_key\n }\n\n client = RestClient::Resource.new \"https://#{$hostname}/live/api/v3/\", :headers => {}, :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n\n request = login_json.to_json\n response = client['login'].post request, { :content_type => 'application/json' }\n\n client.options[:headers][:cookies] = response.cookies\n\n p ''\n p 'Login'\n p response\n client\nend",
"def client_method(rest_method, url_elements, query_elements = [], parameters = nil)\n url = File.join(@base_url, *url_elements)\n url = URI.escape(url)\n query_elements.each_with_index do |s, i|\n char = (i == 0) ? '?' : '&'\n url = '%s%s%s' % [url, char, s]\n end\n\n args = Hash.new\n\n args.store(:method, rest_method)\n args.store(:url, url)\n args.store(:timeout, @time_out)\n headers = {\n 'content-type' => 'application/json',\n 'X-TrackerToken' => @token\n }\n if parameters.nil?\n parameters_json = nil\n else\n parameters_json = parameters.to_json\n end\n # args.store(:user, @account_name)\n # args.store(:password, @password)\n args.store(:payload, parameters_json)\n args.store(:headers, headers)\n\n # noinspection RubyResolve\n args.store(:verify_ssl, OpenSSL::SSL::VERIFY_NONE)\n\n RestClient.proxy = \"http://172.20.240.5:8080\"\n response = RestClient::Request.execute(args)\n # Don't parse as Json if empty.\n return response.code if response == ''\n begin\n parser = JSON::Ext::Parser.new(response)\n json = parser.parse\n json = DataHelper.rehash_to_symbol_keys(json)\n return [response.code, json]\n rescue\n # Isn't Json.\n return [response.code, response]\n end\n end",
"def stub_eventbrite_event_get\n mock_event = { name: { text: 'test' }, ticket_classes: [ { id: '1234', name: 'test', free: true, hidden: true }]}\n response = double('Yay!', to_hash: {\"Status\" => [\"200 OK\"]}, code: 200)\n res = RestClient::Response.create(mock_event.to_json, response, {}, {})\n expect(RestClient).to receive(:get).and_return(res)\nend",
"def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend",
"def call_api(**rest_options)\n json = nil\n response = nil\n begin\n response = RestClient::Request.execute(**rest_options)\n json = JSON.parse(response.to_s) if response && !response.empty?\n headers = response.headers\n self.rate_limit = headers[:x_ratelimit_limit].to_i if headers.include?(:x_ratelimit_limit)\n self.rate_remaining = headers[:x_ratelimit_remaining].to_i if headers.include?(:x_ratelimit_remaining)\n self.rate_reset = Time.at(headers[:x_ratelimit_reset].to_i) if headers.include?(:x_ratelimit_reset)\n rescue RestClient::Exceptions::Timeout => e\n raise\n rescue RestClient::ExceptionWithResponse => e\n response = e.response\n #json = JSON.parse(response.to_s) if response && !response.empty?\n json = nil\n rescue => e\n raise\n end\n return response, json\n end",
"def call_api(**rest_options)\n @retry.do do\n res = RestClient::Request.execute(**rest_options)\n json = res && !res.empty? ? ::JSON.parse(res.to_s) : nil\n call_api_response(res) if respond_to?(:call_api_response)\n [res, json]\n end\n end",
"def test_canvas_api_studenta_upcoming_events_headers\n skip(\"verify that studenta has appropriate events\")\n refute_nil @w\n ## this requires self in url\n #request_url = \"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n request_url = @@dummy_host+\"/users/self/upcoming_events\"\n request_parameters = {:params => {:as_user_id => 'sis_login_id:studenta'}}\n full_request_url = RestClient::Request.new(:method => :get, :url => request_url, :headers => request_parameters).url\n #full_request_url.gsub!(/%3A/, ':')\n\n # puts \"full_request_url: #{full_request_url}\"\n result_as_json = run_and_get_ruby_result(full_request_url)\n #puts \"result: \"+result_as_json.inspect\n assert_operator result_as_json.length, \">=\", 1, \"got some upcoming events back\"\n end",
"def sensor_list\n #this is making a post request by intializing the restclient gem with RestClient::Request.new to get sensors list\n #if the call is successful it provide the response.body\n #if fails and returns a 400 with the error.\n response = RestClient::Request.new({\n method: :post,\n url:\"https://api.samsara.com/v1/sensors/list?access_token=#{Rails.application.credentials.secret_key}\",\n payload:{ \"groupId\": 32780 }.to_json,\n headers: { :accept => :json, content_type: :json }\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, (response.to_json) ]\n when 200\n [ :success, (response.to_json) ]\n else\n fail \"Invalid response #{response} received.\"\n end\n # here I setting the body to an elemnet that will be availble in the views.\n @sensor_list = response.body\n end\n end",
"def consume_rest; end",
"def test_process_url_params_idempotent\n # verify that using url method from RestClient doesn't change existing url\n request_url=@@dummy_host+\"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n full_request_url = RestClient::Request.new(:method => :get, :url => request_url).url\n #puts \"full_request_url: [#{full_request_url}]\"\n refute_nil full_request_url\n assert_equal(request_url, full_request_url)\n end",
"def response_from_service\n\n end",
"def web_request\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend",
"def raw_api(method,params=nil)\n debug(6,:var=>method,:msg=>\"method\")\n debug(6,:var=>params,:msg=>\"Parameters\")\n\n checkauth\n checkversion(1,1)\n params={} if params==nil\n obj=do_request(json_obj(method,params))\n return obj['result']\n end",
"def call(_method, _path, params = {})\n puts \"Aici?\"\n begin\n #path = \"https://login-test03.cloud.xirrus.com/api/v2#{_path}\"\n\n path = \"#{@xms_url}/api/v2#{_path}\"\n puts \"PATH = #{path}\"\n if (_method == :get || _method == :get_string || _method == :get_csv || _method == :get_csv_all_radios || _method == :put_with_query_params || _method == :post_with_query_params)\n query = build_query(params)\n path += \"?#{query}\"\n # Escape if anu spaces in url\n path = URI.escape(path)\n end\n success = false\n case _method\n\n when :get\n puts \"#{token}\"\n response_json_string = RestClient.get( path, :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient get\n\n when :post\n\n response_json_string = RestClient.post( path , params.to_json , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n when :post_file\n\n response_json_string = RestClient.post( path , params , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :text,\n\n :accept => :json\n ) # RestClient Post file\n\n\n\n when :put\n puts params.to_json\n response_json_string = RestClient.put( path , params.to_json , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n\n when :delete\n response_json_string = RestClient.delete( path , :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n when :delete_with_args\n response_json_string = RestClient.delete( path ,params, :authorization => \"Bearer #{token}\",\n\n :format => :json,\n\n :content_type => :json,\n\n :accept => :json\n ) # RestClient Post\n else nil\n\n end\n\n puts \" ---------- \"\n pp response_json_string\n puts \" ---------- \"\n response = API::ApiClient::Response.new(response_json_string, path)\n # update_history(response)\n if response.cookie\n @all_cookies = response.cookie\n puts \"new cookie...\"\n end\n @history << [path,response.body]\n\n response\n\n rescue => e\n puts \" ---------- \"\n puts e.message\n puts \" ---------- \"\n #puts \"rescuing ng api client call - #{e.message}\"\n\n #puts \"NG::ApiClient.call rescued - path: #{_path}\"\n #puts \"e.message: #{e.message}\"\n #response = XMS::NG::ApiClient::Response.new(e.message, path)\n e.message\n end\n\n end",
"def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def request!(&request)\n Transloadit::Response.new yield\n rescue RestClient::Exception => e\n Transloadit::Response.new e.response\n end",
"def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\")\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n \n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\")\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n \n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def rest_request(verb, url, data)\n if Rails.env.production?\n rest_production(verb, url, JSON.generate(data))\n else\n log_info(\"[#{Rails.env}]: #{verb} #{url}\", 200)\n end\n rescue RestClient::Exception => e\n log_error \"Failed with #{e.http_code}: #{e}\\n#{e.response}\", e.http_code\n end",
"def inspect\n \"Rod::Rest::Client<port: #{@web_client.port}, host: #{@web_client.host}>\"\n end",
"def request(params)\n\n # Add auth header\n headers = params[:headers] || {}\n headers['x-vcloud-authorization'] = @auth_key if !@auth_key.nil? || !@auth_key.equal?('')\n\n # set connection options\n options = {:url => params[:url],\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers || {},\n :method => params[:method] || 'GET'\n }\n\n # connect\n res = RestClient::Request.execute options\n\n raise res if (res.code!=params[:expects] && res.code!=200)\n\n res\n\n\n end",
"def rest_call(url, method, options = {})\n methods = %w{get post put}\n result = {\"status\" => \"ERROR\", \"response\" => \"\", \"message\" => \"\"}\n method = method.downcase\n verbose = get_option(options, \"verbose\") == \"yes\" or get_option(options, \"verbose\")\n headers = get_option(options, \"headers\", {:accept => :json, :content_type => :json})\n return result[\"message\"] = \"ERROR - #{method} not recognized\" unless methods.include?(method)\n log \"Rest URL: #{url}\" if verbose\n begin\n data = get_option(options, \"data\")\n rest_params = {}\n rest_params[:url] = url\n rest_params[:method] = method.to_sym\n rest_params[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE if url.start_with?(\"https\")\n rest_params[:payload] = data.to_json unless data == \"\"\n if options.has_key?(\"username\") && options.has_key?(\"password\")\n rest_params[:user] = options[\"username\"]\n rest_params[:password] = options[\"password\"]\n end\n rest_params[:headers] = headers\n log \"RestParams: #{rest_params.inspect}\" if verbose\n if %{put post}.include?(method)\n return result[\"message\"] = \"ERROR - no data param for post\" if data == \"\"\n response = RestClient::Request.new(rest_params).execute\n else\n response = RestClient::Request.new(rest_params).execute\n end\n rescue Exception => e\n result[\"message\"] = e.message\n raise \"RestError: #{result[\"message\"]}\" unless get_option(options, \"suppress_errors\") == true\n return result\n end\n log \"Rest Response:\\n#{response.inspect}\" if verbose\n if headers[:accept] == :json\n parsed_response = JSON.parse(response) rescue nil\n else\n parsed_response = response\n end\n parsed_response = {\"info\" => \"no data returned\"} if parsed_response.nil?\n result[\"code\"] = response.code\n if response.code < 300\n result[\"status\"] = \"success\"\n result[\"data\"] = parsed_response\n elsif response.code == 422\n result[\"message\"] = \"REST call returned code 422 usually a bad token\"\n else\n result[\"message\"] = \"REST call returned HTTP code #{response.code}\"\n end\n if result[\"status\"] == \"ERROR\"\n raise \"RestError: #{result[\"message\"]}\" unless get_option(options, \"suppress_errors\") == true\n end\n result\n end",
"def get_endpoint_info(client)\n response = client.get_endpoints()\n logger.info \"this is response for all endpoints #{response.inspect}\"\n if response[0]= 200\n # if api call is sucess \n all_endpoints= response[1][\"objects\"]\n logger.info \"entering parsing \"\n all_endpoints.each do |e|\n logger.info \"looking for a match beetween #{e[\"alias\"]} == #{self.id}\"\n if e[\"alias\"] == self.id.to_s\n #found the endpoint info\n logger.info \"found a match #{e.inspect}\"\n self.sip_endpoint = e\n add_to_phone(e)\n end \n end \n end\n end",
"def requestIngestAPI(method, url, timeout, payload, additionalErrorMessage=\"\")\n begin\n response = RestClient::Request.new(\n :method => method,\n :url => $oc_server + url,\n :user => $oc_user,\n :password => $oc_password,\n :timeout => timeout,\n :payload => payload\n ).execute\n rescue RestClient::Exception => e\n BigBlueButton.logger.error(\" A problem occured for request: #{url}\")\n BigBlueButton.logger.info( e)\n BigBlueButton.logger.info( e.http_body)\n BigBlueButton.logger.info( additionalErrorMessage)\n exit 1\n end\n\n return response\nend",
"def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\")\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\") # got from course notes. It consists of a secure form of getting webpage content.\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n \n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.inspect\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.inspect\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e.inspect\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"def parse_json(request_body)\n begin\n puts '-RESPONSE-'.yellow\n response = RestClient.post @url , request_body.to_json, {content_type: :json, accept: :json , Authorization: @access_token}\n rescue RestClient::ExceptionWithResponse => err\n puts '###################### ERROR #####################'.red\n p err.response\n write_to_error_file(@url, response, err.response)\n @number_of_timeouts += 1\n end\n p response\nend",
"def rest_client_get(api_call)\n response = nil\n with_retries(max_tries: 3, rescue: RestClient::Exception,\n base_sleep_seconds: 3.0, max_sleep_seconds: 10.1) do\n response = RestClient.get api_call\n fail RestClient::Exception if response.nil?\n end\n return response\n end",
"def consume_url; end",
"def rest_get(api_url)\n RestClient::Request.execute(method: :get,\n url: api_url,\n verify_ssl: @verify_ssl).body\n end",
"def get_raw(endpoint)\n RestClient.get(@url + endpoint)\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def get(service = [])\n begin \n url = API_ENDPOINT + service.join('/')\n hdrs = auth_headers()\n puts \"Headers: #{hdrs}\"\n \n response = RestClient.get(url, hdrs)\n raise \"request failed with #{response.code}\" unless response.code == 200\n \n json_hash = JSON.parse(response)\n \n rescue RestClient::Exception => e\n error_hash = JSON.parse(e.response)\n end\n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def service_request(service); end",
"def api_request(&block)\n response = begin\n block.call([])\n rescue RestClient::Exception => e\n if e.http_code == 401 # raise exception in case of token expiration\n raise e\n else\n e.response\n end\n end\n\n parse_and_format_response response\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def initialize(client, res)\n @client = client\n @status = res.status\n @headers = res.headers\n @env = res.env\n @body = res.body\n end",
"def retrieve!\n response = @client.rest_get(self.class::BASE_URI)\n body = @client.response_handler(response)\n set_all(body)\n true\n end",
"def rest_get\n ##define the url path\n url =\"/get\"\n\n ##This is headers definition.\n headers = [\n ['Cached-Control', \"no-cache\" ],\n [\"Content-Type\", \"application/x-www-form-urlencoded\"]\n ]\n begin\n #------------------------\n # Send Get Request\n #------------------------\n request, response = send_get(url, headers)\n\n if response.code.to_i == 200\n actual_value = response.body.chop!\n actual_value.gsub!(\"\\n\",\"\")\n return actual_value.gsub!(/\\s+/, \"\")\n else\n return false\n end\n rescue Exception => ex\n @log.error \"#### Response code is: #{response.code} #####\"\n @log.error ex.message\n puts \"#### Response code is: #{response.code} #####\"\n puts ex.message\n return false\n end\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def get_es_resource(resource)\n r = RestClient::Resource.new(\"#{config[:scheme]}://#{config[:server]}:#{config[:port]}/#{resource}\", timeout: 45)\n JSON.parse(r.get)\n rescue Errno::ECONNREFUSED\n warning 'Connection refused'\n rescue RestClient::RequestTimeout\n warning 'Connection timed out'\n end",
"def net_http_res; end",
"def rest_token_endpoint; end",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def request(type, *attributes)\n raw = RestClient.send(type, *attributes, :'User-Agent' => \"WhatsThisClient (https://github.com/whats-this/owo.rb, v#{OwO::VERSION})\")\n json = parse_json(raw)\n return json\n rescue RestClient::RequestEntityTooLarge\n raise OwO::Err::TooLarge, 'Requested files are too large!'\n rescue RestClient::Unauthorized\n raise OwO::Err::BadToken, 'Token is invalid!'\n rescue RestClient::BadRequest => e\n raw = e.response\n json = parse_json(raw)\n raise OwO::Err::TooManyFiles, 'You requested too many files!' if json.is_a?(Hash) && json['description'] == 'too many files'\n raise OwO::Err::BadURL, 'Your URL is invalid!' if !json.is_a?(Hash) && raw == 'invalid URL'\n err = if json.is_a?(Hash)\n json['description']\n else\n raw\n end\n raise err\n rescue RestClient::InternalServerError\n raise OwO::Err::ServerFail, 'Server Error!'\n rescue RuntimeError => e\n raise e\n end",
"def rest_call(call,base_uri,json_payload,access_token)\n params =\n {\"Authorization\" => \"Bearer #{access_token}\",\n :content_type => 'application/json',\n :accept => 'application/json',\n :verify => false}\n case call\n when \"get\"\n response = rest_get(base_uri,params)\n when \"post\"\n response = rest_post(base_uri,json_payload,params)\n when \"patch\"\n response = rest_patch(base_uri,json_payload,params)\n end\n return response\n end",
"def http; end",
"def find_custom_data(endpoint, id)\n restHttpGet(\"#{endpoint}/#{id}/custom\")\n case @res.code\n when 200\n JSON.parse(@res)\n when 404\n nil\n else\n @res.code.to_s.should match(/^(200|404)$/)\n end\nend",
"def parse_api(link)\n movie_data ={}\n movie_url_link = RestClient.get(link)\n movie_data = JSON.parse(movie_url_link)\n # binding.pry\nend",
"def test_connection\n args = get_connection_args(\"#{endpoint}/auth\")\n args[:raw_response] = true\n RestClient::Request.execute(args)\n end",
"def build_rest_client(url)\n RestClient::Resource.new(URI.encode(url), :verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n end",
"def make_request(method, endpoint, payload={})\n params = [\"#{API_URL_BASE}/#{endpoint}\", payload, @request_header]\n begin\n JSON.parse RestClient.send(method.to_sym, *params.reject { |p| p.empty? })\n rescue RestClient::Unauthorized => e\n # an authorization error is indicative that the configuration won't work,\n # not that an individual request errored, so raise instead of recovering\n raise \n rescue RestClient::Exception => e\n # attempt to handle other RestClient exceptions gracefully\n # return the erorr message and keep moving\n return { \"error\" => e.message }\n end\n end",
"def fetchServerConfig()\n #Construct the URL for the request\n url = \"http://api.themoviedb.org/3/configuration?api_key=#{$apiKey}\"\n #Preform a restful reqeust for the data\n data = RestClient.get(url)\n #Parse the returned JSON and return it as a hash\n return JSON.parse(data)\nend",
"def response_body=(_arg0); end",
"def client_detail\n service_response = UserManagement::GetClientDetail.new(params).perform\n render_api_response(service_response)\n end",
"def get_data(path, &block)\n url = \"#{host}/api/v#{version}/#{path}\"\n params = Jbuilder.encode(&block) if block_given?\n params ||= {}\n resource = RestClient::Resource.new(\n url, \n headers: {\n \"uid\" => @uid,\n \"client\" => @client,\n \"access-token\" => @access_token\n },\n :verify_ssl => false\n )\n resource.get(params) do |response, request, result, &blk|\n case response.code\n when 200\n auth_data = {\n uid: response.headers[:uid],\n client: response.headers[:client],\n access_token: response.headers[:access_token]\n }\n JSON.parse(response).merge(auth_data)\n when 404\n nil\n else\n JSON.parse(response)\n end\n end\n end",
"def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend",
"def test_read_all_info\n get '/v1/read_all?data=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D'\n assert last_response.ok?\n assert last_response.body.include?('Eduardo')\n assert last_response.body.include?('Brazil')\n end",
"def perform_request(method, url, data, json = true)\n options = { cookies: @cookies }.merge( @request_options )\n \n if json\n options[:content_type] = \"application/json\"\n data = MultiJson.dump( data )\n end\n\n response = if method.to_sym == :get\n ::RestClient.send( method, url, options )\n else\n ::RestClient.send( method, url, data, options )\n end\n\n @cookies = response.try(:cookies)\n\n response.body\n rescue RestClient::ExceptionWithResponse => e\n @cookies = e.response.try(:cookies) \n raise e \n end",
"def get_response\n raise NotImplementedError.new(\"method not overriden\")\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def get(*params); raise('Stub or mock required.') end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend",
"def delete_request(client)\n begin\n client.delete\n rescue OpenSSL::SSL::SSLError => e\n raise \"SSLError occurred when calling REST service; #{e}\"\n rescue RestClient::Exception => e # if the request failed, RestClient will throw an error. We want to retrieve that error and the response within\n puts \"RestClient::Exception hit when calling REST service\"\n puts e\n puts e.response\n return e.response\n rescue => e\n raise \"Unexpected error occurred when calling REST service; #{e}\"\n end\n end",
"def call_rest(verb, url, xml=nil, content_type='text/xml')\n begin\n case verb.to_sym\n when :get\n RestClient.get(url)\n when :post\n RestClient.post(url, xml, :content_type => content_type)\n when :put\n RestClient.put(url, xml, :content_type => content_type)\n when :delete\n RestClient.delete(url)\n end\n rescue => e\n puts \"Exception at: #{url}\"\n puts e.response ? e.response : e\n end\n end",
"def modify_data(method, path, &block)\n url = \"#{host}/api/v#{version}/#{path}\"\n params = Jbuilder.encode(&block)\n resource = RestClient::Resource.new(\n url, \n headers: {\n \"uid\" => @uid,\n \"client\" => @client,\n \"access-token\" => @access_token\n }\n )\n resource.send(method.downcase, params, content_type: :json, accept: :json) do |response, request, result, &blk|\n case response.code\n when 200\n if response.blank?\n true\n else\n auth_data = {\n uid: response.headers[:uid],\n client: response.headers[:client],\n access_token: response.headers[:access_token]\n }\n JSON.parse(response).merge(auth_data)\n end\n else\n if response.blank?\n false\n else\n JSON.parse(response) rescue { error: response }\n end\n end\n end\n end",
"def get_data(flag, url)\n data = \"\"\n response = 0\n if flag == true\n response = RestClient.get(url)\n data = JSON.load response\n end\n return data\nend",
"def rest_token_endpoint=(_arg0); end",
"def client\n @client ||= Curl::Easy.new\n end",
"def get_events_from_api(name)\n #make the web request\n name1 = name\n performer_link = \"https://app.ticketmaster.com/discovery/v2/events.json?keyword=#{name1}&countrycode=US&apikey=ShI4Sd340EJ32f1k6rUgkYPocLSO2qTq\"\n response_string = RestClient.get(performer_link)\n response_hash = JSON.parse(response_string)\nend",
"def response_body; end",
"def response_body; end",
"def restRequest(url)\n printDebugMessage('restRequest', 'Begin', 11)\n printDebugMessage('restRequest', 'url: ' + url, 12)\n # Split URL into components\n uri = URI.parse(url)\n # Get the resource\n userAgent = getUserAgent()\n data = uri.read('User-agent' => userAgent)\n printDebugMessage('restRequest', 'data: ' + data, 21)\n printDebugMessage('restRequest', 'End', 11)\n return data\n end",
"def request\n @rest_response.request\n end"
] | [
"0.68007314",
"0.68007314",
"0.66991985",
"0.6648439",
"0.664728",
"0.6642553",
"0.6429192",
"0.6427094",
"0.6423713",
"0.64099985",
"0.6333346",
"0.6315692",
"0.62648267",
"0.6262084",
"0.6244502",
"0.6177767",
"0.61741346",
"0.61678636",
"0.6162164",
"0.61322016",
"0.6117541",
"0.61122483",
"0.6106993",
"0.608348",
"0.60445255",
"0.60397136",
"0.60362154",
"0.6009272",
"0.6007516",
"0.5973998",
"0.5958361",
"0.5945347",
"0.5929187",
"0.59273446",
"0.5903937",
"0.5887295",
"0.5872505",
"0.58651197",
"0.5864665",
"0.5864665",
"0.58626926",
"0.58592176",
"0.5854008",
"0.58522004",
"0.5847058",
"0.5839895",
"0.5827582",
"0.58250695",
"0.58209777",
"0.58176017",
"0.5813091",
"0.5808509",
"0.5797773",
"0.5777171",
"0.5772577",
"0.57610554",
"0.57600987",
"0.574726",
"0.57387435",
"0.5737485",
"0.5735268",
"0.5735268",
"0.5723408",
"0.57101905",
"0.5708698",
"0.5702434",
"0.56977373",
"0.56868863",
"0.5681973",
"0.5674177",
"0.5672528",
"0.5667949",
"0.56607705",
"0.5650307",
"0.5649555",
"0.56463885",
"0.5643541",
"0.56408143",
"0.56350327",
"0.56332624",
"0.5626952",
"0.56268567",
"0.5618772",
"0.5616467",
"0.56143266",
"0.5611449",
"0.56043774",
"0.56028515",
"0.5594435",
"0.55848086",
"0.5580507",
"0.5577912",
"0.5576551",
"0.5574759",
"0.55677944",
"0.5565768",
"0.5565765",
"0.55648625",
"0.55648625",
"0.5557367",
"0.5557366"
] | 0.0 | -1 |
takes population density, population, and states and puts them in to predicted death and speed of spread methods | def virus_effects
predicted_deaths
speed_of_spread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virus_effects \n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population)\n speed_of_spread(@population_density)\n # Deleted out @state because it isn't being used in either method\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop.\n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n \n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop. \n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def predicted_deaths #(population_density, population, state)\n # How are arguements initialized inside a method?\n # => As local variables.\n \n # population NOT @population\n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end",
"def deaths_spread(population_density, population, state)\n speed = 0.0\n case \n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n #speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n #speed_of_spread(@population_density, @state)\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # Arguements are initialized as local variables inside a method.\n\n #predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n\n # @number_of_deaths = @population * if @population_density >= 200\n # 0.4\n # elsif @population_density >= 150\n # 0.3\n # elsif @population_density >= 100\n # 0.2\n # elsif @population_density >= 50\n # 0.1\n # else\n # 0.05\n # end\n\n # @number_of_deaths = @number_of_deaths.floor\n # end\n\n # Predicts speed of spread for each state based on population density.\n def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # @speed = 0.0\n\n if @population_density >= 200\n @speed = 0.5\n elsif @population_density >= 150\n @speed = 1\n elsif @population_density >= 100\n @speed = 1.5\n elsif @population_density >= 50\n @speed = 2\n else\n @speed = 2.5\n end\n end\n\n def print_results\n puts \"#{@state} will lose #{@number_of_deaths} people in this outbreak and will spread across the state in #{@speed} months.\"\n puts \"\\n\"\n end\n\nend",
"def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end",
"def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density,@population,@state)\n speed_of_spread(@population_density, @state)\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n #popd = [200, 150, 100, 50]\n #perc = [0.4, 0.3, 0.2, 0.1]\n\n #popd[i]\n\n if @population_density < 50\n number_of_deaths = (@population * 0.05)\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n else @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\r\n \r\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\r\n \r\n number_of_deaths = (@population * 0.05).floor if @population_density >= 0\r\n \r\n # end\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end",
"def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density.to_i/50) * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak!!!\\n\"\n\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths # (@population_density, @population, @state)\n speed_of_spread # (@population_density, @state)\n end",
"def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end",
"def virus_effects\r\n predicted_deaths\r\n #delete the passing arguments, not necessary since all of them are instance variable\r\n #(@population_density, @population, @state)\r\n speed_of_spread\r\n #this one too\r\n #(@population_density, @state)\r\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def virus_effects \n # predicted_deaths(@population_density, @population, @state) - ORIGINAL\n # speed_of_spread(@population_density, @state) - ORIGINAL\n # REFACTOR\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\r\n #predicted_deaths #(@population_density, @population, @state)\r\n #speed_of_spread #(@population_density, @state)\r\n\r\n if @population_density >= 200\r\n predicted_deaths(@population, 0.4)\r\n speed_of_spread(0.5)\r\n elsif @population_density >= 150\r\n predicted_deaths(@population, 0.3)\r\n speed_of_spread(1)\r\n elsif @population_density >= 100\r\n predicted_deaths(@population, 0.2)\r\n speed_of_spread(1.5)\r\n elsif @population_density >= 50\r\n predicted_deaths(@population, 0.1)\r\n speed_of_spread(2.0)\r\n else\r\n predicted_deaths(@population, 0.05)\r\n speed_of_spread(2.5)\r\n end\r\n\r\n end",
"def virus_effects\n predicted_deaths#(population_density, population, state)\n\n speed_of_spread#(population_density, state)\n # predicted_deaths(@population_density, @population, @state)\n # speed_of_spread(@population_density, @state)\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def virus_effects\n # This is the beginning of object oriented design.\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n print_results\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # perhaps a case statement is a little more dry?\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n case when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n when\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # Refactored method by simplifying the calculation to make the code more DRY\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population *(@population_density/50 * 0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n # Original method \n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n #predicted_deaths_and_speed(@population_density, @population, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n pdeathshash1 = {0..49 => (@population * 0.05).floor, 50..99 => (@population * 0.1).floor, 100..149 => (@population * 0.2).floor, 150..199 => (@population * 0.3).floor, 200..10000000 => (@population * 0.04).floor}\n pdeathshash1.each do |range, deaths|\n if (range).include?(@population_density.floor)\n print \"#{@state} will lose #{deaths} people in this outbreak\"\n end\n end\n\n\n end",
"def virus_effects\n predicted_deaths(@state_density, @population)\n speed_of_spread(@state_density)\n end",
"def predicted_deaths #(population_density, population, state)\n \n # How are arguements initialized inside a method?\n # - As local variables.\n \n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor #.floor is to always round down the number\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def virus_effects\n predicted_deaths(population_density, population, state)\n speed_of_spread(population_density, state)\n end",
"def predicted_deaths(population_density, population, state)\n \n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def virus_effects\n # predicted_deaths(@population_density, @population, @state)\n # speed_of_spread(@population_density, @state)\n predicted_deaths\n speed_of_spread\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population_density * (0.1 * (@population / 50)) ).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state) #create a method, called predicted_deaths, give it an array of population density, population, and state\n if @population_density >= 200 #if population density is greater than or equal to 200 then set number of deaths equal to population time .4 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150 #if population density is greater than or equal to 150 then set number of deaths equal to population time .3 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100 #if population density is greater than or equal to 100 then set number of deaths equal to population time .2 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50 #if population density is greater than or equal to 50 then set number of deaths equal to population time .1 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.1).floor\n else #if population density is greater than 0 then set number of deaths equal to population time .5 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.05).floor\n end #ends if/else\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" #prints out what state will lose x number of people in the outbreak\n\n end",
"def virus_effects\r\n # predicted_deaths(@population_density, @population, @state)\r\n # speed_of_spread(@population_density, @state)\r\n predicted_deaths\r\n speed_of_spread\r\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n \nend",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n fractions = [0.4, 0.3, 0.2, 0.1, 0.05]\n density = [200, 150, 100, 50, 0]\n \n index = 0\n while index < density.length\n if @population_density >= density[index]\n number_of_deaths = (@population * fractions[index]).floor\n break\n end\n index += 1\n end\n \n # if @population_density >= density[0]\n # number_of_deaths = (@population * fractions[0]).floor\n # elsif @population_density >= density[1]\n # number_of_deaths = (@population * fractions[1]).floor\n # elsif @population_density >= density[2]\n # number_of_deaths = (@population * fractions[2].floor\n # elsif @population_density >= density[3]\n # number_of_deaths = (@population * fractions[3]).floor\n # else\n # number_of_deaths = (@population * fractions[4]).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n # case @population_density\r\n # \twhen @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n # \twhen @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n # end\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = death_percentage(0.4)\n elsif @population_density >= 150\n number_of_deaths = death_percentage(0.3)\n elsif @population_density >= 100\n number_of_deaths = death_percentage(0.2)\n elsif @population_density >= 50\n number_of_deaths = death_percentage(0.1)\n else\n number_of_deaths = death_percentage(0.05)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def all_states\n STATE_DATA.each do |x, y|\n state = VirusPredictor.new(x, STATE_DATA[x][:population_density], STATE_DATA[x][:population], STATE_DATA[x][:region], STATE_DATA[x][:regional_spread])\n state.virus_effects\n end\nend",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density)\n end",
"def report(states)\n states.each do | state, data |\n VirusPredictor.new(state, data[:population_density], data[:population]).virus_effects\n end\nend",
"def predicted_deaths(population_density, population, state)\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def access_state_data\n STATE_DATA.each do |state, population_hash|\n VirusPredictor.new(state, population_hash[:population_density], population_hash[:population]).virus_effects\n end\nend",
"def predicted_deaths(population_density, population, state)\n if population_density >= 200 # predicted_deaths passes in the population density and population and uses a ratio to determine the number effected by the virus\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else \n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end",
"def predicted_deaths(@population_density, @population, @state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths # Its gonna predict number of deaths based on population density by muliplying population by given factor, for each state\n array = [50, 100, 150, 200].reverse\n array.each do |end_of_range|\n if @population_density >= end_of_range\n number_of_deaths = ( @population * end_of_range / 500 )\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n break\n else\n number_of_deaths = (@population * 0.05).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n break\n end\n end\n end",
"def all_50\n STATE_DATA.each do |state_name,values|\n # state = Alabama\n # values ={population_density: 94.65, population: 4822023}\n state = VirusPredictor.new(state_name, values[:population_density], values[:population])\n state.virus_effects\n end\nend",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def virus_effects\n predicted_deaths#(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end",
"def report\n STATE_DATA.each do |state, population_info|\n state = VirusPredictor.new(state, population_info[:population_density], population_info[:population])\n state.virus_effects\n end\nend",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n factor = case population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4 \n end\n number_of_deaths = (population * factor).floor\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n # if population_density >= 200\n # number_of_deaths = (population * 0.4).floor\n # elsif population_density >= 150\n # number_of_deaths = (population * 0.3).floor\n # elsif population_density >= 100\n # number_of_deaths = (population * 0.2).floor\n # elsif population_density >= 50\n # number_of_deaths = (population * 0.1).floor\n # else\n # number_of_deaths = (population * 0.05).floor\n # end\n pop_percentage = 0.0\n density_test = 50\n if population_density >= 50\n while population_density >= density_test do \n pop_percentage += 0.1\n density_test += 50\n end\n number_of_deaths = (population * pop_percentage).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def speed_of_spread(predicted_deaths)\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # I neatened this up, but didn't make another method since it doesn't calculate. \n case @population_density \n\n when 0...50 then speed += 2.5\n when 50...100 then speed += 2.0\n when 100...150 then speed += 1.5\n when 150...200 then speed += 1.0\n else speed += 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def all_states\n STATE_DATA.each do |state_name, data|\n territory = VirusPredictor.new(state_name, data[:population_density], data[:population])\n territory.virus_effects\n end\nend",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n case\r\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\r\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\r\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\r\n end\r\n \r\n \r\n \r\n# if @population_density >= 200\r\n# number_of_deaths = (@population * 0.4).floor\r\n# elsif @population_density >= 150\r\n# number_of_deaths = (@population * 0.3).floor\r\n# elsif @population_density >= 100\r\n# number_of_deaths = (@population * 0.2).floor\r\n# elsif @population_density >= 50\r\n# number_of_deaths = (@population * 0.1).floor\r\n# else\r\n# number_of_deaths = (@population * 0.05).floor\r\n# end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def all_states\n STATE_DATA.each do |state_name, data|\n territory = VirusPredictor.new(state_name, data[:population_density], data[:population])\n territory.virus_effects\n end\nend",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n\n x = 1\n\n number_of_deaths = (@population * x).floor\n case @population_density\n\n when (150...200)\n x = 0.3\n when (100...150)\n x = 0.2\n when (50...100)\n x = 0.1\n when (0...50)\n x= 0.05\n else\n x = 0.4\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end"
] | [
"0.7437621",
"0.7377336",
"0.736164",
"0.7346512",
"0.7339851",
"0.73228055",
"0.73001295",
"0.72830653",
"0.7275434",
"0.7275434",
"0.7269767",
"0.72584915",
"0.7237899",
"0.7237899",
"0.7212133",
"0.7212133",
"0.7212133",
"0.7212133",
"0.7212133",
"0.7212133",
"0.7212133",
"0.7212133",
"0.7204519",
"0.7180565",
"0.7171493",
"0.71710277",
"0.71710217",
"0.71690255",
"0.7165331",
"0.71608514",
"0.71434224",
"0.7134448",
"0.713144",
"0.7128288",
"0.71232104",
"0.71195996",
"0.711327",
"0.7105167",
"0.7105167",
"0.7105167",
"0.7105167",
"0.7105167",
"0.7105167",
"0.71006274",
"0.70948523",
"0.7084557",
"0.70829606",
"0.708007",
"0.70755756",
"0.70755756",
"0.70755756",
"0.70755756",
"0.70755756",
"0.70755756",
"0.7074267",
"0.70718414",
"0.7070854",
"0.7066287",
"0.70492077",
"0.704785",
"0.704657",
"0.704657",
"0.704657",
"0.704657",
"0.704657",
"0.70436597",
"0.70416903",
"0.7041573",
"0.70357305",
"0.7032522",
"0.7029788",
"0.7019627",
"0.7018795",
"0.70038396",
"0.69982773",
"0.6991282",
"0.69907045",
"0.6987815",
"0.69780254",
"0.6971947",
"0.6963831",
"0.6958141",
"0.69565386",
"0.6946764",
"0.6946473",
"0.69461143",
"0.69396013",
"0.69396013",
"0.69396013",
"0.69396013",
"0.69396013",
"0.69396013",
"0.69396013",
"0.6917079",
"0.690031",
"0.6900187",
"0.6898352",
"0.6896389",
"0.68949455",
"0.68902904",
"0.688934"
] | 0.0 | -1 |
Takes the parameters pop density, population, and state and runs them through the conditional statements | def predicted_deaths
# predicted deaths is solely based on population density
if @population_density >= 200
number_of_deaths = (@population * 0.4).floor
elsif @population_density >= 150
number_of_deaths = (@population * 0.3).floor
elsif @population_density >= 100
number_of_deaths = (@population * 0.2).floor
elsif @population_density >= 50
number_of_deaths = (@population * 0.1).floor
else
number_of_deaths = (@population * 0.05).floor
end
print "#{@state} will lose #{number_of_deaths} people in this outbreak"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n \nend",
"def predicted_deaths#(#population_density, population, state)\n # Method takes in three arguments, and it compares population density with the given criteria ,\n # predicted deaths is solely based on population density\n\n def predicted_deaths\n case true\n when @population_density >= 200 then (@population * 0.4).floor\n when @population_density >= 150 then (@population * 0.3).floor\n when @population_density >= 100 then (@population * 0.2).floor\n when @population_density >= 50 then (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n #prints the number of deaths along with the state's name\n puts \"#{@state} will lose #{@predicted_deaths} people in this outbreak\"\n end\n end",
"def predicted_deaths #(population_density, population, state)\n # How are arguements initialized inside a method?\n # => As local variables.\n \n # population NOT @population\n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end",
"def predicted_deaths #(population_density, population, state)\n \n # How are arguements initialized inside a method?\n # - As local variables.\n \n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor #.floor is to always round down the number\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n \n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop. \n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def predicted_deaths #(population_density, population, state)\n\n # Pro Tip: You can set a variable equal to the RESULT of a conditional statement.\n number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop.\n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n case \n \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n\n when @population_density >= 50 then number_of_deaths = (@population * 0.5).floor\n\n\n else number_of_deaths = (@population * 0.05).floor\n\n end\n\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n #\n #number_of_deaths = (@population * 0.05).floor\n #end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # Arguements are initialized as local variables inside a method.\n\n #predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n\n # @number_of_deaths = @population * if @population_density >= 200\n # 0.4\n # elsif @population_density >= 150\n # 0.3\n # elsif @population_density >= 100\n # 0.2\n # elsif @population_density >= 50\n # 0.1\n # else\n # 0.05\n # end\n\n # @number_of_deaths = @number_of_deaths.floor\n # end\n\n # Predicts speed of spread for each state based on population density.\n def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # @speed = 0.0\n\n if @population_density >= 200\n @speed = 0.5\n elsif @population_density >= 150\n @speed = 1\n elsif @population_density >= 100\n @speed = 1.5\n elsif @population_density >= 50\n @speed = 2\n else\n @speed = 2.5\n end\n end\n\n def print_results\n puts \"#{@state} will lose #{@number_of_deaths} people in this outbreak and will spread across the state in #{@speed} months.\"\n puts \"\\n\"\n end\n\nend",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n#Attempting another solution:\n# if @population_density < 50\n# number_of_deaths = (@population * 0.05).floor\n# elsif @population_density > 200\n# number_of_deaths = (@population * 0.04).floor\n# else\n# multiplier = (@population_density/50 * 0.1)\n# number_of_deaths = (@population * multiplier).floor\n# end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n case\r\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\r\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\r\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\r\n end\r\n \r\n \r\n \r\n# if @population_density >= 200\r\n# number_of_deaths = (@population * 0.4).floor\r\n# elsif @population_density >= 150\r\n# number_of_deaths = (@population * 0.3).floor\r\n# elsif @population_density >= 100\r\n# number_of_deaths = (@population * 0.2).floor\r\n# elsif @population_density >= 50\r\n# number_of_deaths = (@population * 0.1).floor\r\n# else\r\n# number_of_deaths = (@population * 0.05).floor\r\n# end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def deaths_spread(population_density, population, state)\n speed = 0.0\n case \n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread\n more_dense = @population_density >= 200\n dense = @population_density >= 150\n medium_dense = @population_density >= 100\n low_dense = @population_density >= 50#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n if more_dense\n speed += 0.5\n elsif dense\n speed += 1\n elsif medium_dense\n speed += 1.5\n elsif low_dense\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths(population_density, population, state) #create a method, called predicted_deaths, give it an array of population density, population, and state\n if @population_density >= 200 #if population density is greater than or equal to 200 then set number of deaths equal to population time .4 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150 #if population density is greater than or equal to 150 then set number of deaths equal to population time .3 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100 #if population density is greater than or equal to 100 then set number of deaths equal to population time .2 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50 #if population density is greater than or equal to 50 then set number of deaths equal to population time .1 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.1).floor\n else #if population density is greater than 0 then set number of deaths equal to population time .5 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.05).floor\n end #ends if/else\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" #prints out what state will lose x number of people in the outbreak\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n=begin \nNot quite working yet...\n if @population >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @poplation < 200 && @poplation >= 50\n number_of_deaths = (@population * ((@population / 50).floor / 10.0)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n=end\n \n case @population_density\n when 200.. 10000000000000000000000000000 then number_of_deaths = (@population * 0.4).floor\n when 150.. 199 then number_of_deaths = (@population * 0.3).floor\n when 100.. 149 then number_of_deaths = (@population * 0.2).floor\n when 50.. 99 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n pdeathshash1 = {0..49 => (@population * 0.05).floor, 50..99 => (@population * 0.1).floor, 100..149 => (@population * 0.2).floor, 150..199 => (@population * 0.3).floor, 200..10000000 => (@population * 0.04).floor}\n pdeathshash1.each do |range, deaths|\n if (range).include?(@population_density.floor)\n print \"#{@state} will lose #{deaths} people in this outbreak\"\n end\n end\n\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if population_density >= 200 # predicted_deaths passes in the population density and population and uses a ratio to determine the number effected by the virus\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else \n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n when @population_density >= 200 then speed += 0.5\n when @population_density >= 150 then speed += 1\n when @population_density >= 100 then speed += 1.5\n when @population_density >= 50 then speed += 2\n else speed += 2.5\nend",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n #else\n # number_of_deaths = (@population * 0.05).floor\n #end\n \n #use case statement to refactor code\n case @population_density\n when 1...49 \n number_of_deaths = (@population * 0.1).floor\n when 50...99\n number_of_deaths = (@population * 0.2).floor\n When 100..149\n number_of_deaths = (@population * 0.3).floor\n when 150...200\n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n#we can remove this and have it print within virus_effects so that this method does one thing\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n #popd = [200, 150, 100, 50]\n #perc = [0.4, 0.3, 0.2, 0.1]\n\n #popd[i]\n\n if @population_density < 50\n number_of_deaths = (@population * 0.05)\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n else @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n ## Refactored for Release: 8\n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths()\r\n # predicted deaths is solely based on population density\r\n\r\n#refractor\r\n case\r\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\r\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\r\n else number_of_deaths = (@population * 0.05).floor\r\n end\r\n #\r\n # if @population_density >= 200\r\n # number_of_deaths = (@population * 0.4).floor\r\n # elsif @population_density >= 150\r\n # number_of_deaths = (@population * 0.3).floor\r\n # elsif @population_density >= 100\r\n # number_of_deaths = (@population * 0.2).floor\r\n # elsif @population_density >= 50\r\n # number_of_deaths = (@population * 0.1).floor\r\n # else\r\n # number_of_deaths = (@population * 0.05).floor\r\n # end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def predicted_deaths # Takes three parameters and computes the values based on the inputs. \n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" # This returns the values. \n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # Refactored method by simplifying the calculation to make the code more DRY\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population *(@population_density/50 * 0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n # Original method \n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n\n=begin\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n=end\n\n factor = case @population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def check_50_states\n STATE_DATA.each do |state, state_data_hash|\n VirusPredictor.new(state, state_data_hash[:population_density], state_data_hash[:population]).virus_effects\n end\nend",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n if @population_density\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n # if population_density >= 200\n # number_of_deaths = (population * 0.4).floor\n # elsif population_density >= 150\n # number_of_deaths = (population * 0.3).floor\n # elsif population_density >= 100\n # number_of_deaths = (population * 0.2).floor\n # elsif population_density >= 50\n # number_of_deaths = (population * 0.1).floor\n # else\n # number_of_deaths = (population * 0.05).floor\n # end\n pop_percentage = 0.0\n density_test = 50\n if population_density >= 50\n while population_density >= density_test do \n pop_percentage += 0.1\n density_test += 50\n end\n number_of_deaths = (population * pop_percentage).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n #else\n # number_of_deaths = (@population * 0.05).floor\n #end\n \n #use case statement to refactor code\n case @population_density\n when 1...49 \n number_of_deaths = (@population * 0.1).floor\n when 50...99\n number_of_deaths = (@population * 0.2).floor\n When 100..149\n number_of_deaths = (@population * 0.3).floor\n when 150...200\n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n\n if @population_density >= 200\n @speed += 0.5\n elsif @population_density >= 150\n @speed += 1\n elsif @population_density >= 100\n @speed += 1.5\n elsif @population_density >= 50\n @speed += 2\n else\n @speed += 2.5\n end\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population_density * (0.1 * (@population / 50)) ).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def initialize(state_of_origin, population_density, population)\n puts \"creating\"\n @state = state_of_origin\n @population = population\n @population_density = population_density\n\n end",
"def predicted_deaths\n# predicted deaths is solely based on population density\nif @population_density >= 200\n multiplier = 0.4\nelsif @population_density >= 150\n multiplier = 0.3\nelsif @population_density >= 100\n multiplier = 0.2\nelsif @population_density >= 50\n multiplier = 0.1\nelse\n multiplier = 0.05\nend\n number_of_deaths = (@population * multiplier).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\nend",
"def virus_effects\r\n #predicted_deaths #(@population_density, @population, @state)\r\n #speed_of_spread #(@population_density, @state)\r\n\r\n if @population_density >= 200\r\n predicted_deaths(@population, 0.4)\r\n speed_of_spread(0.5)\r\n elsif @population_density >= 150\r\n predicted_deaths(@population, 0.3)\r\n speed_of_spread(1)\r\n elsif @population_density >= 100\r\n predicted_deaths(@population, 0.2)\r\n speed_of_spread(1.5)\r\n elsif @population_density >= 50\r\n predicted_deaths(@population, 0.1)\r\n speed_of_spread(2.0)\r\n else\r\n predicted_deaths(@population, 0.05)\r\n speed_of_spread(2.5)\r\n end\r\n\r\n end",
"def predicted_deaths(population_density, population, state) # defining a method which takes three arguments, \n # => and using an if-elsif tree to calculate number of deaths\n # => If population density falls within a particular range, multiply population by a value\n # and round it down to the nearest integer.\n # => Use string interpolation to print string which includes state name and the number\n # of deaths.\n=begin\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n=end\n predictor = case @population_density\n when 0..50\n 0.05\n when 50..100\n 0.1\n when 100..150\n 0.2\n when 150..200\n 0.3\n else\n 0.4\n end\n return (@population_density * predictor).floor\n end",
"def predicted_deaths\n predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n\n# maybe need to find a way to write an algorithm that factors population density in number ranges\n\n # if @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.2).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n num = 0.4\r\n elsif @population_density >= 150\r\n num = 0.3\r\n elsif @population_density >= 100\r\n num = 0.2\r\n elsif @population_density >= 50\r\n num = 0.1\r\n else\r\n num = 0.05\r\n end\r\nnumber_of_deaths = (@population * num).floor\r\n\r\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # perhaps a case statement is a little more dry?\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n end",
"def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n densities = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\r\n\r\n densities.each do |density, ratio|\r\n if @population_density >= density\r\n @number_of_deaths = (@population * ratio).floor\r\n end\r\n end\r\n\r\n=begin - refactored\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n=end\r\n\r\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def predicted_deaths\n \n \n # predicted deaths is solely based on population density\n \n # no variable stated since @population_density is already being evaluted\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n case when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n when\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n \n\n\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density.to_i/50) * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak!!!\\n\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n death_factor = 0.05\r\n case @population_density\r\n when (200..10000000000) then death_factor = 0.4\r\n when (150..199) then death_factor = 0.3\r\n when (100..149) then death_factor = 0.2\r\n when (50..99) then death_factor = 0.1\r\n end\r\n\r\n=begin\r\n if @population_density >= 200\r\n death_factor = 0.4\r\n # number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n death_factor = 0.3\r\n #number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n death_factor = 0.2\r\n # number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n death_factor = 0.1\r\n # number_of_deaths = (@population * 0.1).floor\r\n else\r\n death_factor = 0.05\r\n # number_of_deaths = (@population * 0.05).floor\r\n end\r\n=end\r\n print \"#{@state} will lose #{(@population * death_factor).floor} people in this outbreak\"\r\n\r\n end",
"def predicted_deaths(population,rate) #(population_density, population, state)\r\n number_of_deaths = (population * rate).floor\r\n # predicted deaths is solely based on population density\r\n #if @population_density >= 200\r\n # number_of_deaths = (@population * 0.4).floor\r\n #elsif @population_density >= 150\r\n # number_of_deaths = (@population * 0.3).floor\r\n #elsif @population_density >= 100\r\n # number_of_deaths = (@population * 0.2).floor\r\n #elsif @population_density >= 50\r\n # number_of_deaths = (@population * 0.1).floor\r\n #else\r\n # number_of_deaths = (@population * 0.05).floor\r\n #end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def predicted_deaths(population_density, population, state)\n \n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n \n pop = @population_density\n case pop \n when pop >= 200 \n number_of_deaths = (@population * 0.4).floor\n when pop >= 150 \n number_of_deaths = (@population * 0.3).floor\n when pop >= 100 \n number_of_deaths = (@population * 0.2).floor\n when pop >= 50 \n number_of_deaths = (@population * 0.1).floor \n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" end",
"def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n# if @population_density >= 200\r\n# @number_of_deaths = (@population * 0.4).floor\r\n# elsif @population_density >= 150\r\n# @number_of_deaths = (@population * 0.3).floor\r\n# elsif @population_density >= 100\r\n# @number_of_deaths = (@population * 0.2).floor\r\n# elsif @population_density >= 50\r\n# @number_of_deaths = (@population * 0.1).floor\r\n# else\r\n# @number_of_deaths = (@population * 0.05).floor\r\n# end\r\n case @population_density\r\n when 0...49 then @number_of_death = (@population * 0.05).floor\r\n when 50...99 then @number_of_death=(@population * 0.1).floor\r\n when 100...149 then @number_of_death=(@population * 0.2).floor\r\n when 150...200 then @number_of_death=(@population * 0.3).floor\r\n else @number_of_death=(@population * 0.4).floor\r\n end \r\n print \"#{@state} will lose #{@number_of_death} people in this outbreak\"\r\n\r\n end",
"def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def speed_of_spread(population_density) #in months\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else \n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\n# We are still perfecting our formula here. The speed is also affected\n# by additional factors we haven't added into this functionality.\nif @population_density >= 200\n speed = 0.5\nelsif @population_density >= 150\n speed = 1\nelsif @population_density >= 100\n speed = 1.5\nelsif @population_density >= 50\n speed = 2\nelse\n speed = 2.5\nend\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\nend",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0 # forces float\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n# Use case/when for determining number of deaths\n case @population_density\n when @population_density >= 200; number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150; number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100; number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50; number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0\r\n case @population_density\r\n when (200..10000000000) then speed = 0.5\r\n when (150..199) then speed = 1\r\n when (100..149) then speed = 1.5\r\n when (50..99) then speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n # binding.pry\r\n\r\n\r\n=begin\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n=end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = case @population\n when 200..Float::INFINITY then (@population * 0.4).floor \n when 150..199 then (@population * 0.3).floor\n when 100..149 then (@population * 0.2).floor\n when 50..99 then (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n=begin\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" \n=end \n end",
"def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def speed_of_spread(population_density, state) #in months\n\n speed = 2.5 if @population_density < 50\n speed = 2 if @population_density >= 50\n speed = 1.5 if @population_density >= 100\n speed = 1 if @population_density >= 150\n speed = 0.5 if @population_density >= 200\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n\n # number_of_deaths = (@population * (@population_density/500.0)).floor\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread\r\n #(population_density, state) <---- deleted, not necessary\r\n #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n case population_density\r\n when 0..49 then speed += 2.5\r\n when 50..99 then speed += 2\r\n when 100..150 then speed += 1.5\r\n when 151..200 then speed += 1\r\n else speed += 0.5\r\n end\r\n\r\n\r\n # if population_density >= 200\r\n # speed += 0.5\r\n # elsif population_density >= 150\r\n # speed += 1\r\n # elsif population_density >= 100\r\n # speed += 1.5\r\n # elsif population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def predicted_deaths \n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # speed = 0.0\n speed = if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\nend",
"def speed_of_spread() #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n#refractor\r\n case\r\n when @population_density >= 200 then speed += 0.5\r\n when @population_density >= 150 then speed += 1\r\n when @population_density >= 100 then speed += 1.5\r\n when @population_density >= 50 then speed += 2\r\n else speed += 2.5\r\n end\r\n\r\n\r\n # if @population_density >= 200\r\n # speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n fractions = [0.4, 0.3, 0.2, 0.1, 0.05]\n density = [200, 150, 100, 50, 0]\n \n index = 0\n while index < density.length\n if @population_density >= density[index]\n number_of_deaths = (@population * fractions[index]).floor\n break\n end\n index += 1\n end\n \n # if @population_density >= density[0]\n # number_of_deaths = (@population * fractions[0]).floor\n # elsif @population_density >= density[1]\n # number_of_deaths = (@population * fractions[1]).floor\n # elsif @population_density >= density[2]\n # number_of_deaths = (@population * fractions[2].floor\n # elsif @population_density >= density[3]\n # number_of_deaths = (@population * fractions[3]).floor\n # else\n # number_of_deaths = (@population * fractions[4]).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n# when the population density increase by 50, the number of deaths changes by .1\n\n # case true\n # when @population_density >= 200 then\n # number_of_deaths = (@population * 0.4).floor\n # when @population_density >= 150 then\n # number_of_deaths = (@population * 0.3).floor\n # when @population_density >= 100 then\n # number_of_deaths = (@population * 0.2).floor\n # when @population_density >= 50 then\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\ntotal_deaths = [1]\n death = (@population_density / x = 500)\n total_deaths << death\n total_deaths = total_deaths.min\n number_of_death = (@population * total_deaths).floor\n\n print \"#{@state} will lose #{number_of_death} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density \n when 0...50\n number_of_deaths = (@population * 0.05).floor\n when 50...100\n number_of_deaths = (@population * 0.1).floor\n when 100...150\n number_of_deaths = (@population * 0.2).floor\n when 200...10000\n number_of_deaths = (@population * 0.4).floor\n when 150...200\n number_of_deaths = (@population * 0.3).floor\n end\n \n #if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n #else\n # number_of_deaths = (@population * 0.05).floor\n #end\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\r\n \r\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\r\n \r\n number_of_deaths = (@population * 0.05).floor if @population_density >= 0\r\n \r\n # end\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n\n#Method should be able to have add greater speed to to pop density numbers that are lower then each other at increments of 50.\n#steps \n# if @population_density >= 200\n# speed += 0.5\n# elsif @population_density >= 150\n# speed += 1\n# elsif @population_density >= 100\n# speed += 1.5\n# elsif @population_density >= 50\n# speed += 2\n# else\n# speed += 2.5\n# end\n\n\n# puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n# end\n\n# end\n speedhash1 = {0..49 => 2.5, 50..99 => 2.0, 100..149 => 1.5, 150..199 => 1.0, 200..103589999 => 0.5}\n speedhash1.each do |range, speed|\n if (range).include?(@population_density.floor)\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end\n end\n\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def initialize(state_of_origin, population_density, population)\r\n @state = state_of_origin\r\n @population = population\r\n @population_density = population_density\r\n end",
"def predicted_deaths(state_density, population)\n # predicted deaths is solely based on population density\n number_of_deaths = ''\n hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n\n hash.each do |density, float|\n if @population_density >= density\n number_of_deaths = (@population * float).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case\n when @population_density >= 200\n speed += 0.5\n when @population_density >= 150\n speed += 1\n when @population_density >= 100\n speed += 1.5\n when @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n=begin\r\n # ***original code***\r\n\r\n speed = 0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n=end\r\n\r\n=begin\r\n # ***this can be used to add conditions later (depeneding on conditions) and is slightly cleaner***\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n=end\r\n\r\n # ***this is refactored to be much cleaner until updates are ready***\r\n\r\n speed = 2.5\r\n\r\n # sets new population density variable to have a mximum of 200\r\n max_pop = 200\r\n population_density_temp = [@population_density, max_pop].min\r\n\r\n # speed decreases by 0.5 whenever population density increases by 50\r\n speed -= 0.5 * (population_density_temp / 50).floor\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def report\r\n\r\n STATE_DATA.each do |key, value|\r\n\r\n initialize(key, value[:population_density], value[:population]) \r\n virus_effects\r\n end\r\n \r\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n # case @population_density\r\n # \twhen @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n # \twhen @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n # end\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end"
] | [
"0.7036398",
"0.6908338",
"0.69037753",
"0.6847088",
"0.6781773",
"0.6760485",
"0.67540187",
"0.6753874",
"0.674867",
"0.67290246",
"0.67227477",
"0.66753614",
"0.66596746",
"0.6631879",
"0.65896523",
"0.6585168",
"0.6583145",
"0.65785795",
"0.65470827",
"0.6517331",
"0.6507892",
"0.65071785",
"0.6469037",
"0.6469037",
"0.6469037",
"0.6469037",
"0.6469037",
"0.6469037",
"0.64534664",
"0.6441071",
"0.643811",
"0.6435617",
"0.64276934",
"0.6425657",
"0.6403548",
"0.6400946",
"0.63965416",
"0.6393323",
"0.63917375",
"0.6386218",
"0.6386124",
"0.6368528",
"0.6363977",
"0.6363975",
"0.63572055",
"0.635254",
"0.63406706",
"0.6339134",
"0.63359946",
"0.633549",
"0.6331753",
"0.63302946",
"0.6327422",
"0.6318626",
"0.6289214",
"0.6289214",
"0.6289214",
"0.6289214",
"0.6286457",
"0.6286093",
"0.6285181",
"0.62842304",
"0.6282501",
"0.62766623",
"0.6275896",
"0.6268914",
"0.62373525",
"0.62323624",
"0.62307537",
"0.62293184",
"0.6221199",
"0.6213277",
"0.6211715",
"0.62049353",
"0.61997586",
"0.6192828",
"0.61907303",
"0.61877525",
"0.61780214",
"0.6176175",
"0.6169113",
"0.61657757",
"0.61621416",
"0.6157417",
"0.6153215",
"0.61494464",
"0.6148388",
"0.6145441",
"0.6145069",
"0.61441225",
"0.61441225",
"0.61441225",
"0.61441225",
"0.61441225",
"0.6135699",
"0.61333656",
"0.61264014",
"0.61258334",
"0.61252284",
"0.61127967",
"0.6108217"
] | 0.0 | -1 |
puts parameters population density, and state and runs them through the coniditonal statements | def speed_of_spread #in months
# We are still perfecting our formula here. The speed is also affected
# by additional factors we haven't added into this functionality.
speed = 0.0
# As population density increases, the rate of spread decreases
if @population_density >= 200
speed += 0.5
elsif @population_density >= 150
speed += 1
elsif @population_density >= 100
speed += 1.5
elsif @population_density >= 50
speed += 2
else
speed += 2.5
end
puts " and will spread across the state in #{speed} months.\n\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\r\n\r\n STATE_DATA.each do |key, value|\r\n\r\n initialize(key, value[:population_density], value[:population]) \r\n virus_effects\r\n end\r\n \r\n end",
"def initialize(state_of_origin, population_density, population)\n puts \"creating\"\n @state = state_of_origin\n @population = population\n @population_density = population_density\n\n end",
"def virus_effects\n=begin\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n=end \n puts \"#{@state} will lose #{predicted_deaths} people in this outbreak and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def deaths_spread(population_density, population, state)\n speed = 0.0\n case \n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n \n # How are arguements initialized inside a method?\n # - As local variables.\n \n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor #.floor is to always round down the number\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop.\n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def report(states)\n states.each do | state, data |\n VirusPredictor.new(state, data[:population_density], data[:population]).virus_effects\n end\nend",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n \n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop. \n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def initialize(state_of_origin, population_density, population)\r\n @state = state_of_origin\r\n @population = population\r\n @population_density = population_density\r\n end",
"def virus_effects\n# predicted_deaths(@population_density, @population, @state)\n# speed_of_spread(@population_density, @state)\n ### interpolate into one sentence\n print \"#{@state} will lose #{predicted_deaths} people in this outbreak and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end",
"def virus_effects\n # This is the beginning of object oriented design.\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n print_results\n end",
"def report\n STATE_DATA.each do |state, population_info|\n state = VirusPredictor.new(state, population_info[:population_density], population_info[:population])\n state.virus_effects\n end\nend",
"def report\n STATE_DATA.each do |state, population_stats|\n state = VirusPredictor.new(state, population_stats[:population_density], population_stats[:population])\n state.virus_effects\n end\nend",
"def print_all_states\n STATE_DATA.each_key { |key|\n new_state = VirusPredictor.new(key, STATE_DATA[key][:population_density], STATE_DATA[key][:population])\n new_state.virus_effects\n }\n end",
"def all_50\n STATE_DATA.each do |state_name,values|\n # state = Alabama\n # values ={population_density: 94.65, population: 4822023}\n state = VirusPredictor.new(state_name, values[:population_density], values[:population])\n state.virus_effects\n end\nend",
"def virus_effects\n predicted_deaths\n speed_of_spread\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end",
"def predicted_deaths\n # Arguements are initialized as local variables inside a method.\n\n #predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n\n # @number_of_deaths = @population * if @population_density >= 200\n # 0.4\n # elsif @population_density >= 150\n # 0.3\n # elsif @population_density >= 100\n # 0.2\n # elsif @population_density >= 50\n # 0.1\n # else\n # 0.05\n # end\n\n # @number_of_deaths = @number_of_deaths.floor\n # end\n\n # Predicts speed of spread for each state based on population density.\n def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # @speed = 0.0\n\n if @population_density >= 200\n @speed = 0.5\n elsif @population_density >= 150\n @speed = 1\n elsif @population_density >= 100\n @speed = 1.5\n elsif @population_density >= 50\n @speed = 2\n else\n @speed = 2.5\n end\n end\n\n def print_results\n puts \"#{@state} will lose #{@number_of_deaths} people in this outbreak and will spread across the state in #{@speed} months.\"\n puts \"\\n\"\n end\n\nend",
"def initialize(state_of_origin, population_density, population)\r\n @state = state_of_origin\r\n @population = population\r\n @population_density = population_density\r\n end",
"def initialize(state_of_origin, population_density, population)\r\n @state = state_of_origin\r\n @population = population\r\n @population_density = population_density\r\n end",
"def speed_of_spread(population_density, state) #in months\n\n speed = 2.5 if @population_density < 50\n speed = 2 if @population_density >= 50\n speed = 1.5 if @population_density >= 100\n speed = 1 if @population_density >= 150\n speed = 0.5 if @population_density >= 200\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # How are arguements initialized inside a method?\n # => As local variables.\n \n # population NOT @population\n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n ## Refactored for Release: 8\n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n if @population_density\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread\n more_dense = @population_density >= 200\n dense = @population_density >= 150\n medium_dense = @population_density >= 100\n low_dense = @population_density >= 50#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n if more_dense\n speed += 0.5\n elsif dense\n speed += 1\n elsif medium_dense\n speed += 1.5\n elsif low_dense\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths#(#population_density, population, state)\n # Method takes in three arguments, and it compares population density with the given criteria ,\n # predicted deaths is solely based on population density\n\n def predicted_deaths\n case true\n when @population_density >= 200 then (@population * 0.4).floor\n when @population_density >= 150 then (@population * 0.3).floor\n when @population_density >= 100 then (@population * 0.2).floor\n when @population_density >= 50 then (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n #prints the number of deaths along with the state's name\n puts \"#{@state} will lose #{@predicted_deaths} people in this outbreak\"\n end\n end",
"def speed_of_spread(population_density, state) #in months\n speed = 0.0 # forces float\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def population_density; end",
"def speed_of_spread(population_density) #in months\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else \n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0\r\n case @population_density\r\n when (200..10000000000) then speed = 0.5\r\n when (150..199) then speed = 1\r\n when (100..149) then speed = 1.5\r\n when (50..99) then speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n # binding.pry\r\n\r\n\r\n=begin\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n=end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def access_state_data\n STATE_DATA.each do |state, population_hash|\n VirusPredictor.new(state, population_hash[:population_density], population_hash[:population]).virus_effects\n end\nend",
"def predicted_deaths # this is going to print out the deaths for each state on the outbreak which is going to be based on population and population density\n \n death_percent = 0.1 if @population_density >= 50\n death_percent = 0.2 if @population_density >= 100\n death_percent = 0.3 if @population_density >= 150\n death_percent = 0.4 if @population_density >= 200\n death_percent = 0.05 if @population_density < 50\n number_of_deaths = (@population * death_percent).floor\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n \n end",
"def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def print_state\n @@rows.times do |row|\n @@columns.times do |column|\n print '%4.4s' % @state_array[row * @@columns + column].to_s,\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def predicted_deaths(population_density, population, state)\n if population_density >= 200 # predicted_deaths passes in the population density and population and uses a ratio to determine the number effected by the virus\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else \n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n\n=begin\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n=end\n\n factor = case @population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths # Takes three parameters and computes the values based on the inputs. \n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" # This returns the values. \n\n end",
"def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end",
"def predicted_deaths #(population_density, population, state)\n\n # Pro Tip: You can set a variable equal to the RESULT of a conditional statement.\n number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n when @population_density >= 200 then speed += 0.5\n when @population_density >= 150 then speed += 1\n when @population_density >= 100 then speed += 1.5\n when @population_density >= 50 then speed += 2\n else speed += 2.5\nend",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case when @population_density >= 200\n speed += 0.5\n when @population_density >= 150\n speed += 1\n when @population_density >= 100\n speed += 1.5\n when @population_density >= 50\n speed += 2\n when\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n case \n \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n\n when @population_density >= 50 then number_of_deaths = (@population * 0.5).floor\n\n\n else number_of_deaths = (@population * 0.05).floor\n\n end\n\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n #\n #number_of_deaths = (@population * 0.05).floor\n #end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n=begin \nNot quite working yet...\n if @population >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @poplation < 200 && @poplation >= 50\n number_of_deaths = (@population * ((@population / 50).floor / 10.0)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n=end\n \n case @population_density\n when 200.. 10000000000000000000000000000 then number_of_deaths = (@population * 0.4).floor\n when 150.. 199 then number_of_deaths = (@population * 0.3).floor\n when 100.. 149 then number_of_deaths = (@population * 0.2).floor\n when 50.. 99 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def virus_effects\n print \"#{@state} will lose #{predicted_deaths(@population_density, @population)} people in this outbreak and will spread across the state in #{speed_of_spread(@population_density)} months.\\n\\n\"\n end",
"def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n densities = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\r\n\r\n densities.each do |density, ratio|\r\n if @population_density >= density\r\n @number_of_deaths = (@population * ratio).floor\r\n end\r\n end\r\n\r\n=begin - refactored\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n=end\r\n\r\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def initialize(state_of_origin, data)#when taking hash values as parameters, better to use 'data' as parameter and use [] notation to get specific values \n @state = state_of_origin\n @population = data[:population]\n @population_density = data[:population_density]\n end",
"def speed_of_spread\r\n #(population_density, state) <---- deleted, not necessary\r\n #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n case population_density\r\n when 0..49 then speed += 2.5\r\n when 50..99 then speed += 2\r\n when 100..150 then speed += 1.5\r\n when 151..200 then speed += 1\r\n else speed += 0.5\r\n end\r\n\r\n\r\n # if population_density >= 200\r\n # speed += 0.5\r\n # elsif population_density >= 150\r\n # speed += 1\r\n # elsif population_density >= 100\r\n # speed += 1.5\r\n # elsif population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end",
"def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(state_density) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n hash = {200=>0.5, 150=>1, 100=>1.5, 50=>2}\n\n hash.each do |density, float|\n if @population_density >= density\n speed = float\n else\n speed = 2.5\n end\n speed\n end\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n speed += 0.5 if @population_density >= 200\n speed += 1 if @population_density >= 150\n speed += 1.5 if @population_density >= 100\n speed += 2 if @population_density >= 50\n speed += 2.5 if @population_density < 50\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n factor = case population_density\n \n when 0...50 then speed += 2.5\n when 50...100 then speed += 2.0\n when 100...150 then speed += 1.5\n when 150...200 then speed += 1.0\n else speed += 0.5\n end \n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths(population_density, population, state) #create a method, called predicted_deaths, give it an array of population density, population, and state\n if @population_density >= 200 #if population density is greater than or equal to 200 then set number of deaths equal to population time .4 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150 #if population density is greater than or equal to 150 then set number of deaths equal to population time .3 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100 #if population density is greater than or equal to 100 then set number of deaths equal to population time .2 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50 #if population density is greater than or equal to 50 then set number of deaths equal to population time .1 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.1).floor\n else #if population density is greater than 0 then set number of deaths equal to population time .5 rounded off to the lowest intiger\n number_of_deaths = (@population * 0.05).floor\n end #ends if/else\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" #prints out what state will lose x number of people in the outbreak\n\n end",
"def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case @population_density\n when 200..10000 then speed = 0.5\n when 150...200 then speed = 1\n when 100...150 then speed = 1.5\n when 50...100 then speed = 2\n else\n speed = 2.5 \n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread # REFACTOR\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case\n when @population_density >= 200\n speed += 0.5\n when @population_density >= 150\n speed += 1\n when @population_density >= 100\n speed += 1.5\n when @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n #elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n #elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n #elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n #else\n # number_of_deaths = (@population * 0.05).floor\n #end\n \n #use case statement to refactor code\n case @population_density\n when 1...49 \n number_of_deaths = (@population * 0.1).floor\n when 50...99\n number_of_deaths = (@population * 0.2).floor\n When 100..149\n number_of_deaths = (@population * 0.3).floor\n when 150...200\n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n#we can remove this and have it print within virus_effects so that this method does one thing\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end",
"def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # speed = 0.0\n case @population_density\n when (151...200)\n speed = 1\n\n when (100...150)\n speed = 1.5\n\n when (50...100)\n speed = 2\n\n when (0..50)\n speed = 2.5\n\n else\n speed = 0.5\n\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" end",
"def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # speed = 0.0\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end",
"def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end",
"def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end"
] | [
"0.6645474",
"0.6482796",
"0.6440358",
"0.6244643",
"0.619875",
"0.6190849",
"0.6184927",
"0.6177318",
"0.6130628",
"0.60846585",
"0.60603523",
"0.60567284",
"0.60440904",
"0.59962815",
"0.5994581",
"0.5978851",
"0.59768224",
"0.59495056",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5948602",
"0.5943039",
"0.5936113",
"0.5936113",
"0.591789",
"0.589624",
"0.5882574",
"0.5849298",
"0.5849298",
"0.5849298",
"0.5849298",
"0.5842185",
"0.5842098",
"0.58291787",
"0.5811557",
"0.5804116",
"0.5798428",
"0.5784268",
"0.5774632",
"0.5742315",
"0.57232326",
"0.57232326",
"0.57232326",
"0.57232326",
"0.57232326",
"0.57232326",
"0.5712328",
"0.568805",
"0.5682924",
"0.56770414",
"0.56661",
"0.5663994",
"0.56589955",
"0.5658695",
"0.5656538",
"0.5653583",
"0.56519103",
"0.5649199",
"0.564204",
"0.5637792",
"0.5634359",
"0.5632835",
"0.56300336",
"0.56291145",
"0.56242365",
"0.56242365",
"0.56226814",
"0.56100047",
"0.56083417",
"0.5607604",
"0.5604929",
"0.5599502",
"0.5596859",
"0.559633",
"0.55950916",
"0.5593576",
"0.5589784",
"0.5589634",
"0.5583375",
"0.5579524",
"0.55771804",
"0.55745286",
"0.55731297",
"0.5570434",
"0.55697674",
"0.55697674",
"0.55697674",
"0.55697674"
] | 0.0 | -1 |
Gets three tweets from the passed in user. GET /api/getThreeTweets | def getThreeTweets
render json: TwitterAPI.get_top_3_tweets(params[:twitter_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tuser = User.find_by(id: params[:user_id])\n\t\tif user.present?\n\t\t\tfollower_ids = user.followers.pluck(:id)\n\t\t\ttweets = Tweet.where(\"user_id IN (?)\", follower_ids).order(\"updated_at DESC\")\n\t\t\trender json: {:status=>\"success\", :code=>200, :message=>\"List of tweets from the users you follow.\", data: tweets}\n\t\telse\n\t\t\trender json: {:status=>\"failure\", :message=>\"User is not present.\", data: tweets}\n\t\tend\n\tend",
"def get_user_tweets\n @tweets = COLL.find(\n selector = {\"user.id\" => @user[:id]},\n opts={ :sort=>[\"created_at\", Mongo::ASCENDING],\n :fields=>[\"coordinates\",\"user\",\"text\",\"created_at\", \"entities\", \"place\"]\n })\n\n @user[:tweet_count] = @tweets.count\n @tweets.count > 1\n end",
"def fetch_user_timeline(n=200)\n tweets.destroy_all if n == 200\n statuses = Twitter.user_timeline(screen_name, count: n)\n Tweet.many_from_twitter(statuses)\n end",
"def get_all_tweets(user)\n collect_with_max_id do |max_id|\n options = {count: @limit, include_rts: true}\n options[:max_id] = max_id unless max_id.nil?\n $client.user_timeline(user, options)\n end\n end",
"def show_tweets\n @user = get_user_or_current_user(params[:id])\n @tweets = Tweet.where(:user_id => @user.id).order(created_at: :desc)\n end",
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def load_tweets_for_user(user_id)\n\t\t\tauthenticate\n\t\t\tmax_id = Tweet.get_max_tweet_id(user_id) || @@max_id\n\n\t\t\tresponse = []\n\t\t\tputs max_id\n\t\t\tresult = @@client.user_timeline(user_id.to_i, :since_id => max_id)\n\t\t\tresult.each do |tweet|\n\t\t\t\tbegin\n\t\t\t\t\tnewTweet = Tweet.new\n\t\t\t\t\tnewTweet = newTweet.init(tweet)\n\t\t\t\t\tunless newTweet.is_retweet_or_mention\n\t\t\t\t\t\tnewTweet.save!\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"Found Retweet #{newTweet.text}\"\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tputs \"COULD NOT SAVE\"\n\t\t\t\telse\n\t\t\t\t\tt = TweetViewModel.new\n\t\t\t\t\tresponse << t.initFromActiveRecord(newTweet)\n\t\t\t\tend\n\t\t\tend\n\t\t\tresponse\n\t\tend",
"def user_tweets(user, count=10, since_id=nil, max_id=nil)\n print \"Getting Last %d Statuses for User %s\" % [count, user.to_s]\n print \" since %s\" % since_id if since_id\n print \" until %s\" % max_id if max_id\n print \"\\n\"\n options = {:count => count, :trim_user => true, :include_rts => true, :include_entities => true}\n options[:since_id] = since_id if since_id\n options[:max_id] = max_id if max_id\n begin\n statuses = @MT.user_timeline(user, options)\n if statuses.size > 0\n status_data = statuses.map do |s|\n {\n :user_id => s.user.id,\n :created_at => s.created_at,\n :id => s.id,\n :text => s.text,\n :source => s.source,\n :truncated => s[\"truncated\"],\n :in_reply_to_user_id => s[\"in_reply_to_user_id\"],\n :in_reply_to_screen_name => s[\"in_reply_to_screen_name\"],\n :geo => s[\"geo\"],\n :coordinates => s[\"coordinates\"],\n :place => parse_place(s[\"place\"]),\n :contributors => s[\"contributors\"],\n :retweet_count => s[\"retweet_count\"],\n :entities => parse_entities(s.attrs[\"entities\"]),\n :retweeted_status => parse_retweeted_status(s[\"retweeted_status\"])\n }\n end\n status_data\n else\n []\n end\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % user.to_s\n []\n end\n end",
"def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n []\n end\nend",
"def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end",
"def favorite_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::FavoriteTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::FavoriteTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::FavoriteTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Favorite.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def index\n\t\t@tweets = current_user.tweets\n\tend",
"def top_three\n @top_3 = User.order('win_percentage DESC').limit(3)\n render json: { data: @top_3 }.to_json\n end",
"def by_user\r\n tweets = Tweet.where(user_id: params[:user_id])\r\n render json: tweets\r\n end",
"def tweets\n @_tweets ||= client.filter_tweets(screen_names)\n end",
"def index\n @following_user_ids = @user.following.pluck(:id)\n\n @tweets = Tweet.where(user_id: @following_user_ids).order(created_at: :desc).includes(:user)\n json_response(@tweets)\n end",
"def get_tweets_last_six_months\n # screen_name is needed to make the calculations\n params.require(:screen_name)\n screen_name = params[:screen_name].strip\n\n # Get the API keys from the environment variables\n api_key = ENV['API_KEY']\n api_secret = ENV['API_SECRET']\n access_token = ENV['ACCESS_TOKEN']\n access_token_secret = ENV['ACCESS_TOKEN_SECRET']\n\n # Create the Twitter::REST::Client instance\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = api_key\n config.consumer_secret = api_secret\n config.access_token = access_token\n config.access_token_secret = access_token_secret\n end\n\n # Check if the user exists\n exists = true\n begin\n user = client.user(screen_name)\n rescue Twitter::Error::NotFound => detail\n exists = false\n end\n\n if exists\n # Get the tweets in the last 6 months\n result = get_6_months_tweets(client, screen_name)\n else\n result = { \"error\": \"User does not exists\" }\n end\n\n render json: result\n end",
"def index\n timeline = Tweet.where(user_id: User.find(@current_user_id).follows).or(Tweet.where(user_id: @current_user_id))\n render json: {timeline: timeline}\n end",
"def tweets\n @tweets = @user.tweets.order(created_at: :desc).paginate(:page => params[:page], :per_page => 5) # order OWN tweets according to when they were created, with the most recent tweet at the top.\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def latest_tweets(k=5)\n\n # Get the tweets\n response = make_response(\"statuses\",\"user_timeline\")\n timeline = JSON.parse(response.body)\n tweets = timeline[0..k-1]\n\nend",
"def index\n if params[:page] && current_user\n render json: current_user, scope: {page: params[:page]}, serializer: UserWithTweetsSerializer, meta: {total_pages: current_user.timeline_tweets.count/25}\n elsif current_user\n render json: current_user, serializer: UserWithTweetsSerializer\n elsif params[:page]\n @tweets = Tweet.all.page(params[:page])\n render json: @tweets\n else\n @tweets = Tweet.all\n render json: @tweets\n end\n end",
"def index\n @users = User.all\n\n set_up_twitter\n\n @users.each do |user|\n tweets = @client.user_timeline(user.twitter_id, count: 5)\n user.last_tweet = tweets.first.full_text\n end\n end",
"def get_tweets(*args)\n return self.tweets.to_a if args.size > 1 || args.size < 1\n return self.tweets.take(args[0]).to_a\n end",
"def user_tweets(user_hash, opts = {})\n client = self.client(user_hash)\n user_name = user_hash['name']\n\n opts = @default_user_tweets_options.merge(opts)\n\n expected_count = opts['count'] || 20\n max_id = nil\n\n Enumerator.new do |yielder|\n # make API request & return results in an enumerator\n loop do\n query_opts = opts\n if max_id\n query_opts = opts.clone\n query_opts['max_id'] = max_id\n end\n\n results = client.user_timeline(user_name, query_opts)\n results.each do |tweet|\n id = tweet['id']\n max_id = id if (max_id.nil? || id < max_id) # max_id should descend\n yielder << tweet\n end\n\n # TODO catch RateLimitExceeded exception\n\n break if results.size < expected_count # this can happen if optional params are passed in...\n\n max_id -= 1 # subtract 1 from max_id to avoid redundant messages\n end\n end\n end",
"def fetch_tweets(criteria)\n @client.filter(track: criteria.theme) do |object|\n puts object.text if object.is_a?(Twitter::Tweet)\n end\n end",
"def latest_tweets\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n end\n\n count = params[:count] || 10\n time_line = client.user_timeline(current_user.twitter_handle, {count: count})\n current_user.update(time_fetched: current_user.time_fetched+1)\n if time_line.class == Twitter::Error::NotFound\n render json: {status: 400, success: false, message: 'Twitter handle or id not valid'}\n else\n render json: {status: 200, success: true, message: 'Success', data: time_line.map{|a| a.text}.as_json}\n end\n\n rescue => e\n Rails.logger.error \"account_controller#latest_tweets - Error: #{e.message}\"\n render json: {status: 500, success: false, message: 'Unexpected error'}\n end",
"def tweets\n #Looked at all tweets\n #select only the tweets that match the User\n Tweet.all.select{|tweet| tweet.user == self }\n end",
"def tweets(options={})\n\n @tweets=(@tweets.empty? || (@last_tweets_options!=options)) ? @tweets=read_tweets(self.id, options) : @tweets\n @last_tweets_options=options\n @tweets\n end",
"def index\n @tweets = Tweet.all\n @user = current_user\n @recent_tweets = Tweet.order(created_at: :desc).limit(10)\n @pop_tweets = Tweet.order(likes_count: :desc).limit(10)\n @tweet = Tweet.new\n #@users # 基於測試規格,必須講定變數名稱,請用此變數中存放關注人數 Top 10 的使用者資料\n end",
"def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n [] # \"magic\" return value\n end\nend",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def load_bulk_tweets(user_id)\n\t\t\tauthenticate\n\n\t\t\tresponse = []\n\t\t\tresult = @@client.user_timeline(user_id.to_i)\n\t\t\tresult.each do |tweet|\n\t\t\t\tbegin\n\t\t\t\t\tnewTweet = Tweet.new\n\t\t\t\t\tnewTweet = newTweet.init(tweet)\n\t\t\t\t\tnewTweet.save!\n\t\t\t\trescue\n\t\t\t\t\tputs \"COULD NOT SAVE\"\n\t\t\t\telse\n\t\t\t\t\tt = TweetViewModel.new\n\t\t\t\t\tresponse << t.initFromActiveRecord(newTweet)\n\t\t\t\tend\n\t\t\tend\n\t\t\tresponse\n\t\tend",
"def get_tweets(list)\n unless list.authorized(@user)\n raise AuthorizationException.new\n end\n list.tweets\nend",
"def index\n # binding.pry\n @tweet = Tweet.new\n if current_user\n friend_ids = Friend.where(user_id: current_user).pluck(:friends_id) \n @tweets = Tweet.where(user_id: friend_ids)\n else\n @tweets = Tweet.includes([:user]).all\n end\n\n @tweets = @tweets.order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def index\r\n @users = User.where.not(id: current_user&.id)\r\n @tweet = Tweet.new\r\n @tweets = Tweet.all.page(params[:page])\r\n\r\n \r\n if params[:q]\r\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").page(params[:page])\r\n if @tweets.nil?\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n else\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n \r\n #SCOPE comentado para evitar conflicto con buscador\r\n if signed_in?\r\n @tweets = Tweet.tweets_for_me(current_user).page(params[:page])\r\n else\r\n @tweets = Tweet.all.order(\"created_at DESC\").page(params[:page])\r\n end\r\n\r\n if params[:tweetsearch].present?\r\n @tweets = Tweet.search_my_tweets(params[:tweetsearch]).page(params[:page]).order(\"created_at DESC\")\r\n elsif params[:hashtag].present?\r\n @tweets = Tweet.search_my_tweets(\"##{params[:hashtag]}\").page(params[:page]).order(\"created_at DESC\")\r\n end\r\n\r\n end",
"def fetch_tweets!\n Twitter.user_timeline(username).each do |tweet|\n unless Tweet.where(twitter_user_id: self.id).find_by_content(tweet.text) \n self.tweets << Tweet.create(content: tweet.text)\n end\n end\n end",
"def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end",
"def search_tweets(result_type, number_of_responses)\n \n searchORstring = @searchArray.map { |hashtagElement| hashtagElement.to_s + \" OR\"}.join(\" \")\n search = @twitter_client.search(searchORstring, result_type: result_type).take(number_of_responses)\n\n if search.empty? == false\n search.each do |tweet|\n @tweets << tweet\n end\n else\n raise('Your search returned no tweets')\n end\n @tweets\n end",
"def list_tweets\n tweets\n end",
"def my_tweets\n \t@my_tweets = Tweet.find_by_sql(\"select tweets.* from tweets where user_id = #{current_user.id} UNION select tweets.* from tweets INNER JOIN tweets_users ON tweets.id = tweets_users.tweet_id where tweets_users.user_id = #{current_user.id}\")\n end",
"def index\n authenticate\n @tweets = Tweet.where(\n user_id: current_user.id,\n stat: nil\n ).order(:id)\n end",
"def index\n chain = Tweet\n chain = chain.since_id(params[:since_id]) if params[:since_id]\n @tweets = chain.all(:order => 'msg_twid ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def fetch_user_timeline\n statuses = client.user_timeline(user_timeline_options)\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: self, state: :posted)\n update_max_user_timeline_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def tweets\n # cannot write this yet because I can't even test it\n # 1. they keep track of their tweets => []\n # 2. they figure it out\n Tweet.all.select do |tweet| # Tweet instance\n # I am the user asking for my tweets\n # I want to know which tweets are ME (I, my, myself, self)\n tweet.user == self\n # comapre it to the information being held in the tweet\n # specifically, the reference they are holding\n end\n\n # so efficiency => don't think about it\n # refactor, indexes\n end",
"def recent_tweets(count)\n start(\"/recent/tweets/#{count}\")\n end",
"def userfilter\n @tweets = Tweet.where(\"user_vote < 0 or user_vote > 0\").includes(:company).page params[:page]\n @count = Tweet.where(\"user_vote < 0 or user_vote > 0\").count\n end",
"def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend",
"def index\n @tweets = Tweet.select { |tweet| tweet.user_id == current_user.id }\n end",
"def show\n @user = User.find_by!(username: params[:username])\n #This saves user tweets in desc order.\n @tweets = @user.tweets.order(created_at: :desc)\n end",
"def get_test_tweet(tweet_ids)\n\t\tdata = Tweet.where(id: tweet_ids)\n\tend",
"def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end",
"def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end",
"def get_latest_tweets(num_of_tweets)\n client = configure_authentication\n latest = client.home_timeline({:count => num_of_tweets})\n client.end_session\n info = latest.to_json\n end",
"def list\r\n #page = params[:page].nil? ? 0 : params[:page]\r\n tweets = Tweet.all\r\n render json: tweets\r\n end",
"def mention_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::MentionTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::MentionTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::MentionTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Mention.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def getTweets\n\t\tputs 'in getTweets'\n\t\t@client.on_timeline_status do |tweet|\n\t\t\tputs 'getTweets: ' + tweet.text\n\n\t\t\t#binding.pry\n\t\t\tpopPlayQueue(tweet)\n\t\tend\n\tend",
"def init_tweets(tweeter)\n all_tweets = Twitter.user_timeline(tweeter.user, :trim_user => true, :count => 200, :include_rts => true)\n tweeter.latest_tweet = all_tweets.first.id\n tweeter.twit_id = all_tweets.first.user.id\n page = 2\n\n until all_tweets.empty?\n for item in all_tweets do\n Tweet.new(:data => item, :city_id => self.id, :user => tweeter.id, ).save\n end\n all_tweets = Twitter.user_timeline(tweeter.user, :trim_user => true, :count => 200, :include_rts => true, :page => page)\n page += 1\n end\n\n end",
"def get_6_months_tweets(client, screen_name)\n # To not reach the rate limit of the Twitter API, we get 200 (the maximum) tweets in each request\n # until we have the tweets in the last 6 months or older.\n # As we can get older tweets, after the necessary request, we will get rid of that older tweets\n\n # Get the oldest date\n today = DateTime.now.to_date\n six_month_ago = today.beginning_of_month - 5.month\n\n begin\n # Make the API call to the 200 newest tweets\n tweets = client.user_timeline(screen_name, :count => 200)\n\n # If we have any results, check:\n # - if the last tweet is older than 6 month from now --> We do not need more tweets\n # - if the last tweet is not older than 6 month from now --> get another 200 tweets and append to the tweet we already have\n # Repeat this proccess until the lasr tweet is older than 6 month from now\n while tweets.any? && tweets.last.created_at >= six_month_ago do\n more_tweets = client.user_timeline(screen_name, :count => 200, :max_id => tweets.last.id - 1)\n tweets += more_tweets\n end\n\n # Get rid of the tweets older than 6 month from now\n tweets_in_months = [];\n tweets.each do |tweet|\n if tweet.created_at >=six_month_ago\n tweets_in_months << tweet\n else\n break\n end\n end\n\n # Divide the tweets per months\n result = divide_tweets_per_month(tweets_in_months)\n rescue Exception => e\n result = e\n end\n\n return result\n end",
"def top_tweets(percentage_integer)\n\t\tputs \"Pulling top #{percentage_integer}% tweets\"\n\t\ttweets = []\n\t\ttwitter_accounts.each do |ta|\n\t\t\t# twitter_account.top_tweets pulls the top tweets for a given account\n\t\t\ttweets = tweets + ta.top_tweets(percentage_integer)\n\t\tend\n\t\ttweets\n\tend",
"def tweet(user, tweet_text)\n\t\tname = user.handle\n\t\ttweet = user.tweet(tweet_text)\n\t\t#Updates the global tweet list, the list of tweets by username, and the list of tweets by username and username's followers\n\t\tupdate_timeline_cache_tweets(tweet, name)\n\t\tupdate_cache_personal_tweet_list(tweet, name)\n\t\tupdate_global_cache_tweets(tweet, name)\n\tend",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def count_tweets(username)\n\n # fetch all the tweets for this user,\n # set tweets count to max 200\n fetched_tweets = @client.user_timeline(username, {count: 200})\n\n # init a counter to keep the count of tweet happens in last 24 hours\n hour_counter = Array.new(24) { |e| e = 0 }\n\n # start the timer after fetch all the tweets\n now = Time.now\n fetched_tweets.each do |tweet|\n if now < tweet.created_at + 24 * 60 * 60\n # only consider the 24 hours tweets\n hour_counter[tweet.created_at.hour] += 1\n else\n # if loop to a tweet before 24 hours ago,\n # then terminates the loop\n break\n end\n end\n\n # convert array into hash\n # using array index as key\n # and convert key to string\n hash = Hash.new\n hour_counter.each_with_index {|val, index| hash[index.to_s] = val}\n return hash\n end",
"def all_tweets\n Tweet.all\n end",
"def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end",
"def topics(usernames)\n get(\"/1/users/topics.json\", :users => [usernames].flatten).users\n end",
"def index\n @favorite_tweets = FavoriteTweet.where(:user => session[:user_id])\n end",
"def index\n signin_apikey\n if params[:orderby] != nil\n if params[:orderby] == \"newest\"\n @tweets = Tweet.all.order(\"created_at DESC\")\n elsif params[:orderby] == \"past\"\n @tweets = Tweet.all.order(\"created_at ASC\")\n elsif params[:orderby] == \"ask\"\n @tweets = Tweet.where({ ask: true })\n elsif params[:orderby] == \"url\"\n @tweets = Tweet.where({ ask: false })\n else \n @tweets = Tweet.all\n end\n else\n if params[:user_id] != nil\n if params[:voted] == \"true\"\n puts params[:user_id]\n puts session[:user_id]\n if params[:user_id] == session[:user_id].to_s\n puts \"entro a dins if user_id=session_id\"\n @tweets = []\n @liked = Vote.where(idUser: params[:user_id], tipus: \"contribution\")\n @liked.each do |vote|\n @tweet =Tweet.where(id: vote.idType)\n if @tweet != nil\n @tweets.push(@tweet)\n end\n end\n else\n puts \"entro else\"\n msg = \"You can't look at the contributions voted by another user\"\n respond_to do |format|\n format.html { redirect_to '/tweets' }\n format.json { render json: msg.to_json , status: 403, location: @tweet }\n end\n return\n end\n else\n @author = User.find(params[:user_id])\n @tweets = Tweet.where(author: @author.username)\n end\n else\n @tweets = Tweet.all\n end\n end\n render :json => @tweets.to_json\n end",
"def show\n @tweet = Tweet.find(params[:id])\n @user=User.all\n end",
"def getIncomingTweets\n words = ['Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter']\n TweetStream::Client.new.on_error do |message|\n puts \"Error: #{message.to_s} \"\n end.track('Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter') do |status|\n if status.text.language.to_s == \"english\" && !status.retweet?\n if words.any? {|word| status.text.include?(word)}\n prep = @conn.prepare(\"INSERT INTO stream(response) VALUES(?)\")\n prep.execute status.text\n prep.close\n end\n end\n end\n end",
"def gather_tweets(trainLine, trainNumber)\n tweets = @client.user_timeline(trainLine, {count: 10})\n array_tweets = Array.new\n\n tweets.each do |tweet|\n if validate_tweet(tweet, trainNumber) && validate_time(tweet)\n array_tweets << tweet.text\n end\n\n end\n array_tweets\n end",
"def tweets\n Tweet.all.select do |tweet|\n tweet.user == self\n end\n # tweets = []\n #\n # Tweet.all.each do |tweet|\n # if tweet.user == self\n # tweets << tweet\n # end\n # end\n #\n # tweets\n end",
"def user_timeline(qt)\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = \"v8gVbMe6vQRaqhR3pp7NAC3Hu\"\n config.consumer_secret = \"PajgzuySLYRmTjTHBII3NkoCLeKcYeMiFuNN9rKw80RoUwLTKg\"\n config.access_token = \"2742505915-pa5qcpgna0T2s9dlvH6oY0kftxcpYbqSqs84VUa\"\n config.access_token_secret = \"9IhvXk8UejEA2t8MV9qSMlKL1rbYA8D1P1SqCDF58LRNb\"\n\n end\n @data = params[:q]\n logger.info \"here is the text: #{@data}\"\n @tweets= client.search(\"to: #{@data}\", result_type: \"recent\", :lang => :en).take(20).collect{ |element| element.text}\n\n end",
"def show\n\t\treferenced = @topic.tweets.count(:distinct)\n\t\tusers = @topic.tweets.user.count(:distinct)\n\t\trender json: show_json(@topic, referenced, users)\n\tend",
"def get_tweets\n Rails.cache.fetch('stops', :expires_in => 30) {\n results = []\n \n Twitter::Search.new('#gbnyc').from('garrettb').from('jakebellacera').per_page(100).since_date('2010-02-25').fetch().results.each do |result|\n if result.geo.present?\n results << {\n :text => result.text,\n :from_user => result.from_user,\n :created_at => result.created_at,\n :lat => result.geo.coordinates[0],\n :lng => result.geo.coordinates[1]\n }\n end\n end\n \n results\n }\n end",
"def lookup_user (user_id)\n tweets = IBM_DB.exec(@conn, \"SELECT * from tweets t WHERE user_id = #{user_id}\")\n #TODO: Verify manually, cannot count results in DB2\n #debug 'user: ' + user_id.to_s + \" had \" + resp.count.to_s + \" tweets\"\n debug \"fetched tweets for user: \" + user_id.to_s\n end",
"def index\n @favos = Favo\n .where(user_id: current_user.id)\n @tweets = Tweet.all\n end",
"def get_tweet(search,since_id = 0, throtle = 20)\n\turl = 'http://search.twitter.com/search.json?q='+search+'&rpp='+throtle.to_s+'&since_id='+since_id.to_s\n\tprint \"Asking with this url \" + url+ \"\\n\"\n\tresp = Net::HTTP.get_response(URI.parse(url))\n\tresponse_array = JSON.parse(resp.body)\nend",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def get_tweet_list(ids, page_num)\n\t\ttweets = get_timeline(ids)\n\t\ttweets[(page_num.to_i - 1) * 10, page_num.to_i * 10]\n\tend",
"def index\n\n @tweets = Tweet.tweets_for_me(list_friends()).order(created_at: :DESC).page params[:page]\n \n if params[:q] #REEMPLAZA A RANSACK PARA BUSCAR\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").order(created_at: :DESC).page params[:page]\n\n end\n \n #SOLO APARECERÁN LOS TWEETS A LOS QUE SIGUE EL CURREN USER\n #@tweets = Tweet.tweets_for_me(list_friends()).order(created_at: :DESC).page params[:page]\n #@tweets = Tweet.order(created_at: :DESC).page params[:page]\n \n \n @tweet = Tweet.new\n \n end",
"def parse_tweets\n @tweets.each do |tweet|\n @user[:handle] << tweet[\"user\"][\"screen_name\"]\n unless tweet[\"place\"].nil?\n place = tweet[\"place\"][\"full_name\"]\n else\n place = nil\n end\n\n @user[:features]<<{:type =>\"Feature\",\n :geometry =>{:type=>\"Point\",\n :coordinates =>tweet[\"coordinates\"][\"coordinates\"]},\n :properties =>{:created_at=>tweet[\"created_at\"],\n :text=>tweet[\"text\"],\n :place=>place}}\n end\n end",
"def index\n @tweets = Tweet.all\n\n render json: @tweets\n end",
"def initialize(twitter_user, api=TwitterApi.new, num_favs=20)\n @user_being_crawled = twitter_user\n @api = api\n @retrieved_favs = []\n @stat_keeper = StatKeeper.new\n @num_favs = num_favs\n end",
"def index\n #Array of all tweets. Used for index html page\n @tweets = Tweet.all\n end",
"def index\n\n if params[:q]\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").order(created_at: :desc).page params[:page]\n elsif user_signed_in?\n @tweets = Tweet.tweets_for_me(current_user).or(current_user.tweets).order(created_at: :desc).page params[:page]\n else\n @tweets = Tweet.eager_load(:user, :likes).order(created_at: :desc).page params[:page]\n end\n\n @tweet = Tweet.new\n @user_likes = Like.where(user: current_user).pluck(:tweet_id)\n end",
"def get_tweets\n # TODO-JW: look into -- respond_to :json\n @card = Card.find(params[:id])\n @api = Twitter.user_timeline(@card.twitter_handle, options={count: 10})\n if @api\n tweets = []\n @api.each_with_index do |tweet,i|\n tweets[i] = {}\n tweets[i][:tweet_id] = String(tweet.id)\n tweets[i][:text] = auto_link(tweet.text)\n tweets[i][:created] = tweet.created_at\n tweets[i][:user_id] = tweet.user.screen_name\n end\n render json: tweets \n else\n [].to_json\n end\n end",
"def index\n @users = User.where(banned: false).order(:name).includes(:skills)\n\n @users = @users.ilike(:name, params[:query]) unless params[:query].blank?\n @users = @users.tagged_with(params[:skills]) unless params[:skills].blank?\n\n @tags = User.tag_counts_on(:skills)\n @latest_users = User.where(banned: false).limit(3).order('created_at desc')\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @users }\n end\n end",
"def favorites_timeline(user, count, max_id, since_id, reply_depth)\n\n options = {\n :timeline_kind => :favorites,\n :count => count\n }\n self.append_official_card_parameters(options)\n options[:user_id ] = user if user.is_a?(Integer)\n options[:screen_name] = user if user.is_a?(String)\n options[:max_id ] = max_id if max_id\n options[:since_id ] = since_id if since_id\n\n followers = self.followers()\n timeline = Tw::Timeline.compose(\n @requester,\n followers,\n reply_depth,\n options)\n tweetArray = timeline.perform()\n\n return tweetArray\n end",
"def index\n\t@project = Project.find(params[:project_id])\n\tif params[:for_review]\n\t @tweets = @project.tweets.for_review.paginate :page => params[:page], :order => 'updated_at DESC'\n\telsif params[:reviewed]\n\t\t@tweets = @project.tweets.reviewed.paginate :page => params[:page], :order => 'updated_at DESC'\n\telsif params[:pending]\n\t\t@tweets = @project.tweets.pending.paginate :page => params[:page], :order => 'updated_at DESC'\n\telse\n\t\t@tweets = @project.tweets.paginate :page => params[:page], :order => 'updated_at DESC'\n\tend\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tweets }\n end\n end",
"def all_tweets_with_limit n\n\t\t\n\t\tsdb = AWS::SimpleDB.new(access_key_id: $aws_access, secret_access_key: $aws_secret)\n\n\t\tdomain = sdb.domains['cspp51050-final']\n\t\tresults = domain.items.limit(n)\n\n\t\tconvert_sdb_to_objects results\n\n\tend",
"def retweets_of_me(options={})\n perform_get(\"statuses/retweets_of_me.#{Twitter.format}\", options)\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end",
"def index\n @tweets = Tweet.all\n end"
] | [
"0.62984455",
"0.62487525",
"0.62227035",
"0.616522",
"0.60715705",
"0.6037786",
"0.6032513",
"0.6025714",
"0.599853",
"0.5938325",
"0.59228003",
"0.58438045",
"0.5835036",
"0.5819893",
"0.58130115",
"0.57984716",
"0.57883453",
"0.57881767",
"0.57866645",
"0.5759745",
"0.57491285",
"0.5729052",
"0.57265097",
"0.5722908",
"0.5716577",
"0.570725",
"0.56963015",
"0.56905824",
"0.56662637",
"0.5651344",
"0.5645087",
"0.56180966",
"0.5617882",
"0.5617801",
"0.5571333",
"0.55501884",
"0.5544156",
"0.55295557",
"0.5526551",
"0.5521875",
"0.5521188",
"0.55040985",
"0.55034614",
"0.55023575",
"0.5490647",
"0.54752725",
"0.5463586",
"0.5460943",
"0.543954",
"0.54315704",
"0.5428205",
"0.541771",
"0.5413799",
"0.54099166",
"0.54020536",
"0.53999686",
"0.5391378",
"0.5350416",
"0.53482795",
"0.53281444",
"0.5302025",
"0.52870595",
"0.5283682",
"0.52742654",
"0.52664745",
"0.52652824",
"0.52526337",
"0.5248874",
"0.5235475",
"0.52109545",
"0.5200421",
"0.5197064",
"0.5196824",
"0.51797664",
"0.5177851",
"0.5167812",
"0.5166418",
"0.5155885",
"0.51449144",
"0.5136893",
"0.51366425",
"0.5129919",
"0.51244706",
"0.51093984",
"0.510925",
"0.51064557",
"0.5099521",
"0.50964993",
"0.5090205",
"0.509004",
"0.5071081",
"0.5071062",
"0.5060498",
"0.5057613",
"0.50565565",
"0.50565565",
"0.50565565",
"0.50565565",
"0.50565565",
"0.50565565"
] | 0.8384098 | 0 |
GET /api/getMatchCount Gets the number of matches | def getMatchCount
render json: Match.count(:user1 => params[:twitter_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matched_count\n @results[MATCHED_COUNT]\n end",
"def return_count\n return @matchedCount\n end",
"def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end",
"def total\n #use group matches instead of numFound for grouped response\n if response[:numFound].nil? \n self[:grouped][blacklight_config['index']['group']]['matches'].to_s.to_i \n else \n response[:numFound].to_s.to_i\n end\n end",
"def total_matches_played\n count = 0\n\n matches.each do |match|\n unless match.finalized_date == nil \n count += 1\n end\n end\n\n count\n end",
"def count(params = {})\n @api.get(\"api/count.json\", params)\n end",
"def count_results\n # TODO respond with xml, only if valid session, otherwise return nil\n team = Team.find_by_id( params[:id] )\n if team\n render json: ( team.meeting_individual_results.count + team.meeting_relay_results.count )\n else\n render json: 0\n end\n end",
"def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end",
"def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end",
"def count\n Integer(parsed_body['meta']['total_results'])\n end",
"def count_results\n team = Team.find_by_id( params[:id] )\n if team\n render( json: ( team.meeting_individual_results.count + team.meeting_relay_results.count ) )\n else\n render( json: 0 )\n end\n end",
"def num_found\n\n if @solr_response[\"response\"] != nil\n # Normal Solr query\n return @solr_response[\"response\"][\"numFound\"]\n end\n\n if @solr_response[\"grouped\"] != nil\n # Grouped Solr query.\n total = 0\n @solr_response[\"grouped\"].keys.each do |key|\n total += @solr_response[\"grouped\"][key][\"matches\"]\n end\n return total\n end\n\n return 0\n rescue\n 0\n end",
"def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end",
"def total\n response[:numFound].to_s.to_i\n end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def count\n count = YoutubeSearch::UseCases::YoutubeData\n .new\n .count\n\n render json: {count: count}, status: 200\n end",
"def count\n # There are two occurrences, but they are the same\n total = first locator(:total)\n return total.text.to_i if total\n results? ? raise(RuntimeError, \"Couldn't determine result count\", caller) : 0\n end",
"def matched_size\n m = @match\n m.to_s.size if (not m.equal?(nil))\n end",
"def calculate_total_predictions(match)\n match.predictions.count.to_f\n end",
"def count\n self.at('/RETS/COUNT')['Records'].to_i\n end",
"def total_count #:nodoc:\n total == 1 && !@group.nil? && @group['matches'] > 1 ? @group['matches'] : total\n end",
"def count\n if paginated?\n to_hash['results'].nil? ? 0 : to_hash['results'].size\n else\n to_hash['count']\n end\n end",
"def index\n @matches = Match.page(params[:page]).per(1)\n end",
"def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end",
"def count_of_teams\n @teams.count\n end",
"def retrieve_message_count_from_server\n response = retrieve_messages_from_server(1)\n response[\"count\"]\n end",
"def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"def servercount\n url = \"https://discordbots.org/api/bots/#{@id}\"\n JSON.parse(RestClient.get(url))['server_count'].to_i\n end",
"def count\n raw_history['num_results']\n end",
"def repeated_matches\n\t\t@@logger.info { \"Retrieving repeated matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:repeated => true).all.length\n\tend",
"def matchup_count(season = 2015)\n r = Record.find_by(team_id: self.id, year: season)\n r.wins + r.losses + r.ties\n end",
"def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n headers: HEADER)\n my_count = my_response['count'].to_i\n Resque.logger.info \"#{my_count} #{object_name}'s on Recharge API\"\n Resque.logger.info my_response\n my_count\n end",
"def hit_count()\n #This is a stub, used for indexing\n end",
"def count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\n end",
"def count\n resource = @client.send(:head, self.next, **@options)\n resource.get_response.total_records\n end",
"def all_hits_count\n return @all_results.length || 0\n end",
"def counts\n reply.documents[0][COUNTS]\n end",
"def team_count\n @teams.length\n end",
"def team_count\n @teams.length\n end",
"def max_matches\n @max_matches || 1000\n end",
"def count_records **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n \tquery.projection << 'COUNT (*)'\n \tresult = get_records raw: true, query: query\n begin\n result.first['COUNT']\n rescue\n return 0\n end\n end",
"def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end",
"def get_page_count(response)\n page_links = response.headers['link'].scan(/<(\\S+)>/).flatten\n /\\?page\\=(\\d+)\\&/.match(page_links.last)[1].to_i\n end",
"def matcher(match)\n match = match.flatten.uniq\n match.each do |m|\n @counter.count(m)\n end\n end",
"def returned_count\n reply.documents.length\n end",
"def increment_matches_metric\n metric_increment(:matches)\n end",
"def played_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.finished?\n count += 1\n end\n end\n count\n end",
"def count\n @count\n end",
"def count_meetings\n # TODO respond with xml, only if valid session, otherwise return nil\n team = Team.find_by_id( params[:id] )\n if team\n render json: team.meetings.collect{|row| row.id}.uniq.size\n else\n render json: 0\n end\n end",
"def get_total_games_played\n return games.size\n end",
"def count **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n query.projection << 'COUNT (*)'\n result = get_records raw: true, query: query\n result.first['COUNT'] rescue 0 # return_value\n end",
"def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end",
"def count_meetings\n team = Team.find_by_id( params[:id] )\n if team\n render( json: team.meetings.collect{|row| row.id}.uniq.size )\n else\n render( json: 0 )\n end\n end",
"def inc_match\n @matchedCount += 1\n end",
"def games_played\n self.results.to_a.count\n end",
"def call\n res = client.get('/api/rest/v1/users.json?action=count')\n res['data']['count']\n end",
"def count(what, where, options={})\n opts = @@default_options.merge(options)\n opts[:limit] = 1\n uri = assemble_uri(what, where, opts)\n begin\n doc = Hpricot(Net::HTTP.get(URI(URI.escape(uri))))\n total_results = doc.at('totalresults').inner_html.to_i\n rescue\n total_results = 0\n end\n total_results\n end",
"def count\n filtered = apply_criteria(@data)\n filtered.count\n end",
"def count_people(query={})\n self.simple_client.get(\"/api/v1/people/count?#{query.to_query}\")[\"count\"]\n end",
"def count \n puts \"Tu as scrappé #{@result_scrap.count} élémént(s)\"\n return @result_scrap.count\n end",
"def numberOfResults\n @@numberOfResults\n end",
"def total_results\n numberOfRecords\n end",
"def total_results\n numberOfRecords\n end",
"def counts(options = {})\n find(:all, options_for_counts(options))\n end",
"def get_count\n capture(\"cf curl /v2/apps/#{$app_uuid} | jq .entity.instances\").to_i\nend",
"def count\n @battles_count = Battle.all\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end",
"def count\n call_client(:count)\n end",
"def count\n @params[:rettype] = 'count'\n self\n end",
"def count_duplicate_matches(matches)\n matches.map { |match| matches_hash[Set.new match] }.reduce(0, :+)\n end",
"def filtered_hits_count\n return @filtered_results.length || 0\n end",
"def count(options = {})\r\n options.stringify_keys!\r\n options.assert_valid_keys(*%W[moType keyword])\r\n resp = connection.get(custom_method_collection_url(:count, options), headers)\r\n resp.body.to_i\r\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def route_count\n @routes.size\n end",
"def get_matching_students_count\n @email = Email.find(params[:id])\n respond_with @email.get_matching_students_count\n end",
"def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end",
"def participants_count(name)\n text = self.span(:class=>\"s3d-search-result-name\",:text=>name).parent.parent.parent.link(:title=>/\\d+.participant/).text\n text[/\\d+/].to_i\n end",
"def get_report_count(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportCount\"})\n GetReportCountResponse.format(response)\n end",
"def count(resource)\n list(resource.to_s,1)[\"meta\"][\"total_count\"]\n end",
"def group_count\n respond_with json_response('group_count', Group.active.count)\n end",
"def find_matches\n @match_distances = Match.find_match(current_user, \"Any\", nil)\n end",
"def retrieved_records\n results.count\n end",
"def matches\n\t\t\tcompetition.matches\n\t\tend",
"def move_count; @move_count ||= match.moves.count; end",
"def goals_against_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n count += match.goals_against(self) if match.finished?\n end\n\n count\n end",
"def count(constraints = {})\n query(constraints).count\n end",
"def count(resource_type)\n path = '/api/' + resource_type.to_s\n response = http_get(path,{limit: '1'})\n response[\"meta\"][\"total_count\"]\n end",
"def get_counts(args = {})\r\n Net::Flickr.instance().request('flickr.photos.getCounts', args).at('photocounts')\r\n end",
"def count_routes(n)\n\n\treturn 0\nend",
"def count\n @count ||= begin\n Grim.processor.count(@path)\n end\n end",
"def count\n @count ||= @query.count\n end",
"def count(opts={})\n sq = Tripod::SparqlQuery.new(self.as_query(opts))\n count_sparql = sq.as_count_query_str\n result = Tripod::SparqlClient::Query.select(count_sparql)\n\n if result.length > 0\n result[0][\"tripod_count_var\"][\"value\"].to_i\n else\n return 0\n end\n end",
"def count\n query.count\n end",
"def count\n query.count\n end",
"def length\n @results_list.count\n end",
"def count(where_pattern)\n client.query(\"#{prefixes} SELECT (COUNT(distinct(?resource)) as ?count) FROM <#{graph}> WHERE { #{where_pattern} }\").first[\"count\"].value.to_i\n end"
] | [
"0.7811867",
"0.73680633",
"0.6772427",
"0.6696992",
"0.6686159",
"0.6679146",
"0.6644658",
"0.6642344",
"0.659905",
"0.65537834",
"0.6549743",
"0.6533666",
"0.65194166",
"0.6441293",
"0.6402503",
"0.6402503",
"0.6402503",
"0.63880044",
"0.63629204",
"0.63445127",
"0.63402873",
"0.62823725",
"0.62725997",
"0.619881",
"0.6159136",
"0.614761",
"0.6133813",
"0.6123629",
"0.6108642",
"0.6108642",
"0.610518",
"0.6094509",
"0.60944694",
"0.6093391",
"0.60657877",
"0.6048028",
"0.6042271",
"0.60347795",
"0.60302776",
"0.6028357",
"0.6028357",
"0.60229355",
"0.6010874",
"0.6007114",
"0.6004145",
"0.5999032",
"0.5981068",
"0.59491485",
"0.59451693",
"0.5931438",
"0.59265924",
"0.5926322",
"0.5896087",
"0.5892344",
"0.58907425",
"0.5890506",
"0.5888012",
"0.5885986",
"0.5879466",
"0.5876083",
"0.58713216",
"0.5866266",
"0.58623433",
"0.5861107",
"0.5861107",
"0.58576846",
"0.5854446",
"0.5851969",
"0.5842762",
"0.58396345",
"0.58376735",
"0.58359563",
"0.5835269",
"0.5834146",
"0.58271223",
"0.58271223",
"0.58271223",
"0.5825292",
"0.58160436",
"0.5802831",
"0.5799705",
"0.57972217",
"0.5788958",
"0.5785909",
"0.5781643",
"0.5774095",
"0.5770744",
"0.5764039",
"0.57526106",
"0.57523733",
"0.57391465",
"0.5737764",
"0.573383",
"0.57292813",
"0.5724729",
"0.5721147",
"0.5713774",
"0.5713774",
"0.5704967",
"0.5704475"
] | 0.7972879 | 0 |
this is where users arrive after visiting the email confirmation link | def edit
@resource = resource_class.reset_password_by_token(
reset_password_token: resource_params[:reset_password_token]
)
if @resource&.id
# ensure that user is confirmed
@resource.skip_confirmation! unless @resource.confirmed_at
@resource.save!
update_refresh_token_cookie
redirect_header_options = {
override_proof: OVERRIDE_PROOF,
reset_password: true
}
redirect_headers = @resource.create_named_token_pair
.merge(redirect_header_options)
redirect_to_link = DeviseJwtAuth::Url.generate(params[:redirect_url], redirect_headers)
redirect_to redirect_to_link
else
raise ActionController::RoutingError, 'Not Found'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referral_confirmation_email\n\n end",
"def email_confirm\n end",
"def confirm_email(user)\n @user = user\n @confirm_url = \"http://www.yscalumni.org/confirm/\" + user.confirmation_code\n mail(:to => user.email, :subject => \"Welcome to yscalumni.org! Please confirm your email!\")\n end",
"def after_confirmation\n welcome_email\n queue_matches\n end",
"def after_confirmation; end",
"def send_confirmation_instructions; end",
"def confirmation(user)\n \n @user = user\n\n if Rails.env.production?\n @root_path = \"http://allianz-community.com/\"\n else\n @root_path = \"http://localhost:3000/\"\n end\n\n @confirm_path = @root_path + users_confirm_path + \"?id=\"+@user.id.to_s+\"&hash=\" + @user.confirm_hash\n mail to: @user.mail, subject: 'Email confiramtion'\n end",
"def confirm_email\n user = User.find_by_email_confirm_token(params[:confirm_token])\n if user\n user.email_activate\n flash[:success] = \"La tua email è stata confermata! Benvenuto!\"\n log_in user\n remember(user)\n redirect_to groups_path\n else\n flash[:error] = \"Siamo spiacenti, ma pare che l'utente non esista.\"\n redirect_to login_path\n end\n end",
"def click_on_received_confirmation_email\n subject = t('devise.mailer.confirmation_instructions.subject')\n subject = \"[#{t('application.name')} TEST] #{subject}\"\n open_email(logged_in_user.email, with_subject: subject)\n click_first_link_in_email\n end",
"def email_activation_confirmation(email)\n setup_email(email.user, email.address)\n @subject += 'A new email address has been activated'\n @body[:url] = \"#{SITE_URL}/\"\n end",
"def confirm!\n welcome_email\n super\n end",
"def deliver_confirmation_email_instructions!\n # TODO\n end",
"def check_mail_confirmation\n return if current_user.client?\n\n unless current_user.confirmed?\n flash[:danger] = tf('common.flash.unconfirmed_mail')\n redirect_to :root\n end\n end",
"def adminConfirmation\n ContactMailer.adminConfirmation\n end",
"def confirm\n \t\tuser = User.find_by_uid params[:uid]\n \t\tuser.confirm_email params[:confirmation_code]\n \t\tif not user.confirmed?\n \t\tflash[:error] = \"You're link doesn't match what we have on record.\"\n \t\tredirect_to signup_path\n \t\telse\n \t\tsession[:user] = user\n \t\tflash[:success] = \"We will update you at #{user.email} with new information as it because available\"\n \t\tredirect_to dashboard_path\n \t\tend \n \tend",
"def splash_page_confirmation(useremail)\n @useremail = useremail\n @greeting = \"Hi\"\n\n mail(:to => useremail, :bcc => [\"alex.jordan.j@gmail.com, kme3p@virginia.edu\"], :subject => \"SpectaFresh - New Splash Page User\")\n end",
"def activation_confirmation(user)\n @root_url = root_url\n mail(:subject => setup_subject(I18n.t('activation_complete')),\n :to => user.email)\n end",
"def activation_confirmation(user)\n user_login_link(user)\n\n @greeting = \"Thank you for choosing Contractor\"\n @name = user.name\n\n mail to: user.email\n end",
"def send_confirmation_to(user)\n token_link = \"http://localhost:9292/validate/\" + user.validation_token\n template_locals = { :user => user, :token_url => token_link}\n send_email_to_user(user,\"Frank requests that you verify your email address.\" ,:'mail/new_registration', template_locals)\n end",
"def email_confirmed?\n # Validate if the user has the email confirmed in the\n # server side session. This is set by the controller.\n # after we've validated the email. If the user doesn't\n # have this session value, he can't complete this form.\n #\n # If the user attempts to share/bookmark this url, for example\n # and the incoming session is not found to be valid\n # then the user is redirected to the terms and conditions\n # and a notification that their link has expired is\n # shown.\n if session[\"email_confirmed\"].to_s.length == 0 or\n session[\"email_confirmed\"] == false or\n session[\"email\"].to_s.length == 0 or\n session[\"locked_address\"].to_s.length == 0\n redirect to ('/?expired=true')\n # If the email address and the locked address\n # do not match, we could have a user using\n # multiple tabs at the same time to process different\n # certificate requests. This could happen if a\n # shared computer is left open with a partially\n # uncompleted request that already has access to the\n # form, and another request that is processing an email\n # confirmation. Other than that, and on a more malicious\n # note, an attacker could be trying to exploit our\n # session system, to attempt to send email to an\n # unconfirmed address. We stop both potential situations\n # immediately here.\n elsif (session[\"locked_address\"] != session[\"email\"])\n redirect to ('/?email=false')\n end\n\nend",
"def after_confirmation\n end",
"def confirm_request\n @email = params[:email]\n @confirmation_code = params[:confirmation_code]\n mail to: @email\n end",
"def confirmation(user)\n @user = user\n @user.generate_confirmation_code\n mail(to: @user.email, subject: \"Confirmation\") do |f|\n f.html\n end\n\n end",
"def confirmation_instructions(user, token, somethingElse)\n AccountMailer.default_url_options[:host] = \"tep-lending-library.herokuapp.com\"\n @resource = user\n @password = user.password\n @token = token\n @name = user.first_name\n @email = user.email\n mail(to: @resource.email, subject: \"Confirm Email\", :tag => \"Welcome to the TEP Lending Library!\")\n mail.delivery_method.settings.merge! @@smtp_settings\n mail\n end",
"def signup_confirmation\n FreelanceMailerMailer.signup_confirmation\n end",
"def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end",
"def attendee_confirmation(attendee)\n @attendee = attendee\n @url = \"http://www.TMSbigideaday.org\"\n subject = \"Thanks for signing up for The Mountain School's Big Idea Day\"\n\n mail to: @attendee.email,\n subject: subject.to_s\n end",
"def confirm_from_email\n bookable_asset = BookableAsset.find_by_euid(params[:euid])\n booking_request = bookable_asset.booking_requests.find(params[:booking_request_id])\n redirect_path = current_user ? user_path(current_user) : login_path\n\n if bookable_asset.confirmed?\n flash[:warn] = \"You've already accepted this booking_request\"\n return redirect_to redirect_path\n end\n booking_request.accept!\n\n flash[:notice] = \"You've accepted this booking_request.\"\n redirect_to redirect_path\n end",
"def confirm_email!\n confirm_email\n save_without_session_maintenance(validate: false)\n end",
"def resend_confirmation_instructions; end",
"def confirm_email\n user = User.find_by_confirm_token(params[:id])\n if user\n user.email_activate\n end\n end",
"def user_confirm_email(current_user)\n @current_user = current_user\n mail(to: current_user.email, subject: 'Confirm Email', from:\"PawBookings <no_reply@pawbookings.com>\")\n end",
"def confirmation_email(user)\n # email header info MUST be added here\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @subject = \"SIR Information:: Welcome to SIR\"\n\n # email body substitutions go here\n @body[\"name\"] = user.login\n @body[\"hash\"] = user.activation_code\n end",
"def send_account_notification\n @user = User.find_by_id(params[:id]) \n begin \n url = \"http://www.uncharted.net/account/activation/#{@user.activation_code}\" \n Emailer.deliver_admin_accountactivation(@user.email,url)\t\n end\n flash[:notice] = \"Email has been sent to #{@user.email} to active his account.\"\n redirect_to :action => 'index'\n end",
"def email_sent\n @email = session[:owners_new_email]\n end",
"def confirmation_email(puser)\n @puser = puser # Instance variable passed into the view to be used\n mail(:to => puser.email, :subject => \"Confirm your Account\")\n end",
"def applicant_confirmation(applicant)\n @applicant = applicant\n\n mail to: applicant.username + \"@facebook.com\", subject: \"Greenpeace Belgium: Application confirmation\"\n end",
"def email_activation(email)\n setup_email(email.user, email.address)\n @subject += 'Please verify your email address'\n @body[:url] = \"#{SITE_URL}/activate/#{email.activation_code}\"\n end",
"def after_confirmation # Send welcome mail after user is successfully registered\n send_user_mail\n end",
"def confirmation(request)\n @request=request\n mail(:to => request.recipient_email, :subject => 'Your Tree Request') do |format|\n format.text\n end\n end",
"def user_new_item_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\", subject: \"Item Confirmation\"\n end",
"def activation_needed_email(user)\n @user = user\n @url = users_activate_path(id: user.activation_token)\n mail(to: user.email, subject: \"#{User.model_name.human}登録を完了しましょう!\")\n end",
"def custConfirmation\n ContactMailer.custConfirmation\n end",
"def activation_needed_email(user)\n @user = user\n @url = \"http://lvh.me:3000/users/#{user.activation_token}/activate\"\n mail(:to => user.email,\n :subject => \"Welcome to StackClown\")\n end",
"def confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def clink\n set_user unless @user\n if @user\n render text: \"#{site_url}/confirmation?confirmation_token=#{@user.confirmation_token}\"\n else\n render nothing: true\n end\n end",
"def confirmation_instructions\n \tCustomMailer.confirmation_instructions\n end",
"def resend_confirmation_email\n unless current_user.confirmed?\n current_user.send_confirmation_instructions\n flash[:success] = I18n.t('flash.success.confirmation_sent')\n end\n redirect_to home_path\n end",
"def activation_needed_email(user)\n # TODO: Implement actual functionality -- Wed Jun 13 15:26:53 2012\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def confirm_email_change(user, new_email)\n @user = user\n @new_email = new_email\n @autogen_msg = AUTOGEN_MSG\n\n @change_email_url = confirm_email_change_user_url(id: @user.id,\n confirmation_token: @user.confirmation_token,\n new_email: new_email,\n host: Rails.env.production? ? PROD_URL : DEV_URL,\n protocol: \"http\")\n mail(to: @new_email, subject: \"Confirm Change in Email Address\")\n end",
"def pending_any_confirmation; end",
"def signup_confirmation(user)\n @user= user\n debugger\n mail to: @user.email , subject: \"MovieBox Sign Up Confirmation\"\n \n end",
"def confirm\n @greeting = \"Hi\"\n\n mail to: \"proales@proales.com\"\n end",
"def get_activate_email\n end",
"def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def activation_success_email(user)\n @user = user\n #@url = \"http://0.0.0.0:3000/login\"\n @url = \"http://kancrumer.herokuapp.com/login\"\n mail(:to => user.email, :subject => \"Your account is now activated\")\n end",
"def index\n @user = current_user\n UserMailer.confirmation_email(@user).deliver\n end",
"def confirm_url\n generate_confirm_code\n save if not new_record?\n project.full_domain + '/recipients/confirm/' + self.confirm_code.to_s\n end",
"def activation_needed_email(user)\n @user = user\n @account_activation_url = activate_user_url(user.activation_token)\n mail to: user.email, subject: \"ACTION NEEDED: Activate your VCDelta.org account\"\n end",
"def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end",
"def activation_success_email\n UserMailerMailer.activation_success_email\n end",
"def activation_needed_email(user)\n @user = user\n @activation_url = activate_url(token: user.activation_token)\n mail to: user.email\n end",
"def starter_confirm(recipient)\n @starter = recipient\n @url = \"http://www.harpuun.com\"\n mail(:to => \"#{recipient.email}\", :subject => \"Thanks for Signing Up!\" )\n end",
"def confirm_email(confirmation)\n @confirmation = confirmation\n @account = confirmation.account\n \n mail :to => confirmation.unconfirmed_email\n end",
"def email_verification_instructions(user)\n load_settings\n @user = user\n subject_suffix = \"Account Activation Instructions\"\n #@url = \"http://example.com/login\"\n mail(:to => user.email,\n :subject => \"[#{user.company_name}] #{subject_suffix}\",\n :template_path => 'notifications',\n :template_name => 'another',\n :activate_account_url => activate_accounts_url(:code => user.perishable_token,\n :subdomain => user.company.subdomain),\n :username => user.login,\n :token => user.perishable_token, :subdomain => user.company.subdomain)\n end",
"def confirm(user)\n @greeting = \"Hi\"\n @user = user\n\n mail to: user.email, subject: 'Welcome to Hikultura!'\n end",
"def application_confirmed(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 booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def activation_success_email(user)\n # TODO: Implement actual functionality -- Wed Jun 13 15:26:53 2012\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def confirm_account(user)\n @name = user.first_name\n @confirm_url = confirm_url(user.token)\n\n mail to: user.email, subject: 'Account confirmation'\n end",
"def email_confirm!\n update(email_confirmed_at: Time.zone.now)\n end",
"def moved_up_event_waiting_user\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/events/#{@event.id}\")\n subject = \"[bootcamp] #{@event.title}で、補欠から参加に繰り上がりました。\"\n mail to: @user.email, subject: subject\n end",
"def reconfirm_notification(user)\n setup_email(user)\n subject 'Confirm new email'\n\n body :user => user, :host => FROM_HOST\n end",
"def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend",
"def signup_confirmation user\n @user = user\n mail to: user.email, subject: \"Welcome to the Clone\"\n end",
"def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end",
"def confirm!\n UserMailer.new_registration(self).deliver_now\n super\n end",
"def host_confirmation\n \t#binding.pry\n \tSendMailToHost.host_confirmation(self).deliver!\n end",
"def account_confirmed(user)\n @notify_subject = strip_tags( \"USER CONFIRMED ACCOUNT AT #{ENV['APPLICATION_CONFIG_name']}\")\n @user = user\n mail( :to => ENV['APPLICATION_CONFIG_admin_notification_address'], :subject => @notify_subject)\n end",
"def after_confirmation\n puts 'xxxxxxxx'\n end",
"def resend_confirmation\n return unless request.post?\n if current_user.activated_at\n flash.now[:error] = \"Your account has already been activated.\"\n else\n UserNotifier.deliver_signup_notification(current_user)\n flash.now[:notice] = \"Your confirmation email has been re-sent\"\n render :action => 'index'\n end\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 sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"kat_tun_jinkazu_love@yahoo.co.jp\", subject: \"登録完了通知\"\n end",
"def registration_confirmation(user, url)\n @url = url\n @user = user\n mail to: user.email, subject: \"Registration Confirmation for Jennifer Nelson's Blog\"\n end",
"def account_activation_request(user, new_user)\n @new_user = new_user\n @url = url_for(:controller => 'users', :action => 'index',\n :status => User::STATUS_REGISTERED,\n :sort_key => 'created_on', :sort_order => 'desc')\n mail :to => user,\n :subject => l(:mail_subject_account_activation_request, Setting.app_title)\n end",
"def activation_success_email(user)\n @user = user\n @url = \"http://lvh.me:3000/login\"\n mail(:to => user.email,\n :subject => \"Your account at Stackclown is now activated\")\n end",
"def activation_success_email user, application_id\n @user = User.find user\n @application = @user.used_applications.find application_id\n @url = application_url(@application)\n mail(:to => @user.email,\n :subject => \"You have been added to #{@application.application_name}\")\n end",
"def new_activation_email\n if request.post?\n @user = User.find_by_email(params[:email])\n @user.reset_perishable_token!\n UserMailer.activation_email(@user).deliver\n flash[:notice] = \"Check your email for a new activation link\"\n redirect_back_or_default root_path\n else\n @user = User.new\n end\n end",
"def resend_confirmation_email\n WEPAY.call('/user/resend_confirmation', self.wepay_access_token, {\n email_message: 'Thank you for signing up with WeCrowd. In order to process payments, you will need to confirm your email address and set a secure payment password. Click the \"confirm\" button below to begin.'\n })\n end",
"def activation(user, email)\n setup_email(user, email)\n @subject += 'Your account has been activated!'\n @body[:url] = \"#{SITE_URL}/\"\n end",
"def confirmation_instructions\n [send_email(MailPart.new_subject(I18n.t('email.confirmation_instructions_subject', home_parish: Visitor.home_parish)),\n nil,\n MailPart.new_body(''),\n EmailStuff::TYPES[:confirmation_instructions],\n conf_insts_call),\n @candidate_mailer_text.token]\n end",
"def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end",
"def reservation_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def request_confirm_email _user\n @confirmation = find_or_create_for_user(_user)\n mail( to: _user.email, subject: \"Please confirm your email address\")\n end",
"def signup_confirmation(user, root_url)\n @user = user\n @url = root_url + 'login'\n mail(to: user.username, subject: 'Sign Up Confirmation')\n end",
"def send_confirmation_email\n return false if /\\w@(example)\\.com/.match(self.email)\n UserMailer.confirmation(self).deliver unless confirmed?\n end",
"def signup_confirmation(user)\n @user = user\n mail to: user.email, subject: \"Signup confirmation from FreeLance\"\n end",
"def registration_confirmation(user) \n @user=user\n mail(:to => user.email, :subject => \"[给力百货]注册邮箱验证\")\n end",
"def activation_needed_email(user)\n @user = user\n @url = \"http://0.0.0.0:3000/users/#{user.activation_token}/activate\"\n\n mail to: @user.email, subject: \"[적어적어]마! 이메일 인증해라\"\n end",
"def after_confirmation\n activate\n end",
"def sendmail_confirm(user)\n @user = user\n mail(to: user.email,\n subject: \"会計よりお知らせ\")\n end"
] | [
"0.7300888",
"0.73001945",
"0.7100166",
"0.7017477",
"0.69846773",
"0.6976349",
"0.69351697",
"0.69184804",
"0.6866249",
"0.6859204",
"0.68310654",
"0.6824817",
"0.6824623",
"0.67849064",
"0.67771435",
"0.6767912",
"0.6765077",
"0.6742052",
"0.6729067",
"0.6727901",
"0.6714266",
"0.6701534",
"0.6672466",
"0.6639515",
"0.6638146",
"0.6636852",
"0.66289186",
"0.66284245",
"0.66188526",
"0.6610948",
"0.66081524",
"0.65988773",
"0.6596992",
"0.65924853",
"0.65913856",
"0.6581949",
"0.656827",
"0.65655833",
"0.6562006",
"0.65543324",
"0.6550868",
"0.6523265",
"0.6522701",
"0.65225446",
"0.6519692",
"0.6505744",
"0.65054363",
"0.65004283",
"0.6499169",
"0.64898276",
"0.6489351",
"0.6485756",
"0.64738244",
"0.64522254",
"0.6438217",
"0.6433984",
"0.64286345",
"0.6428159",
"0.64269495",
"0.64217424",
"0.64198774",
"0.64190775",
"0.64171517",
"0.6409607",
"0.64079005",
"0.6407106",
"0.64061534",
"0.64046997",
"0.6402054",
"0.64018023",
"0.63990134",
"0.63973707",
"0.6367707",
"0.63622415",
"0.63421184",
"0.6335037",
"0.63336796",
"0.63289785",
"0.63185495",
"0.6317375",
"0.6312204",
"0.63105506",
"0.6301304",
"0.6300976",
"0.62972903",
"0.62945276",
"0.62832344",
"0.6273426",
"0.6273212",
"0.6271455",
"0.62597084",
"0.6249888",
"0.6248323",
"0.62445444",
"0.62427306",
"0.62414116",
"0.6233652",
"0.6233575",
"0.62329495",
"0.6231108",
"0.6225733"
] | 0.0 | -1 |
Walk collection for :add rsync_serve resources Build and write the config template | def write_conf
template(new_resource.config_path) do
source 'rsyncd.conf.erb'
cookbook 'rsync'
owner 'root'
group 'root'
mode '0640'
variables(
globals: global_modules,
modules: rsync_modules
)
notifies :restart, "service[#{node['rsyncd']['service']}]", :delayed
end
service node['rsyncd']['service'] do
action :nothing
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsync_resources\n run_context.resource_collection.select do |resource|\n resource.is_a?(Chef::Resource::RsyncServe)\n end\n end",
"def rsync_resources\n ::ObjectSpace.each_object(::Chef::Resource).select do |resource|\n resource.resource_name == :rsync_serve\n end\nend",
"def rsync_modules\n rsync_resources.each_with_object({}) do |resource, hash|\n next unless resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][attribute_to_directive(key)] = value\n end\n end\nend",
"def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end",
"def render_and_write_templates\n clean_build_dir()\n\n yard_file_hash = {}\n\n Dir.glob(\"#{Dir.pwd}/projects/*\").select { |f| File.directory? f }.each do|project_dir|\n yard_file = \"#{project_dir}/yard.yaml\"\n\n unless yard_file.empty?\n yard = YAML::load_file(yard_file)\n next if yard['disabled']\n\n apps = yard['apps']\n project_name = yard['project']['name']\n project_pipelines = yard['pipelines']\n\n Dir.mkdir \"#{BUILD_DIR}/#{project_name}\"\n puts project_name\n\n apps.each do |app_name, app_config|\n Dir.mkdir(\"#{BUILD_DIR}/#{project_name}/#{app_name}/\")\n app_pipelines = Hash.new({})\n\n project_pipelines.each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n\n unless app_config.nil? || app_config['pipelines'].nil?\n app_config['pipelines'].each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n end\n\n # puts app_pipelines\n\n base_files = Dir[\"#{Dir.pwd}/base/*\"]\n project_base_files = Dir[\"#{project_dir}/base/*\"]\n app_files = Dir[\"#{project_dir}/#{app_name}/*\"]\n\n app_pipelines.each do|pipeline_name, pipeline_config|\n template_name = pipeline_config['templateName'] ? pipeline_config['templateName'] : \"#{pipeline_name}.json\"\n\n app_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n project_base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n\n base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n end\n end\n end\n end\n end",
"def copy_configs\n template \"config/compass.rb\"\n template \"config/html5_rails.yml\"\n end",
"def send_config_files_to_nodes(c)\n run_array_of_tasks(rsync_tasks(\"#{base_tmp_dir}/*\", \"#{remote_base_tmp_dir}\"))\n end",
"def build_resource(dir, specs)\n resources = Dir.new(dir)\n to_skip = [ '.', '..', 'resource.def' ]\n record = specs['config']\n resources.entries.each do |entry|\n next if to_skip.include?(entry)\n content = IO.read File.join(resources.path, entry)\n method = File.basename(entry, File.extname(entry)).upcase\n doc = Maruku.new(content)\n record[method.downcase]['content'] = doc.to_html\n end\n record\n end",
"def create_list_resource\n with_run_context(:root) do\n declare_resource(:directory, new_resource.conf_dir) do\n owner new_resource.owner\n group new_resource.group\n mode new_resource.folder_mode\n\n action :create\n end unless ::Dir.exist?(new_resource.conf_dir)\n\n declare_resource(:template, \"#{new_resource.conf_dir}/list.conf\") do\n cookbook 'nginx'\n source 'list.conf.erb'\n\n owner new_resource.owner\n group new_resource.group\n mode new_resource.mode\n\n helpers(Nginx::Cookbook::TemplateHelpers)\n\n variables['files'] ||= []\n\n action :nothing\n delayed_action :create\n end\n end\n end",
"def rsync_modules\n rsync_resources.reduce({}) do |hash, resource|\n if resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][snake_to_space(key)] = value\n end\n end\n\n hash\n end\n end",
"def sync(deploy = {})\n extraconfig = []\n device_change = []\n sync_opt = nil\n\n # Disk are only synced with :all option when VM is first created\n # NOTE: Detach actions are implemented through TM (not sync)\n sync_opt = :all if deploy[:new] == true\n\n disks = sync_disks(sync_opt, false)\n resize_unmanaged_disks\n\n if deploy[:boot] && !deploy[:boot].empty?\n boot_opts = boot_order_update(deploy[:boot])\n end\n\n # changes from sync_disks\n device_change += disks[:deviceChange] if disks[:deviceChange]\n extraconfig += disks[:extraConfig] if disks[:extraConfig]\n\n # get token and context\n extraconfig += extraconfig_context\n\n # get file_ds\n if (files = one_item['TEMPLATE/CONTEXT/FILES_DS'])\n file_id = 0\n files.split(' ').each do |file|\n extraconfig += extraconfig_file(file, file_id)\n file_id += 1\n end\n end\n\n # vnc configuration (for config_array hash)\n extraconfig += extraconfig_vnc\n\n # device_change hash (nics)\n device_change += sync_nics(:all, false)\n\n # Set CPU, memory and extraconfig\n num_cpus = one_item['TEMPLATE/VCPU'] || 1\n spec_hash = {\n :numCPUs => num_cpus.to_i,\n :memoryMB => one_item['TEMPLATE/MEMORY'],\n :extraConfig => extraconfig,\n :deviceChange => device_change\n }\n num_cores = one_item['TEMPLATE/TOPOLOGY/CORES'] || num_cpus.to_i\n if num_cpus.to_i % num_cores.to_i != 0\n num_cores = num_cpus.to_i\n end\n spec_hash[:numCoresPerSocket] = num_cores.to_i\n\n spec_hash[:bootOptions] = boot_opts if boot_opts\n\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)\n\n @item.ReconfigVM_Task(:spec => spec).wait_for_completion\n sync_extraconfig_disk(spec_hash)\n end",
"def manipulate_resource_list(resources)\n\n resources.each do |resource|\n\n #--------------------------------------------------------\n # page_name\n # Make page_name available for each page. This is the\n # file base name. Useful for assigning classes, etc.\n #--------------------------------------------------------\n def resource.page_name\n File.basename( self.url, '.*' )\n end\n\n\n #--------------------------------------------------------\n # page_group\n # Make page_group available for each page. This is\n # the source parent directory (not the request path).\n # Useful for for assigning classes, and/or group\n # conditionals.\n #--------------------------------------------------------\n def resource.page_group\n File.basename(File.split(self.source_file)[0])\n end\n\n\n #--------------------------------------------------------\n # sort_order\n # Returns the page sort order or nil.\n # - If there's an `order` key, use it.\n # - Otherwise if there's a three digit prefix.\n # - Else nil.\n #--------------------------------------------------------\n def resource.sort_order\n if self.data.key?('order')\n self.data['order'].to_i\n elsif self.page_name[0..2].to_i != 0\n self.page_name[0..2].to_i\n else\n nil\n end\n end\n\n\n #--------------------------------------------------------\n # valid_features\n # Returns an array of valid features for this page\n # based on the current target, i.e., features that\n # are true for the current target. These are the\n # only features that can be used with frontmatter\n # :target or :exclude.\n #--------------------------------------------------------\n def resource.valid_features\n options = app.extensions[:Middlemac].options\n options.Targets[options.Target][:Features].select { |k, v| v }.keys\n end\n\n\n #--------------------------------------------------------\n # targeted?\n # Determines if this pages is eligible for inclusion\n # in the current build/server environment based on:\n # - is an HTML file, and\n # - has a sort_order, and\n # - if frontmatter:target is used, the target or\n # feature appears in the frontmatter, and\n # - if frontmatter:exclude is used, the target or\n # enabled feature does NOT appear in the\n # frontmatter.\n #--------------------------------------------------------\n def resource.targeted?\n target_name = app.extensions[:Middlemac].options.Target\n self.ext == '.html' &&\n self.data.key?('title') &&\n !self.sort_order.nil? &&\n ( !self.data['target'] || (self.data['target'].include?(target_name) || (self.data['target'] & self.valid_features).count > 0) ) &&\n ( !self.data['exclude'] || !(self.data['exclude'].include?(target_name) || (self.data['exclude'] & self.valid_features).count > 0) )\n end\n\n\n #--------------------------------------------------------\n # brethren\n # Returns an array of all of the siblings of the\n # specified page, taking into account their\n # eligibility for display.\n # - is not already the current page, and\n # - is targeted for the current build.\n # Returned array will be:\n # - sorted by sort_order.\n #--------------------------------------------------------\n def resource.brethren\n pages = self.siblings.find_all { |p| p.targeted? && p != app.current_page }\n pages.sort_by { |p| p.sort_order }\n end\n\n\n #--------------------------------------------------------\n # brethren_next\n # Returns the next sibling based on order or nil.\n #--------------------------------------------------------\n def resource.brethren_next\n if self.sort_order.nil?\n puts 'NEXT reports no sort order.'\n return nil\n else\n return self.brethren.select { |p| p.sort_order == app.current_page.sort_order + 1 }[0]\n end\n end\n\n\n #--------------------------------------------------------\n # brethren_previous\n # Returns the previous sibling based on order or nil.\n #--------------------------------------------------------\n def resource.brethren_previous\n if self.sort_order.nil?\n puts 'PREV reports no sort order.'\n return nil\n else\n return self.brethren.select { |p| p.sort_order == app.current_page.sort_order - 1 }[0]\n end\n end\n\n\n #--------------------------------------------------------\n # navigator_eligible?\n # Determine whether a page is eligible to include a\n # previous/next page control based on:\n # - the group is set to allow navigation (:navigate)\n # - this page is not excluded from navigation. (:navigator => false)\n # - this page has a sort_order.\n #--------------------------------------------------------\n def resource.navigator_eligible?\n (self.parent && self.parent.data.key?('navigate') && self.parent.data['navigate'] == true) &&\n !(self.data.key?('navigator') && self.data['navigator'] == false) &&\n (!self.sort_order.nil?)\n end\n\n\n #--------------------------------------------------------\n # legitimate_children\n # Returns an array of all of the children of the\n # specified page, taking into account their\n # eligibility for display.\n # - is targeted for the current build.\n # Returned array will be:\n # - sorted by sort_order.\n #--------------------------------------------------------\n def resource.legitimate_children\n pages = self.children.find_all { |p| p.targeted? }\n pages.sort_by { |p| p.sort_order }\n end\n\n\n #--------------------------------------------------------\n # breadcrumbs\n # Returns an array of pages leading to the current\n # page.\n #--------------------------------------------------------\n def resource.breadcrumbs\n hierarchy = [] << self\n hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent\n hierarchy\n end\n\n\n end # .each\n\n resources\nend",
"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 generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n @ssh.write \"/tmp/node.json\", content: JSON.generate(run_list), sudo: true\n end",
"def collect_resources\n logger.info \"Collecting resources from #{configuration.resource_path}\" do\n Dir.glob(File.join(configuration.resource_path, \"*.rb\")).each do |file|\n @run_context.add_resource_from_file ResourceFile.new(file)\n end\n end\n end",
"def manipulate_resource_list(resources)\n\n\n index_file = app.index_file\n new_index_path = \"/#{index_file}\"\n\n # for each resource\n resources.each do |resource|\n\n # has custom_url in frontmatter\n if resource.raw_data[:custom_url]\n\n # set path as custom_url\n resource.destination_path = resource.raw_data[:custom_url] + new_index_path\n end\n end\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 add_config_folder\n directory 'templates/dry/config', \"#{name}/config\", recursive: true\n end",
"def run\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # Go through all files added from CL (sort them first)\n # If empty, sort and each will do nothing, no errors\n _completed_dirs = Array.new()\n _completed_files = Array.new()\n if @config.cl_entry_set\n @config.file_list.sort.each do |_file|\n _completed_files.push(parse_file(_file))\n end\n end\n\n # Then go through all the specified directories\n # Initial parse depth to parse_dir is 0 (unlimited)\n @config.dir_list.sort.each do |_dir|\n _completed_dirs.push(parse_dir(_dir, 0))\n end\n\n # Create overall hash for parsed files\n _structure = Hash.new()\n _structure[:files] = _completed_files\n _structure[:subdirs] = _completed_dirs\n\n debug_print \"_structure dump\\n\\n\"\n debug_print PP.pp(_structure, '')\n debug_print \"\\n\\n\"\n\n # Pass structure to poster with count as 0\n Remote.post_structure(_structure, @config, 0)\n\n _structure\n end",
"def build(resources)\n current = [] || YAML.load_file(path)\n\n resources.each do |resource|\n item = {}\n item['path'] = resource\n item['modified'] = File.mtime(resource).to_s\n item['processed'] = Time.now.to_s\n\n current << item\n end\n\n current\n end",
"def write_out\n @all_content.each do |venue_id, venue_content|\n manifest_dir = \"#{@base.deploy_path}\" / \"#{venue_content.sha1_digest}\"\n venue_dir = \"#{@base.deploy_path}\" / \"#{Venue.get!(venue_id).router.identifier}\"\n manifest_file = manifest_dir / \"manifest.json\"\n files_dir = manifest_dir / \"files\"\n venue_content_ln = \"#{venue_dir}\" / \"content\"\n sha1_file = manifest_dir / \"#{venue_content.sha1_digest}.sha1\"\n \n FileUtils.rm(venue_content_ln) if File.exists?(venue_content_ln)\n FileUtils.mkdir_p(venue_dir)\n if File.exists?(sha1_file)\n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n next\n end\n\n FileUtils.mkdir_p(manifest_dir)\n\n open(manifest_file, \"w+\") do |f|\n f << venue_content.manifest.to_json\n end\n\n #FileUtils.mkdir_p(files_dir)\n source_files = venue_content.filelist\n venue_content.filelist.each do |f|\n #UploadManager is using the first 2 bytes of the file digest as directory names.\n #The split('/'[-3..-1].join('') restores the filename to the full digest when it is copied\n #from the upload dir to the deployment dir\n dest = \"#{manifest_dir}\" / \"#{f.split('/')[-3..-1].join('')}\"\n FileUtils.cp(f, dest)\n end\n \n open(sha1_file, \"w+\") do |f|\n f << venue_content.sha1_digest\n end\n \n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n end\n end",
"def generate_config(watchers)\n watchers.each do |watcher|\n # if service doesnt have backup block, skip it\n next unless watcher.backup\n log.info \"#{watcher.name} - #{watcher.backends} - #{watcher.haproxy} - #{watcher.backup}\"\n \n @watcher_configs[watcher.name] = parse_watcher_config(watcher)\n backup_conf_file = watcher.backup['backup_conf_file']\n cron_conf_file = watcher.backup['cron_conf_file']\n gzip = watcher.backup['gzip']\n name = watcher.name\n\n # generate backup config\n databases_stanza = generate_stanza(\"#{@backup['databases']['type']}.erb\", @watcher_configs[watcher.name]['databases'])\n storages_stanza = generate_stanza(\"#{@backup['storages']['type']}.erb\", @watcher_configs[watcher.name]['storages'])\n notifiers_stanza = generate_stanza(\"#{@backup['notifiers']['type']}.erb\", @watcher_configs[watcher.name]['notifiers'])\n final_config = generate_backup(name, databases_stanza, storages_stanza, notifiers_stanza, gzip)\n log.info \"config array is #{final_config}\"\n\n write_config(final_config, backup_conf_file)\n\n # generate cron job config \n run_command = \"#{@opts['run_command']} --config-file #{@opts['config_file']} --trigger #{name}\"\n cron_config = \"#{watcher.backup['cron']} #{run_command} > /dev/null 2>&1\"\n\n if @opts['do_cron']\n write_config(cron_config, cron_conf_file)\n end\n end\n end",
"def create_config \n @config = ::Capistrano::Configuration.new\n if @cloud.debug || @cloud.verbose \n @config.logger.level = @cloud.debug ? ::Capistrano::Logger::MAX_LEVEL : ::Capistrano::Logger::INFO\n else\n @config.logger.level = ::Capistrano::Logger::IMPORTANT\n end\n \n capfile = returning Array.new do |arr|\n Dir[\"#{::File.dirname(__FILE__)}/recipies/*.rb\"].each {|a| arr << \"require '#{a}'\" }\n arr << \"ssh_options[:keys] = '#{@cloud.full_keypair_basename_path}'\"\n \n arr << set_poolparty_roles\n end.join(\"\\n\")\n \n @config.provisioner = self\n @config.cloud = @cloud\n \n @config.load(:string => capfile)\n \n @cloud.deploy_file ? @config.load(@cloud.deploy_file) : @config.set(:user, @cloud.user)\n end",
"def generate_config(resource)\n resource = symbolize_hash(convert_to_hash(resource))\n config = []\n config << \"lxc.utsname = #{resource[:utsname]}\"\n if(resource[:aa_profile])\n config << \"lxc.aa_profile = #{resource[:aa_profile]}\"\n end\n [resource[:network]].flatten.each do |net_hash|\n nhsh = Mash.new(net_hash)\n flags = nhsh.delete(:flags)\n %w(type link).each do |k|\n config << \"lxc.network.#{k} = #{nhsh.delete(k)}\" if nhsh[k]\n end\n nhsh.each_pair do |k,v|\n config << \"lxc.network.#{k} = #{v}\"\n end\n if(flags)\n config << \"lxc.network.flags = #{flags}\"\n end\n end\n if(resource[:cap_drop])\n config << \"lxc.cap.drop = #{Array(resource[:cap_drop]).join(' ')}\"\n end\n %w(include pts tty arch devttydir mount mount_entry rootfs rootfs_mount pivotdir).each do |k|\n config << \"lxc.#{k.sub('_', '.')} = #{resource[k.to_sym]}\" if resource[k.to_sym]\n end\n prefix = 'lxc.cgroup'\n resource[:cgroup].each_pair do |key, value|\n if(value.is_a?(Array))\n value.each do |val|\n config << \"#{prefix}.#{key} = #{val}\"\n end\n else\n config << \"#{prefix}.#{key} = #{value}\"\n end\n end\n config.join(\"\\n\") + \"\\n\"\n end",
"def run\n return unless setup_compilable\n\n @collection.files.values.each do |pointer|\n compiled_file = File.join(@collection.compiled_path, pointer['id'])\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r pointer['realpath'], compiled_file\n Ruhoh::Friend.say { green \" > #{pointer['id']}\" }\n end\n end",
"def prepare_config_files\n #Create .config dir\n #Create tucotuco dir\n #Create short dir\n #Create info file\n end",
"def templates\n ts = Dir.glob('**/*.json').reject{ |f| f['builds'] }\n ts.reject{ |f| f[/macos|rhel|sles|solaris|windows/] }\n\n b32 = []\n b64 = []\n config['public'].each do |p, vs|\n vs.each do |v, as|\n as.each do |a|\n case a\n when \"i386\", \"i686\"\n b32 << ts.select{ |i| i[/#{p}-#{v}-#{a}/] }\n else\n b64 << ts.select{ |i| i[/#{p}-#{v}-#{a}/] }\n end\n end\n end\n end\n list = b64 + b32\n list.flatten\nend",
"def configure\n @container.set_rw_permission_R(@path)\n\n # application developer cannot change git hooks\n hooks = PathUtils.join(@path, 'hooks')\n @container.set_ro_permission_R(hooks)\n\n render_file = lambda { |f, m, t|\n File.open(f, 'w', m) { |f| f.write(ERB.new(t).result(binding)) }\n }\n\n render_file.call(PathUtils.join(@path, 'description'), 0644, GIT_DESCRIPTION)\n render_file.call(PathUtils.join(@container.container_dir, '.gitconfig'), 0644, GIT_CONFIG)\n\n render_file.call(PathUtils.join(hooks, 'pre-receive'), 0755, PRE_RECEIVE)\n render_file.call(PathUtils.join(hooks, 'post-receive'), 0755, POST_RECEIVE)\n end",
"def run\n return unless setup_compilable\n\n @collection.files.values.each do |pointer|\n compiled_file = File.join(@collection.compiled_path, pointer['id'])\n\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r pointer['realpath'], compiled_file\n\n Ruhoh::Friend.say { green \" > #{pointer['id']}\" }\n end\n end",
"def before_build\n file_patterns = options[:files] || '*.mustache'\n files = Dir[*[file_patterns].flatten]\n vars = {\n :env => pusher.env,\n :config => pusher.config\n }.merge(options[:vars] || {})\n Couchino.logger.debug \"Mustache vars: #{vars.inspect}\"\n files.each do |file|\n Couchino.logger.debug \"Running #{file} through mustache.\"\n basename = File.basename(file)\n dir = File.dirname(file)\n parts = basename.split(/\\./)\n new_file = parts.length > 2 ? parts[0..-2].join('.') : parts[0] + \".html\"\n File.open(File.join(dir, new_file), 'w') do |f|\n f << ::Mustache.render(File.read(file), vars)\n end\n Couchino.logger.debug \"Wrote to #{new_file}\"\n end\n end",
"def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end",
"def custom_capify(data={}, config=nil)\n # defaults\n data[:server_url] = \"\"\n data[:branch] = \"master\"\n\n FileUtils.mkdir_p AppDirectory.deploy\n\n build_capfile\n\n deploy_rb = AppDirectory.config.join('deploy.rb')\n build_template(\"templates/deploy.rb.erb\", deploy_rb, binding)\n\n FileUtils.mkdir_p AppDirectory.tasks\n\n puts I18n.t :capified, scope: :negroku\n\n end",
"def add_admin_routes\n ['sidebar','users','pages','documents','settings'].each do |file|\n template \"config/admin/#{file}.yml\", \"config/admin/#{file}.yml\"\n end\n end",
"def configure\n raise 'Path is required' unless @resource[:path]\n arr = [\"create -b #{@resource[:create_args]}\"]\n\n # Then perform all of our configuration steps. It's annoying\n # that we need this much internal info on the resource.\n resource.properties.each do |property|\n next unless my_properties.include? property.name\n method = (property.name.to_s + '_conf').to_sym\n arr << send(method, @resource[property.name]) unless property.safe_insync?(properties[property.name])\n end\n setconfig(arr.join(\"\\n\"))\n end",
"def copy_initializer\n template 'k8s/tests_job.yaml', \"k8s/#{app_name}_tests_job.yaml\"\n template 'k8s/deployment.yaml', \"k8s/#{app_name}_deployment.yaml\"\n template 'k8s/service.yaml', \"k8s/#{app_name}_service.yaml\"\n template 'k8s/setup_job.yaml', \"k8s/#{app_name}_setup_job.yaml\"\n template 'Jenkinsfile', \"Jenkinsfile\"\n template \"Dockerfile.#{docker_base}\", \"Dockerfile\"\n template \"Dockerfile.test.#{docker_base}\", \"Dockerfile.test\"\n template 'database.yml.prod', \"database.yml.prod\"\n template 'database.yml.test', \"database.yml.test\"\n end",
"def create_deploy\n @@tpl = CapistranoDeployGenerator.source_root\n empty_directory \"config/deploy\"\n\n say <<-EOF\n\nconfig/deploy.rb generator\n\nThis menu will help you creating deployment configuration file\ndeploy.rb for Capistrano. It is safe to acceppt defulat values for\nmost or all questions. Just hit Enter if default is provided.\n\nAll values can be changed later in the file itself or you can re-run\ngenerator again.\n\nEOF\n template \"deploy.rb.erb\", \"config/deploy.rb\"\n @stages.each do |stage|\n template \"staging.rb.erb\", \"config/deploy/#{stage}.rb\" \n end\n say \"Please edit manually configuration of the multi-staging files:\"\n @stages.map { |x| say \"./confg/deploy/#{x}.rb\\n\"}\n end",
"def generate_config(watchers)\n main_stanza = []\n events_stanza = []\n http_stanza = []\n upstream_stanza = []\n location_stanza = []\n server_stanza = []\n watchers.each do |watcher|\n # if service doesnt has nginx block, skip it\n next unless watcher.nginx \n log.info \"#{watcher.name} - #{watcher.backends} - #{watcher.haproxy} - #{watcher.nginx}\"\n @watcher_configs[watcher.name] = parse_watcher_config(watcher)\n log.info @watcher_configs\n upstream_stanza << generate_upstream_stanza(watcher, @watcher_configs[watcher.name]['upstream']) \n location_stanza << generate_location_stanza(watcher,@watcher_configs[watcher.name]['location'])\n end\n\n main_config = get_main_config\n main_stanza = generate_main_stanza(main_config)\n\n event_config = get_event_config\n events_stanza = generate_event_stanza(event_config)\n\n http_config = get_http_config\n http_stanza = generate_http_stanza(http_config)\n close_bracket = [\"}\"]\n\n base_server_config = get_server_base_config\n server_stanza = generate_server_stanza(location_stanza,base_server_config)\n if http_stanza.empty?\n final_config = main_stanza << events_stanza << http_stanza << upstream_stanza << server_stanza \n else\n final_config = main_stanza << events_stanza << http_stanza << upstream_stanza << server_stanza << close_bracket \n end\n log.info \"config array is #{final_config}\"\n\n return final_config\n end",
"def expand_template_files\n rails_host = config['bind-address'] || `hostname`.chomp\n rails_port = config['port-number'].to_s\n rails_url = \"http://#{rails_host}:#{rails_port}\"\n Dir[File.join(install_directory,'installer','*.template')].each do |template_file|\n output_file = template_file.gsub(/\\.template/,'')\n next if File.exists?(output_file) # don't overwrite files\n\n message \"expanding #{File.basename(output_file)} template\"\n \n text = File.read(template_file).gsub(/\\$RAILS_URL/,rails_url).gsub(/\\$RAILS_HOST/,rails_host).gsub(/\\$RAILS_PORT/,rails_port)\n \n File.open(output_file,'w') do |f|\n f.write text\n end\n end\n end",
"def copy_files\r\n %w{_config.dev.yml about.md feed.xml gulpfile.js index.html}.each do |file|\r\n copy_file file\r\n end\r\n end",
"def each &block # :yields: content, options\n self.class.resources_creator.call(content, options).each &block \n end",
"def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end",
"def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n ssh.write \"#{CHEF_VAR_PATH}/node.json\", content: JSON.generate(run_list), sudo: true\n end",
"def configure_vms(config)\n $vms.each do |key,vm_config|\n # pp vm_config\n config.vm.define key, autostart: vm_config['autostart'] || false do |node|\n # node.ssh.insert_key = true\n # node.ssh.username = \"toto\"\n \n configure_node(vm_config, node)\n vm_config_copy = object_clone(vm_config)\n vm_config_copy.delete('packer')\n # generate packer\n packer_gen(vm_config)\n log_to_file(\"vms/#{vm_config['lib']['namespace']}/#{vm_config['lib']['key']}.yaml\", vm_config_copy.sort_by_key(true).to_h.to_yaml)\n end\n end\nend",
"def add_resource_pools_to_manifest(manifest)\n if any_service_nodes?\n config.each do |cluster|\n server_count = cluster[\"count\"]\n server_flavor = cluster[\"flavor\"]\n resource_pool = {\n \"name\" => cluster_name(cluster),\n \"network\" => \"default\",\n \"size\" => server_count,\n \"stemcell\" => {\n \"name\" => system_config.stemcell_name,\n \"version\" => system_config.stemcell_version\n },\n # TODO how to create \"cloud_properties\" per-provider?\n \"cloud_properties\" => {\n \"instance_type\" => server_flavor\n },\n \"persistent_disk\" => system_config.common_persistent_disk\n }\n manifest[\"resource_pools\"] << resource_pool\n end\n end\n end",
"def render_json (yaml_files)\n files = Dir[yaml_files]\n log(\"Rendering JSON configs for jmxtrans\")\n files.each do | yaml_file |\n log(\"Rendering to JSON: #{yaml_file}\")\n execute \"render json\" do\n command \"python #{node['jmxtrans']['home']}/tools/yaml2jmxtrans.py #{yaml_file}\"\n cwd \"#{node['jmxtrans']['config_dir']}/json\"\n action :run\n end\n end\n\n json_files = Dir[\"#{node['jmxtrans']['config_dir']}/json\"]\n\n json_files.each do | json_file |\n log(\"Rendering JSON file: #{json_file}}\")\n end\nend",
"def new_config_content\n return <<-VHOST\n\n# vh configuration file\nInclude #{@target}\n# /vh configuration file\n VHOST\n end",
"def create_file_config\n # template \"config/express_translate.yml\", \"config/express_translate.yml\"\n end",
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def generate(site)\n return unless site.config['mini_magick']\n\n site.config['mini_magick'].each_pair do |name, preset|\n \n Dir.chdir preset['source'] do\n if preset['recursive'] == false \n #false\n root = '.'\n else\n #true or nil\n root = '**'\n end\n\n puts 'Add images for later processing:'\n puts Dir.pwd\n Dir.glob(File.join(root, \"*.{png,jpg,jpeg,gif,PNG,JPG,JPEG,GIF}\")) do |source|\n puts ' ' + source\n site.static_files << GeneratedImageFile.new(site, site.source, preset['destination'], source, preset.clone)\n end\n end\n end\n end",
"def generate force_build = false\n blog_template = Template::Blog.new self\n\n skipped_files = []\n new_files = []\n updated_files = []\n old_files = Dir.glob('public/**/*.html')\n\n blog_template.modes.each {\n |mode|\n\n blog_template.mode = mode\n\n (1..blog_template.pages).each { |page|\n blog_template.page = page\n path = blog_template.local_path\n pretty_path = Pathname.new(path).relative_path_from(Pathname.new(@spec.blog_root)).to_s\n\n if old_files.include? pretty_path\n old_files.delete pretty_path\n end\n\n mtime = File.exists?(path) ? File.mtime(path) : nil\n needs_update = force_build || mtime.nil?\n\n if ! needs_update\n needs_update = blog_template.posts.any? {\n |post|\n mtime < File.mtime(post.post_data.source_path)\n }\n\n if ! needs_update\n skipped_files << path\n next\n end\n end\n\n dir = File.dirname(path)\n FileUtils.mkdir_p dir unless File.directory? dir\n\n if File.exists? path\n updated_files << pretty_path\n else\n new_files << pretty_path\n end\n\n r = nil\n File.open(path, 'w') {\n |io|\n io.write blog_template.render\n }\n }\n }\n\n updated_files.each { |path| puts \"* #{path}\" }\n\n new_files.each { |path| puts \"+ #{path}\"}\n\n old_files.each {\n |path|\n puts \"- #{path}\"\n File.unlink path\n dir = File.dirname path\n if Dir.entries(dir) == @@EMPTY_DIR_ENTRIES\n Dir.unlink dir\n end\n }\n end",
"def prepare_publish\n workload = []\n\n source_category = \"stage\"\n destination_category = \"pool\"\n\n Component.dataset(source_category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], source_category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n destination = Architecture.new(package.architecture, entry[:component], entry[:suitename], destination_category)\n\n workload << {\n :source_fullname => fullname,\n :destination_fullname => File.join(destination.directory, package.newbasename),\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => package.architecture\n }\n end\n end\n \n workload\n end",
"def build \n configure_directories\n \n @spec['collision'] = 'destroy'\n \n \n jobs = []\n \n # Recon\n recon_options = {'rawdir' => @rawdir, 'epi_pattern' => /(Rest|Task)/i, }\n config_step_method(recon_options, 'recon') if @config['custom_methods']\n jobs << ReconJobGenerator.new(recon_options).build\n \n # Preproc\n preproc_options = {'scans' => jobs.first['scans']}\n config_step_method(preproc_options, 'preproc') if @config['custom_methods']\n jobs << PreprocJobGenerator.new(preproc_options).build\n \n # Stats\n stats_options = {\n 'scans' => jobs.first['scans'],\n 'conditions' => @config['conditions'],\n 'responses_dir' => @config['responses_dir'],\n 'subid' => @spec['subid']\n }\n config_step_method(stats_options, 'stats') if @config['custom_methods']\n jobs << StatsJobGenerator.new(stats_options).build\n \n @spec['jobs'] = jobs\n \n return @spec\n end",
"def publish(options={})\n options = options.rekey(&:to_s)\n\n raise \"no username\" unless username\n\n sitemap = options['sitemap'] || config.sitemap\n filter = options['filter'] || config.rsync_filter\n delete = options['delete'] || config.rsync_delete\n optargs = options['extra'] || config.rsync_extra\n\n case sitemap\n when Hash\n when Array\n sitemap.inject({}) do |h, (s, d)|\n h[s] = d; h\n end\n else\n sitemap = { sitemap.to_s => '.' }\n end\n\n sitemap.each do |from, to|\n if !File.directory?(from)\n raise ArgumentError, \"Non-existant publishing directory -- #{from}.\"\n end\n end\n\n sitemap.each do |source, subdir|\n if subdir and subdir != '.'\n destination = File.join(unixname, subdir)\n else\n destination = unixname\n end\n\n dir = source.to_s.chomp('/') + '/'\n url = \"#{username}@rubyforge.org:/var/www/gforge-projects/#{destination}\"\n\n op = [\"-rLvz\"] # maybe -p ?\n op << \"-n\" if trial?\n op << \"-v\" if not quiet?\n op << \"-q\" if quiet?\n op << \"--progress\" if trace?\n op << \"--del-after\" if delete\n op << optargs if optargs\n\n # custom filter\n op << \"--filter='. #{filter}'\" if filter\n\n # create special rubyforge filter (.rsync-filter), if needed.\n create_rsync_filter(source)\n\n # per dir-merge filter\n op << \"--filter=': .rsync-filter'\"\n\n op = op.flatten + [dir, url]\n\n cmd = \"rsync \" + op.join(' ') # \"rsync #{op.to_params}\"\n\n # rsync supports a trial mode. let it through?\n #if trial?\n # puts cmd\n #else\n system cmd #UploadUtils.rsync(options)\n #end\n end\n end",
"def collect_files(set)\n printf(\"@I:Collect Files\\n\")\n \n # Make Director\n Common.make_dir(\"#{@SRC_DIR}\")\n printf(\"@I:Make direcory to save src- %s\\n\",@SRC_DIR)\n @set = set\n \n # Expand Path\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |tmp3|\n result = /^\\$\\{(\\w*)\\}.*/ =~ tmp3[1]\n if result == 0\n path = @set[\"#{$1}\"]\n if path == nil\n $ERROR_CNT += 1\n printf(\"@E:Not found environment path\\(\\$\\{%s\\}\\), pleae chek parameter file\\n\",$1)\n print_summary\n exit\n end\n macro = \"${\" + $1 + \"}\"\n tmp3[1] = tmp3[1].sub(\"#{macro}\",\"#{path}\")\n end\n end\n end\n \n # Copy files to work direcotry & make Readme.txt\n readme = @SRC_DIR + \"/00Readme.txt\"\n f = open(readme,\"w\")\n print_file_header(f,\"Copied files from parts file\")\n f.printf(\"#\\n\");\n f.printf(\"# Execute Information\\n\")\n f.printf(\"#\\n\")\n f.printf(\"# [PARAMETER]\");f.printf(\"%s\\n\",$PARAMETER_FILE) \n f.printf(\"# [REPORT ]\");f.printf(\"%s\\n\",$REPORT_FILE) \n f.printf(\"# [PARTS ]\");f.printf(\"%s\\n\",$PARTS_FILE) \n f.printf(\"# [CONNECT ]\");f.printf(\"%s\\n\",$CONNECT_FILE) \n f.printf(\"#\\n\");\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |file|\n if File::exists?(file[1]) == true\n FileUtils.install(file[1],@SRC_DIR + \"/\" + File.basename(file[1]), :mode => 0400 )\n f.printf(\"[MACRO Name]%s: %s\\n\", tmp[0], file[1])\n else\n $WARNING_CNT += 1\n printf(\"@W-parts001:%s is not exist\\n\",file[1])\n f.printf(\"[MACRO Name]%s: %s\\n -!!CAUTION!!There is no original file.\\n\", tmp[0],file[1])\n end\n end\n end\n f.close\n if $VERBOSE == true\n printf(\"@I:Print copied file\\n\")\n system (\"ls -al #{@SRC_DIR}\")\n end\n \n printf(\"@I:Collect Files Done\\n\")\n \n end",
"def generate_logrotate_configs(config_files, logrotate_conf_dir, logrotate_template_dir)\n config_files.each do |config_file|\n output_file = logrotate_conf_dir + config_file\n template_file = logrotate_template_dir + (config_file + '.erb')\n template output_file do\n source template_file\n mode '0644'\n end\n end\nend",
"def build_section_for_loose_files\n\n linked_resources.map do |resource_type|\n relevant_files = resource_type.filter_files(resources_files.map(&:path))\n relevant_files = filter_exclusions(relevant_files)\n\n log \"Found #%s %s in the project.\", relevant_files.count, resource_type.resource_type.downcase\n\n section_name = resource_type.resource_type\n section_data = build_section_data(relevant_files, resource_type, {\n use_basename: [:key, :path],\n path_without_ext: !@use_filename_extension\n })\n new_section(section_name, section_data)\n end.compact\n end",
"def generate\n return {} if config.empty?\n assets = {}\n config.each do |key, value|\n next if key == \"widgets\" # Widgets are handled separately.\n assets[key] = Array(value).map { |v|\n {\n \"url\" => url(v),\n \"id\" => File.join(@ruhoh.paths.theme, \"javascripts\", v)\n }\n }\n end\n \n assets\n end",
"def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\n end",
"def synchronize_pool_with(working_dir)\n timed_section(Rails.logger, 'process_app_resources') do\n f = Fiber.current\n opts = {\n :logger => Rails.logger,\n :nobacktrace => true,\n :callback => proc { f.resume }\n }\n VCAP.defer(opts) do\n pool = CloudController.resource_pool\n pool.add_directory(working_dir)\n @resource_descriptors.each do |descriptor|\n target = File.join(working_dir, descriptor[:fn])\n pool.copy(descriptor, target)\n end\n end\n Fiber.yield\n end\n end",
"def load_config\n projects = Array.new\n Dir.glob(\"#{@config_path}/*.json\") do |cf|\n if !cf.end_with?(\"template.json\")\n projects << Project.new(cf)\n end\n end\n projects\nend",
"def create_config!\n template = File.read(TEMPLATES + 'montage.yml')\n template.gsub!(/<sprites>/, @sprites_path.to_s)\n template.gsub!(/<sources>/, @sources_path.to_s)\n\n File.open(@dir + '.montage', 'w') do |config|\n config.puts template\n end\n end",
"def create_additional_options\n type_dir = new_resource.send('config_dir_' + new_resource.type)\n new_resource.additional_options.each do |k, v|\n file \"#{new_resource.instance} :create #{type_dir})/#{k}\" do\n path \"#{type_dir}/#{k}\"\n content v\n end\n end\n end",
"def configs(cfg)\n Dir.glob(cfg[\"tile_engines\"][\"conf_dir\"] + \"/*.conf.yml\").each do |item|\n\t engine_cfg = File.open(item){|fd| YAML.load(fd)}\n\t engine_cfg[\"mailer_config\"] = cfg[\"tile_engines\"][\"mailer_config\"]\n\t engine_cfg[\"config_path\"]=item\n\t yield engine_cfg\n end\n end",
"def deploy(hosts)\n thread_list = [] #keep track of our threads\n hosts.each do | h | \n thread_list << Thread.new { #add a new thread to\n verbose(\"deplying to #{h}\")\n #get filenames in api dir\n Dir.chdir(\"../api/\")\n files = Dir.glob(\"*.rb\")\n files.each do | file |\n verbose(\"Uploading File #{file}\")\n Net::SSH.start(h, 'watchcat') do |ssh|\n output = ssh.scp.upload!(file, \"/usr/src/watchcat/\")\n end\n end\n\n #and now do the extensions dir\n Dir.chdir(\"../api/extensions/\")\n files = Dir.glob(\"*.rb\")\n verbose(\"Uploading Extensions\")\n files.each do | file |\n verbose(\"Uploading File #{file}\")\n Net::SSH.start(h, 'watchcat') do |ssh|\n output = ssh.scp.upload!(file, \"/usr/src/watchcat/extensions\")\n end\n end\n\n }\n end\n thread_list.each {|t| t.join} #wait for each thread to complete \nend",
"def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end",
"def add_vendor_files\n say_quietly \"Copying files...\"\n\n %w[auth backend frontend].each do |section|\n template \"vendor/assets/javascripts/archangel/#{section}.js\"\n template \"vendor/assets/stylesheets/archangel/#{section}.css\"\n end\n end",
"def init_config_folder\n copy_file('config/app.js', src_path('config/app.js'))\n copy_file('config/routes.js', src_path('config/routes.js'))\n copy_file('config/router.js', src_path('config/router.js'))\n end",
"def copy_extra_resources(config)\n html_resources_path = config[\"output\"]\n _copy_extra_resources(html_resources_path)\n\n docset_resources_path = docset_resources_path(config)\n if docset_resources_path.length > 0\n _copy_extra_resources(docset_resources_path)\n end\n end",
"def set_as_the_collection_class\n config = 'config/initializers/hyrax.rb'\n lastmatch = nil\n in_root do\n File.open(config).each_line do |line|\n lastmatch = line if line.match?(/config.collection_model = /)\n end\n content = \" # Injected via `rails g hyrax:collection_resource #{class_name}`\\n\" \\\n \" config.collection_model = '#{class_name}'\\n\"\n\n anchor = lastmatch || \"Hyrax.config do |config|\\n\"\n inject_into_file config, after: anchor do\n content\n end\n end\n end",
"def compose\n add_gateway_routes # \"child template\": build before add_gateway_rest_api. RestApi logical id and change detection is dependent on it.\n add_gateway_rest_api # changes parent template\n add_custom_domain # changes parent template\n end",
"def write_ansible_runtime_vars(config, fn_config, fn_ansible_runtime_config)\n\n exists = File.exists?(fn_ansible_runtime_config)\n current = exists && File.stat(fn_config).mtime <= File.stat(fn_ansible_runtime_config).mtime\n\n # return if exists && current\n \n config.core[:base_dir].merge!({\n \n \"root\" => File.expand_path(config.core[:base_dir]['root'])\n })\n \n File.write(fn_ansible_runtime_config, JSON.pretty_generate({custom: config.core}))\nend",
"def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend",
"def list_published\n res = Hash.new\n out = runcmd 'aptly publish list'\n out.lines.each do |line|\n if line.start_with? ' * '\n resource = {}\n parts = line[3..-1].split(/\\[|\\]|\\(|\\)/)\n resource['path'] = parts[0].strip\n resource['component'] = parts[1].strip\n resource['archlist'] = parts[3].split(', ')\n resource['from_name'] = parts[5].strip\n if parts[6].include? 'Snapshot'\n resource['from_type'] = 'snapshot'\n elsif parts[6].include? 'Repo'\n resource['from_type'] = 'repo'\n else\n next\n end\n dist = line.split.last\n res[resource['path']] = resource\n end\n end\n res\n end",
"def entries\n Dir.chdir(@output_dir) do\n Dir['*.json']\n end\n end",
"def generate_ansible_files\n \n # Helper to decide whether or not to generate/update a given file\n update = Proc.new do |fn, mtime|\n !(File.exists?(fn) && File.stat(fn).mtime >= mtime)\n true\n end\n\n Dir.glob('./templates/ansible.*').each do |template|\n\n # Get a template's last modified date\n source_mtime = File.stat(template).mtime \n\n # Get a destination's potential file name & path \n target_file = File.basename(template).split('.').slice(1...-1).join('.') \n target_paths = target_file.start_with?('inventory') ? ['inventory/'] : ['', 'plays/*/']\n\n # Walk destination path(s)\n target_paths.each do |target_path|\n \n Dir.glob(\"./ansible/#{target_path}\").each do |path|\n\n # Build a potential real path\n fn = File.join(File.expand_path(path), target_file) \n\n # Yield source (template file) & target if the target needs to be generated/updated\n yield template, fn if update.call(fn, source_mtime) && block_given?\n end\n end\n end\nend",
"def call\n INSTALL_DIRS.each do |dir|\n FileUtils.mkdir_p Karafka.root.join(dir)\n end\n\n INSTALL_FILES_MAP.each do |source, target|\n target = Karafka.root.join(target)\n next if File.exist?(target)\n\n source = Karafka.core_root.join(\"templates/#{source}\")\n FileUtils.cp_r(source, target)\n end\n end",
"def config_body_for(config)\n res = <<-EOH.gsub(/^ +/, '')\n # This file is managed by Chef.\n # Any changes to it will be overwritten.\n EOH\n res << Hash[config.sort].map { |k, v| config_for(k, v) }.compact\n .join(\"\\n\")\n end",
"def config_file_contents\n output = []\n output << HEADING\n output << 'linters:' if linters_with_lints.any?\n linters_with_lints.each do |linter, files|\n output << generate_config_for_linter(linter, files)\n end\n output.join(\"\\n\\n\")\n end",
"def config_files(override); end",
"def define\n desc \"Create Ruby on Rails plug-in package\"\n task :rails_plugin do\n @dest = \"#@package_dir/#{@name}_#{@version}\"\n makedirs(@dest,:verbose=>false)\n @plugin_files.each do |fn|\n cp(fn, @dest,:verbose=>false)\n add_file(File.basename(fn))\n end\n \n @package_files.each do |fn|\n puts \". #{fn}\" if verbose\n f = File.join(@dest, fn)\n fdir = File.dirname(f)\n unless File.exist?(fdir)\n mkdir_p(fdir,:verbose=>false)\n add_folder(\"#{fdir}/\")\n end\n if File.directory?(fn)\n mkdir_p(f,:verbose=>false)\n add_folder(\"#{fn}/\")\n else\n cp(fn, f, :verbose=>false)\n add_file(fn)\n end\n end\n \n generate_index_files()\n end\n end",
"def parse_configuration\n @vm_spec_configuration.each do |property, value|\n if property == 'resources'\n parse_resources(value)\n else\n @zonecfg_commands << \"set #{property}=#{value}\"\n end\n end\n @zonecfg_commands << 'exit'\n end",
"def build_provisions(run_directory, data_directory, whitelist, blacklist)\n \n Scarcity::Submission.new do\n \n # declare where runs happen and where data comes from\n # and indicate that we gather default provisions accordingly \n # This will not need to change in almost all cases.\n runs_in run_directory\n pulls_from data_directory, :only => whitelist, :except => blacklist\n gathers_provisions :zip_data => true\n \n # Declare other goods that will be provided to each dataset at run time.\n provides :from => 'app/executables', :to => :each_dataset do\n file '<%= base_name %>.py', :chmod => 0755\n end\n \n provides :from => 'app/scripts', :to => :each_dataset do\n file 'prejob.py', :chmod => 0755\n file 'postjob.py', :chmod => 0755\n end\n \n provides :from => 'app/submits', :to => :each_dataset do\n file '<%= base_name %>.submit'\n end\n \n provides :from => 'lib/submits', :to => :each_dataset do\n file 'null.submit'\n end\n \n # You might also declare goods to be provided to the segment as a whole\n # provides :from => 'lib/submits', :to => :segment do\n # file 'null.submit'\n # end\n \n end\n \nend",
"def generate(save = false)\n # Code to export into the manifest cache\n export = \"Sereth::TemplateManager::Manifest.register(:raw)\"\n\n Dir.glob(\"app/template/raw/**\") do |file| \n template = Parser.read(file)\n template.raw = file\n\n if save\n # Store the parsed template to server throuch a controller\n template.cache = \"app/template/cache/#{template.name}\"\n File.open(template.cache) do |cached_template|\n cached_template.print(template.code)\n end\n\n # Store the template metadata for serving cached data in production\n File.open(\"app/template/manifest.rb\", \"w\") do |manifest| \n manifest.puts(export % {raw: template.metadata})\n end\n end\n end\n end",
"def generate_files\n ip = local_ip\n version = Farmstead::VERSION\n scaffold_path = \"#{File.dirname __FILE__}/scaffold\"\n scaffold = Dir.glob(\"#{scaffold_path}/**/*.erb\", File::FNM_DOTMATCH)\n scaffold.each do |file|\n basename = File.basename(file)\n folderstruct = file.match(\"#{scaffold_path}/(.*)\")[1]\n if basename != folderstruct\n foldername = File.dirname(folderstruct)\n create_recursive(\"#{@name}/#{foldername}\")\n end\n projectpath = \"#{@name}/#{folderstruct}\".chomp(\".erb\")\n template = File.read(file)\n results = ERB.new(template).result(binding)\n copy_to_directory(results, projectpath)\n end\n end",
"def process\n\t\t\t\tbegin\n\t\t\t\t\t@site_name = self.args.join\n\t\t\t\t\tFileUtils.mkdir @site_name\n\t\t\t\t\tFileUtils.cp_r Dir.glob(File.expand_path('../../../new_site', __FILE__) + '/*'), File.join(self.source, @site_name)\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"pages\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/images\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/videos\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/sounds\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"includes\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"plugins\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"extras\")\n\t\t\t\t\tdefault_page\n\n\t\t\t\t\tp \"#{@site_name} created.\"\n\t\t\t\trescue Exception => e\n\t\t\t\t\tp e\n\t\t\t\tend\n\t\t\tend",
"def rput( *args )\n opts = @default_options\n opts = opts.merge( args.pop ) if args.last.is_a?( Hash )\n opts = opts.merge( coalesce: false )\n\n flush\n\n srcs, target = expand_implied_target( args )\n\n srcs = resolve_sources( srcs, Array( opts[ :sync_paths ] ) )\n\n changes = []\n\n if opts[:erb_process] != false\n sdirs, sfiles = srcs.partition { |src| File.directory?( src ) }\n serbs, sfiles = sfiles.partition { |src| src =~ /\\.erb$/ }\n plains = sdirs + sfiles #might not have/is not templates\n maybes = sdirs + serbs #might have/is templates\n\n if maybes.empty?\n changes = rsync( plains, target, opts ) unless plains.empty?\n else\n if ssh_host_name == 'localhost' && opts[ :user ]\n # tmpdir needs to be visable to alt. opts[ :user ]\n opts[ :tmpdir_mode ] = 0755\n end\n process_templates( maybes, opts ) do |processed|\n unless processed.empty? || plains.empty?\n opts = opts.dup\n opts[ :excludes ] = Array( opts[ :excludes ] ) + [ '*.erb' ]\n end\n new_srcs = plains + processed\n changes = rsync( new_srcs, target, opts ) unless new_srcs.empty?\n end\n end\n else\n changes = rsync( srcs, target, opts ) unless srcs.empty?\n end\n\n changes\n end",
"def generate\n Dir.mkdir(@configuration_path)\n @configuration_template.check_nodes_names.and_then do\n create_links_to_ssh_keys\n end.and_then do\n generate_configuration_file\n end\n end",
"def regenerate_nginx_config_files()\n Djinn.log_debug(\"Regenerating nginx config files for App Engine apps\")\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n @apps_loaded.each { |app| \n http_port = @app_info_map[app]['nginx']\n https_port = @app_info_map[app]['nginx_https']\n proxy_port = @app_info_map[app]['haproxy']\n Djinn.log_debug(\"Regenerating nginx config for app #{app}, on http \" +\n \"port #{http_port}, https port #{https_port}, and haproxy port \" +\n \"#{proxy_port}.\")\n\n static_handlers = HelperFunctions.parse_static_data(app)\n Nginx.write_fullproxy_app_config(app, http_port, https_port,\n my_public, my_private, proxy_port, static_handlers, login_ip)\n }\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n end",
"def build_config\n return unless build?\n build_config_terraform\n end",
"def generate_configuration\n template \"mebla.yml\", \"config/mebla.yml\"\n end",
"def define(args, &task_block)\n desc \"Generate Swagger from AppMaps\" unless ::Rake.application.last_description\n\n task(name, *args) do |_, task_args|\n RakeFileUtils.__send__(:verbose, Rake.verbose == true) do\n task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block\n Command.new(:git_command).tap do |cmd|\n cmd.base = task_args[:base] || self.base\n cmd.swagger_file = task_args[:swagger_file] || self.swagger_file\n end.perform\n end\n end\n end",
"def generate(site)\n site.data['pages'].each do |page|\n if !page['external']\n require 'cgi'\n\n page['name'] = CGI.escapeHTML(page['name']) if page['name']\n site.pages << SitePage.new(site, site.source, page)\n\n zones = {}\n keys = %w[content preferences]\n\n if page['block_instances'].length\n # create zone buckets\n page['block_instances'].each do |i|\n # go through all content\n if site.config.event?\n keys.each do |key|\n i[key].each do |k, v|\n if v.is_a?(String) && v.match(/\\{\\{/)\n # maintain the {{ t.foo }} variables\n v.gsub!(/(\\{\\{\\s*t\\.[a-z_.]+\\s*\\}\\})/, '{% raw %}\\1{% endraw %}')\n i[key][k] = Liquid::Template.parse(v).render('event' => site.data['event'], 'mappable' => site.data['mappable'])\n end\n end\n end\n end\n zones[i['zone']] = [] if zones[i['zone']].nil?\n zones[i['zone']] << i\n end\n\n # sort each bucket by widget weight\n zones.each do |k, zone|\n zone.sort! { |x, y| x['weight'] <=> y['weight'] }\n end\n\n page_source_path = File.join(site.source, page['slug'])\n FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)\n\n json_filename = site.config.attendease['private_site'] ? 'index-private.json' : 'index.json'\n\n File.open(File.join(page_source_path, json_filename), 'w') do |f|\n f.write zones.to_json\n f.close\n end\n\n site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)\n end\n end\n end\n end",
"def add(*files)\n # due to the multi passing of splat args, we can get Array-in-Array situations here\n files.flatten.each do |fn|\n @files.push(fn)\n if ! File.exists?(fn)\n next if self.class.skipmissing\n raise ArgumentError, \"file #{fn} does not exist\"\n end\n begin\n data = YAML.load(File.open(fn))\n if ! data.instance_of?(Hash)\n raise ArgumentError, \"file #{fn} does not contain a Hash\"\n end\n @cfg.deep_merge!(data.deep_symbolize_keys).deep_symbolize_keys\n rescue\n if ! self.class.skipbad\n raise\n end\n end\n end\n\n # resolve templates\n if self.class.templates\n resolve_templates\n end\n end",
"def generate_configuration_info_files\n provider_file = Configuration.provider_path(@configuration_path)\n template_file = Configuration.template_path(@configuration_path)\n registry_path = Configuration.registry_path(@configuration_path)\n File.open(provider_file, 'w') { |f| f.write('dedicated') }\n File.open(template_file, 'w') { |f| f.write(File.expand_path(@env.template_file)) }\n @registry.save_registry(registry_path)\n SshUser.save_to_file(@ssh_users, @configuration_path)\n end",
"def setup_app_files\n cp HANAMI_TEMPLATES.join('config/hanami-vite.json'), config.config_path\n inject_line_after root.join('config/environment.rb'), 'environment :development do', ' middleware.use(ViteRuby::DevServerProxy, ssl_verify_none: true) if ViteRuby.run_proxy?'\n inject_line_after_last root.join('apps/web/application.rb'), 'include Web::Assets::Helpers', ' include ViteHanami::TagHelpers'\n inject_line_after root.join('apps/web/application.rb'), 'configure :development do', <<-CSP\n # Allow @vite/client to hot reload changes in development\n security.content_security_policy(\n security.content_security_policy\n .sub('script-src', \"script-src 'unsafe-eval'\")\n .sub('connect-src', \"connect-src ws://\\#{ ViteRuby.config.host_with_port }\")\n )\n CSP\n append root.join('Rakefile'), <<~RAKE\n require 'vite_hanami'\n ViteRuby.install_tasks\n RAKE\n end",
"def prepare_manifest_for(entries)\n deploy_manifest\n end",
"def generate_deploy_files\n template_name = (self.name == 'vagrant') ? 'vagrant' : \"environment\"\n # Generate capistrano specific steps recipes\n Bebox::PROVISION_STEPS.each do |step|\n generate_file_from_template(\"#{Bebox::FilesHelper.templates_path}/project/config/deploy/steps/#{step}.erb\", \"#{self.project_root}/config/environments/#{name}/steps/#{step}.rb\", {})\n end\n # Generate capistrano recipe for environment\n generate_file_from_template(\"#{Bebox::FilesHelper.templates_path}/project/config/deploy/#{template_name}.erb\", \"#{self.project_root}/config/environments/#{name}/deploy.rb\", {nodes: nil, environment: self.name})\n end",
"def sync_config\n return unless config.config_files\n upload_files(config.config_files, release_path.join('config'))\n end",
"def define\n desc \"Create Rails plug-in package\"\n task :rails_plugin do\n @dest = \"#@package_dir/#{@name}_#{@version}\"\n makedirs(@dest,:verbose=>false)\n @plugin_files.each do |fn|\n cp(fn, @dest,:verbose=>false)\n add_file(File.basename(fn))\n end\n\n @package_files.each do |fn|\n puts \". #{fn}\" if verbose\n f = File.join(@dest, fn)\n fdir = File.dirname(f)\n unless File.exist?(fdir)\n mkdir_p(fdir,:verbose=>false)\n add_folder(\"#{fdir}/\")\n end\n if File.directory?(fn)\n mkdir_p(f,:verbose=>false)\n add_folder(\"#{fn}/\")\n else\n cp(fn, f, :verbose=>false)\n add_file(fn)\n end\n end\n\n generate_index_files()\n end\n end",
"def new_spec_content\n content = JSON.parse(File.read(path = Utils.base + '.shoperb'))\n spec_content = {\n handle: content['handle'],\n compile: {\n stylesheets: ['application.css'],\n javascripts: ['application.js']\n }\n }.to_json\n Dir.mkdir 'config' unless File.exist?('config')\n File.open('config/spec.json', 'w') {|f| f.write(spec_content) }\n spec_content\n end"
] | [
"0.6089597",
"0.606924",
"0.5902413",
"0.5877497",
"0.571682",
"0.5593962",
"0.5571538",
"0.55506176",
"0.551628",
"0.5492206",
"0.5453311",
"0.54517996",
"0.5436677",
"0.5424625",
"0.5402557",
"0.53704333",
"0.53440094",
"0.53433233",
"0.5320235",
"0.5317486",
"0.5311866",
"0.5253393",
"0.5252948",
"0.52492124",
"0.52477217",
"0.5244232",
"0.52419025",
"0.5239012",
"0.5236961",
"0.5236317",
"0.5234188",
"0.52214533",
"0.519641",
"0.51890695",
"0.51887",
"0.5181947",
"0.5164584",
"0.5163504",
"0.5160259",
"0.51519567",
"0.5148963",
"0.51433766",
"0.5132181",
"0.5114513",
"0.51134217",
"0.50968933",
"0.5085161",
"0.5080444",
"0.507015",
"0.5065782",
"0.5064964",
"0.5064785",
"0.50400054",
"0.5036722",
"0.50342995",
"0.5033515",
"0.5033455",
"0.50178874",
"0.5016185",
"0.5015505",
"0.5001998",
"0.5000392",
"0.4991969",
"0.49899632",
"0.49830016",
"0.49814615",
"0.4965468",
"0.49586344",
"0.49571317",
"0.49555388",
"0.49544537",
"0.49533027",
"0.49508443",
"0.49485868",
"0.4944692",
"0.49410674",
"0.49398118",
"0.49381596",
"0.49362683",
"0.49362445",
"0.4934544",
"0.49325684",
"0.4931356",
"0.49307236",
"0.49267778",
"0.49265248",
"0.4913276",
"0.49110427",
"0.49072084",
"0.49067223",
"0.4903242",
"0.49019012",
"0.4901453",
"0.48996887",
"0.4897655",
"0.48930562",
"0.48930493",
"0.48840237",
"0.48797128",
"0.48796606"
] | 0.56860846 | 5 |
The list of attributes for this resource. | def resource_attributes
%w(
auth_users
comment
dont_compress
exclude
exclude_from
fake_super
gid
hosts_allow
hosts_deny
include
include_from
incoming_chmod
list
lock_file
log_file
log_format
max_connections
munge_symlinks
numeric_ids
outgoing_chmod
path
postxfer_exec
prexfer_exec
read_only
refuse_options
secrets_file
strict_modes
timeout
transfer_logging
uid
use_chroot
write_only
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes\n @list.map(&:attributes)\n end",
"def attributes\n @attributes ||= []\n @attributes\n end",
"def attributes\n @attributes ||= []\n end",
"def attributes\n ATTRIBUTE_NAMES\n end",
"def resource_attributes\n resource_class.attribute_names\n end",
"def list_attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes.keys\n end",
"def attributes\n @_attributes\n end",
"def attributes\n @attrs\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n ATTRIBUTES\n end",
"def attributes\n @_attributes\n end",
"def attributes\n @attrs.keys\n end",
"def attributes\n data[:attributes]\n end",
"def attributes\n load_attributes! unless attributes_loaded?\n @attributes.values\n end",
"def attributes\n @attributes ||= {}\n @attributes\n end",
"def attributes\n self.class::ATTRIBUTES\n end",
"def resource_attributes\n @resource_attributes ||= Marshal.load(Marshal.dump(self.class.resource_attributes))\n end",
"def attributes\n []\n end",
"def attributes\n @@attributes\n end",
"def list_of_attributes\n @list_of_attributes ||= []\n end",
"def resource_attributes\n self.class.attributes.names - [:options]\n end",
"def attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes\n end",
"def get_attributes\n\t\t\t@@attributes\n\t\tend",
"def attributes\n @attributes ||= descriptors_fields.select{|field| field.scope == ATTRIBUTE_FIELDS }\n end",
"def attrs\n @attrs\n end",
"def attributes\n @attributes ||= get_field_by_type(ATTRIBUTE_FIELDS)\n end",
"def attrs\n @attrs\n end",
"def attributes\n @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?\n @attributes\n end",
"def attributes\n @allowed_attributes\n end",
"def resource_non_human_attributes\n %w(id created_at updated_at)\n end",
"def attributes\n @attributes\n end",
"def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end",
"def attributes\n hash = HashWithIndifferentAccess.new\n\n self.class.attribute_names.each_with_object(hash) do |name, attrs|\n attrs[name] = read_attribute(name)\n end\n end",
"def attributes\n end",
"def attributes\n self._attributes.inject({}) do |hash, attr|\n hash[attr.to_s] = send(attr)\n hash\n end\n end",
"def attribute_list # :nodoc:\n [:id, :version, :uid, :user, :timestamp, :changeset]\n end",
"def attribute_list # :nodoc:\n [:id, :version, :uid, :user, :timestamp, :changeset, :tags]\n end",
"def resource_attributes\n %w(\n auth_users\n comment\n dont_compress\n exclude\n exclude_from\n fake_super\n gid\n hosts_allow\n hosts_deny\n include\n include_from\n list\n lock_file\n log_file\n log_format\n max_connections\n munge_symlinks\n numeric_ids\n path\n read_only\n refuse_options\n secrets_file\n strict_modes\n timeout\n transfer_logging\n uid\n use_chroot\n write_only\n )\n end",
"def list_attributes\n list = \"Age: #{@age} Earth years old\\nSize: #{@size}\\nVisitor Count: #{@visitor_count}\\nInhabitants: #{@inhabitants}\\n\"\n return list\n end",
"def attributes\n self.class.attribute_names.map do |name|\n [name.to_s, self.send(name)]\n end.to_h\n end",
"def attributes\n attributes = resource_class.list_attributes\n attributes &= params[:attributes].split(',') if params[:attributes]\n\n associations = resource_class.reflect_on_all_associations\n\n attributes.map do |attribute|\n next if attribute.blank?\n association = associations.detect { |association| association.foreign_key == attribute }\n\n # If attribute is an association and is not polymorphic, use the association\n # name instead of the foreign key.\n if association\n association.name unless association.options.include? :polymorphic\n else\n attribute\n end\n end.compact\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @context[:attributes]\n end",
"def attributes\n @attributes ||= Set.new\n end",
"def attributes\n self.class.class_variable_get(:@@attributes)\n end",
"def restricted_attributes\n if model.respond_to?(:restricted_alchemy_resource_attributes)\n model.restricted_alchemy_resource_attributes\n else\n []\n end\n end",
"def attributes\n @attribute_ids.collect { |idx| BAttribute.store[idx] }\n end",
"def attributes\n @attributes\n end",
"def attributes\n list.values.map { |field| [field.name, field.value] }.to_h\n end",
"def attributes\n {}.tap do |attributes|\n attribute_names.each do |key|\n attributes[key] = send(key)\n end\n end\n end",
"def attributes\n @data.keys\n end",
"def attributes # :nodoc:\n @attributes ||= {}\n end",
"def attribs\n\t\t@attributes\n\tend",
"def attributes(context = nil)\n context ||= Context.current\n context.value(CURRENT_ATTRIBUTES_HASH) || {}\n end",
"def attributes\n @attributes = @attributes || {}\n end",
"def attributes\n self.class.attributes\n end",
"def attributes\n ATTRIBUTES.inject({}) do |hash, attribute|\n hash[attribute] = self.send(attribute)\n hash\n end\n end",
"def attributes\n ATTRIBUTES.inject({}) do |hash, attribute|\n hash[attribute] = self.send(attribute)\n hash\n end\n end",
"def attributes\n instance_values\n end",
"def object_attributes\n []\n end",
"def attribute_list\n [:id, :version, :uid, :user, :timestamp, :lon, :lat, :changeset]\n end",
"def attributes\n @metadata\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def to_rest\n return attributes\n end",
"def attributes\n properties.map do |p|\n [p.name, send(p.getter)] if p.reader_visibility == :public\n end.compact.to_hash\n end",
"def attributes\n self\n .class\n .attribute_names\n .map { |attr| [attr, send(attr)] }\n .reject { |_, value| value.nil? }\n .map do |attr, value|\n [attr, value.respond_to?(:attributes) ? value.attributes : value]\n end\n .to_h\n end",
"def model_attributes\n resource_class.attribute_names.map(&:to_sym) - [:created_at, :updated_at]\n end",
"def attributes\n attrs = sort_members(@context.attributes).find_all{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n attrs.collect{|a| {:name=>a.name, :visibility=>a.visibility, :rw=>a.rw, :description=>markup(a.comment, true)}}\n end",
"def attributes\n self.class.attribute_names.map do |attr|\n type = self.class.attribute_types[attr.to_s]\n value = public_send(attr)\n [attr, type ? type.serialize(value) : value]\n end.to_h\n end",
"def attributes\n if self.class_variable_defined?(:@@attributes)\n class_variable_get(:@@attributes)\n else\n class_variable_set(:@@attributes, [])\n class_variable_get(:@@attributes)\n end\n end",
"def attributes\n unless(@attributes)\n @attributes = Hash.new()\n self.properties_.each do |property|\n @attributes[property.name] = property.value\n end\n end\n @attributes\n end",
"def eav_attributes_list # :nodoc:\n (\n self.instance_eav_attributes + self.class_eav_attributes.keys\n ).collect { |attribute| attribute.to_s }.uniq\n end",
"def attributes\n unless @attributes\n @attributes = node.attributes.collect do |att|\n visitor(AttributeVisitor) { |v| v.visit(att) }\n end\n end\n @attributes\n end",
"def display_attributes\n self.class.display_attribute_names.map do |name|\n [name.to_s, self.send(name)]\n end.to_h\n end",
"def attributes\n @attributes ||= @internal_struct[:attributes]\n end",
"def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end",
"def attr_strings\n @attr_strings\n end",
"def attributes; @attributes ||= []; end",
"def attributes(*attrs)\n if attrs.size > 0\n attrs.each{|attr| attribute attr}\n end\n @attributes ||= []\n end",
"def attributes\n self.class.config.full_config.map { |attribute| [attribute, send(attribute)] }.to_h\n end",
"def attributes\n {\n title: title,\n language: language,\n date_created: display_date,\n created: normalized_date,\n extent: extent,\n container: container,\n heldBy: location_code,\n creator: collection_creators,\n publisher: collection_creators,\n memberOf: collections\n }\n end",
"def values\n @attrs.values\n end",
"def state_attrs\n @resource.class.state_attrs.map(&:to_sym)\n end",
"def attributes\n @attributes ||= sort.reverse.inject({}) do |final, (_, changeset)|\n changeset.merge(final)\n end\n end",
"def attributes\n @attributes ||= {}.freeze\n end",
"def attrs\n @item_data ||= @active_domain.nil? ? EMPTY_ITEM_DATA : get_items(@query)\n @item_data[:attrs]\n end",
"def attr_list\n\t\ta_list \n\tend",
"def properties\n resource_attributes.keys - [:new_record]\n end",
"def attributes\n @cache[:attributes]\n end",
"def hash\n @attrs\n end",
"def attributes= attributes\n attributes.except('id', :id).map do |key_value|\n __send__ \"#{key_value.first}=\", key_value.last\n end\n\n self.attributes\n end",
"def attributes\n end"
] | [
"0.7989403",
"0.788354",
"0.7675028",
"0.7657532",
"0.7603037",
"0.75566626",
"0.7534158",
"0.75312907",
"0.7497598",
"0.7497598",
"0.7497598",
"0.7493286",
"0.74056476",
"0.73006874",
"0.72975993",
"0.7279237",
"0.7216928",
"0.7211664",
"0.7211239",
"0.7186131",
"0.7169184",
"0.7166857",
"0.71170354",
"0.711052",
"0.7106275",
"0.7075102",
"0.7065435",
"0.7065332",
"0.70253015",
"0.70199805",
"0.70095325",
"0.69945896",
"0.69759727",
"0.6972482",
"0.69697624",
"0.6963695",
"0.69627655",
"0.6943259",
"0.6923755",
"0.69061995",
"0.68661016",
"0.6859171",
"0.68580085",
"0.6857155",
"0.6857155",
"0.6857155",
"0.68211883",
"0.6818162",
"0.68073314",
"0.68050015",
"0.6800125",
"0.6796658",
"0.6751952",
"0.67336565",
"0.673309",
"0.67192054",
"0.6703952",
"0.6700603",
"0.665978",
"0.6655683",
"0.6654978",
"0.6654978",
"0.66478854",
"0.6644952",
"0.6644824",
"0.6632284",
"0.662719",
"0.662719",
"0.662719",
"0.662719",
"0.662719",
"0.662719",
"0.6626889",
"0.66242677",
"0.6617083",
"0.66137993",
"0.66067255",
"0.66036755",
"0.66021323",
"0.65875614",
"0.65717727",
"0.6567359",
"0.6561163",
"0.65569246",
"0.6554157",
"0.6551023",
"0.65499157",
"0.65497416",
"0.6548575",
"0.65218306",
"0.65157855",
"0.6509292",
"0.6494596",
"0.6491792",
"0.646917",
"0.64689195",
"0.64589936",
"0.6441696",
"0.64310867",
"0.6430095",
"0.6428899"
] | 0.0 | -1 |
The list of rsync server resources in the resource collection | def rsync_resources
::ObjectSpace.each_object(::Chef::Resource).select do |resource|
resource.resource_name == :rsync_serve
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsync_resources\n run_context.resource_collection.select do |resource|\n resource.is_a?(Chef::Resource::RsyncServe)\n end\n end",
"def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend",
"def resources\n @resources ||= []\n end",
"def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end",
"def resource_list\n self.resources\n end",
"def servers\n servers_for\n end",
"def servers\n @servers.keys\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def servers\n sync{@servers.keys}\n end",
"def get_servers\n\t\t\tbegin\n\t\t\t\tresp = @rs_conn.get('/servers')\n\n\t\t\t\t# 200 Success :: anything else is failure\n\t\t\t\tunless resp.code == \"200\"\n\t\t\t\t\traise \"Error requesting server list. Error code #{resp.code}\"\n\t\t\t\tend\n\t\t\t\t# Convert the output to json\n\t\t\t\tserver_list = JSON.parse(resp.body)\n\t\t\t\treturn server_list\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend",
"def servers\r\n @servers.values\r\n end",
"def servers\n @_servers ||= []\n end",
"def servers\n @_servers ||= []\n end",
"def resources\n @resources.values\n end",
"def servers\n configuration.servers\n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def resource_collection\n client.run_status.run_context.resource_collection\n end",
"def servers\n servers_by_name.values\n end",
"def servers\n list = []\n Penctl.execute(@pen, \"servers\", 5).each do |l| \n server = Penctl.parse_server_line(l)\n list[server[:slot]] = server\n end\n list.compact\n end",
"def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def servers\n @servers ||= execute_remote!(command(:servers)).each_line.map { |line| JSON.parse line }\n end",
"def resources\n @data.keys\n end",
"def all_servers\n if @all_servers_cache.nil?\n @all_servers_cache=[]\n CLOUD_NAME.keys.each do |name|\n read(\"servers/#{name.to_s.upcase}\")[:data].each do |i|\n @all_servers_cache.push(i)\n end\n end\n end\n return @all_servers_cache\n end",
"def linked_resources\n return @linked_resources\n end",
"def resources\n @resources\n end",
"def servers\n result = Gorillib::ModelCollection.new(item_type: Ironfan::Dsl::Server, key_method: :full_name)\n facets.each{ |f| f.servers.each{ |s| result << s } }\n result\n end",
"def resources\n @resources ||= {}\n end",
"def resources\n @task[:resources]\n end",
"def resources\n Loader.resources.keys\n end",
"def servergroups\n return @resource[:servergroups] unless @resource[:runasdomain]\n return @servergroups unless @servergroups.nil?\n state = execute(\"deployment-info --name=#{@resource[:name]}\")\n return [] unless state.success?\n @servergroups = read_groups_from_output(state.output)\n end",
"def servers\n Vultr::Resource::Server.new(@faraday)\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def rsync_modules\n rsync_resources.reduce({}) do |hash, resource|\n if resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][snake_to_space(key)] = value\n end\n end\n\n hash\n end\n end",
"def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end",
"def available_servers\n authenticate_user!\n @rackspace_servers = Server.rackspace_servers\n end",
"def vservers\n @vservers=get_endpoint('vservers').keys\n end",
"def all_server_hosts\n [server_host]\n end",
"def servers\n gateway_check\n @servers\n end",
"def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end",
"def resource_requests\n return @resource_requests\n end",
"def resource_groups\n refs = references(:resource_groups)\n\n return [] if refs.blank?\n\n refs = refs.map { |x| File.basename(x) }.uniq\n\n @resource_groups ||= if refs.size > record_limit\n set = Set.new(refs)\n collect_inventory(:resource_groups) { @rgs.list(:all => true) }.select do |resource_group|\n set.include?(File.basename(resource_group.id.downcase))\n end\n else\n collect_inventory_targeted(:resource_groups) do\n filter_my_region_parallel_map(refs) do |ref|\n safe_targeted_request { @rgs.get(ref) }\n end\n end\n end\n rescue ::Azure::Armrest::Exception => err\n _log.error(\"Error Class=#{err.class.name}, Message=#{err.message}\")\n []\n end",
"def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end",
"def servers\n server_structs.map do |server|\n inspect_server(server)\n end\n end",
"def servers\n return self.bare_metal_servers + self.virtual_servers\n end",
"def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\n end",
"def index\n @rundockerservers = Rundockerserver.all\n end",
"def servers\n @servers.select { |server| server.operable? }\n end",
"def resource_groups\n @client.resource_groups.list\n end",
"def services\n services = RingyDingy::RingServer.list_services\n return [] if services.empty?\n\n services = RingyDingy::RingServer.list_services.values.first.uniq\n\n rrc_servers = services.select do |_, klass,|\n klass == RailsRemoteControl::Server::RINGY_DINGY_SERVICE\n end\n\n rrc_servers.map do |_, _, server, name|\n host, pid, = name.split '_', 3\n Server.new host, pid.to_i, server\n end\n end",
"def resources\n @resources ||= Marshal.load(Marshal.dump(@@resources))\n end",
"def servers # Only in Ruby API (1.3 compatible)\n\t\t@settings.servers\n\tend",
"def getRegionServers\n @admin.getClusterMetrics.getLiveServerMetrics.keySet.map { |server_name| server_name }\n end",
"def servers\n endpoint.config.nodes.map(&:to_s)\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end",
"def list_known_servers\n connect.servers.all\n end",
"def list\n display \"Available rsync backup profiles:\"\n\n profiles = _profiles\n\n if profiles.blank?\n return []\n end\n\n profiles.each do |profile|\n display profile['name']\n end\n\n return profiles\n end",
"def resource_collection\n @resource_collection ||= @run_context.resource_collection\n end",
"def listNodes\n nodes = []\n me = MU::Cloud::AWS::ServerPool.find(cloud_id: cloud_id).values.first\n if me and me.instances\n me.instances.each { |instance|\n found = MU::MommaCat.findStray(\"AWS\", \"server\", cloud_id: instance.instance_id, region: @region, dummy_ok: true)\n nodes.concat(found)\n }\n end\n nodes\n end",
"def servers\n @config['servers'].map { |server| server.split(/:/) }\n end",
"def name_servers\n Array(@gapi.name_servers)\n end",
"def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def collection\n resource_class.all\n end",
"def rsync_modules\n rsync_resources.each_with_object({}) do |resource, hash|\n next unless resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][attribute_to_directive(key)] = value\n end\n end\nend",
"def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end",
"def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end",
"def index\n @servers = Server.all\n end",
"def index\n @servers = Server.all\n end",
"def index\n @servers = Server.all\n end",
"def index\n @servers = Server.all\n end",
"def index\n @servers = Server.all\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end",
"def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end",
"def index\n @servers = @site.servers\n end",
"def index\r\n @servers = Server.all\r\n end",
"def resources\n @resources ||= @internal_struct[:resources] || {}\n end",
"def storage_servers\n self.client.get('gh.storage.servers').split(',')\n end",
"def update \n items = changed_since(last_run)\n resources = []\n items.each do |item|\n resource = construct_resource(item)\n resource.populate\n resources << resource\n end\n return resources\n end",
"def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def getAllServers(targethost = Model::TARGETHOST)\n if @@serverList.nil?\n @@serverList = ZMProv.new('-l', 'gas', targethost).run[1].split(/\\n/)\n end\n \n @@serverList\n end",
"def index\n @upload_file_to_servers = UploadFileToServer.all\n end",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def name_servers\n response = @client.rest_get(@data['uri'] + '/nameServers')\n response.body\n end",
"def resources\n Typus::Configuration.roles.keys.map do |key|\n Typus::Configuration.roles[key].keys\n end.flatten.sort.uniq.delete_if { |x| models.include?(x) }\n end",
"def list_resource_tpl\n @resource_tpl\n end",
"def servers\n response = self.class.get(\"/#{self.class.account}/clients.xml\")\n response['clients'].map { |client| ScoutScout::Server.new(client) }\n end",
"def list\n Dir.glob(\"#{App.config.resource_directory}/*.yaml\").each do |res|\n puts File.basename(res, '.yaml')\n end\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def servers\n gateway_check\n unavailable_servers_check\n @servers\n end",
"def updated_resources\n @updated_resources ||= action_collection&.filtered_collection(max_nesting: 0, up_to_date: false, skipped: false, unprocessed: false) || {}\n end",
"def list klass, names, options, check_remote = false, &block\n ResourceInfo.list klass, self, names, options, check_remote, &block\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end"
] | [
"0.8124576",
"0.6612449",
"0.65967375",
"0.6571224",
"0.6555147",
"0.6550174",
"0.64710927",
"0.63614774",
"0.63614774",
"0.63614774",
"0.63580257",
"0.63524985",
"0.6347986",
"0.63440347",
"0.63440347",
"0.63204473",
"0.6296061",
"0.6217164",
"0.61819506",
"0.6160323",
"0.6149881",
"0.6130412",
"0.6124275",
"0.6118348",
"0.60902774",
"0.608203",
"0.6073685",
"0.60499644",
"0.60388213",
"0.6038524",
"0.60107344",
"0.6009514",
"0.5991485",
"0.5986403",
"0.59830314",
"0.5979624",
"0.5966626",
"0.5946889",
"0.5917592",
"0.5913772",
"0.5907621",
"0.5901978",
"0.58847284",
"0.5878211",
"0.58743584",
"0.5860275",
"0.58598506",
"0.58565634",
"0.583814",
"0.5837899",
"0.5828945",
"0.5811544",
"0.5803173",
"0.57851666",
"0.5771386",
"0.57645607",
"0.57619333",
"0.57619333",
"0.57570255",
"0.57521826",
"0.57500046",
"0.57455367",
"0.57435274",
"0.5736999",
"0.57241035",
"0.5691716",
"0.5670557",
"0.56591946",
"0.56478584",
"0.5646901",
"0.5637669",
"0.5637669",
"0.5637669",
"0.5637669",
"0.5637669",
"0.56322926",
"0.5631652",
"0.56283385",
"0.56268036",
"0.56259257",
"0.561945",
"0.56169814",
"0.56169724",
"0.56086355",
"0.5605667",
"0.5600949",
"0.55993557",
"0.55987984",
"0.559114",
"0.55877906",
"0.55788076",
"0.55752873",
"0.55730987",
"0.5566232",
"0.5546438",
"0.553415",
"0.55339116",
"0.55283815",
"0.5528158",
"0.55277634"
] | 0.7518149 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.