query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Iterates over every element in the collection and calls the block with an instance obtained calling the factory method. The factory method should be implemented by subclasses of PoolCollection
|
def each(&block)
@data.each { |pelem|
block.call self.factory(@session, pelem)
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each(&block)\n @wrapped_collection.each { |member| block.call(@klass.new(member, @context)) }\n end",
"def each_pool\n return enum_for(__method__) unless block_given?\n @pool.each { |_, pool| yield pool }\n end",
"def each(&block)\n if block_given?\n ForkJoinPool.new.invoke(Iterator.new(objects, threshold, block))\n else\n objects.each\n end\n end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each(&block)\n Fetcher.new(self).each(&block)\n end",
"def each(&block)\n @collection.each do |collectable|\n if block_given?\n block.call collectable\n else \n yield collectable\n end\n end \n end",
"def each_container(&block)\n collection.each_value(&block)\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def each\n @collection.each { |c| yield c }\n end",
"def each_with_index &block\n latch = CountDownLatch.new(size)\n __getobj__.each_with_index {|x, index|\n @@pool << -> {\n begin\n block.call(x, index)\n rescue\n $!.print_stack_trace\n ensure\n latch.count_down\n end\n }\n }\n latch.wait\n self\n end",
"def parallel_each(pool: nil, &block)\n return self unless block_given?\n\n parallel_map(pool: pool, &block)\n\n self\n end",
"def each(&block)\n @items.each(&block)\n self\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end",
"def collect\n nha = self.class.new\n (0...self.length).each { |i| nha << yield(self.fetch(i)) }\n nha\n end",
"def instantiate_collection(collection)\n collection.collect! { |record| instantiate_record(record) }\n end",
"def each(&block)\n @grouped_collection.each { |gc| block.call(gc) }\n end",
"def each_spawner(&block)\r\n @spawners.each(&block)\r\n end",
"def collect!\n block_given? or return enum_for(__method__)\n set = self.class.new\n each { |o| set << yield(o) }\n replace(set)\n end",
"def each(&block)\n end",
"def each(&block)\n raise Error::UnsupportedOperation, \"Method GeometryCollection#each not defined.\"\n end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def with_collection_lock\n @lock.synchronize do\n return yield\n end\n end",
"def each &block\n end",
"def run_pool(&block)\n (1..workers).map { Thread.new(&block) }.each(&:join)\n end",
"def each(&block)\n\n end",
"def each(&block)\n @_componentable_container.each(&block)\n end",
"def get\n if @pool.empty?\n b = @klass.new(*@args)\n b.instance_exec(self) { |origin| @_origin = origin }\n b\n else\n @pool.pop\n end\n end",
"def return_pool(**name_args, &block) # yields:\n @object_pool.put(self, **name_args, &block)\n nil\n end",
"def each\n yield self\n end",
"def each(&block)\nend",
"def pool; end",
"def pool; end",
"def each(&block) # block into proc\n\nend",
"def pool\n @pool.dup\n end",
"def collect!\n block_given? or return enum_for(__method__) { size }\n set = self.class.new\n each { |o| set << yield(o) }\n replace(set)\n end",
"def each(&a_proc); end",
"def each\n # passes block - if any - to upstream each.\n to_a.each(&Proc.new)\n end",
"def each(collection)\n\ti = collection.count\n\twhile i > 0\n\t\tyield collection\n\t\ti -= 1\n\tend\nend",
"def each\n return enum_for(:each) unless block_given?\n results.each(&Proc.new)\n self\n end",
"def each(&block)\n call_client(:each, &block)\n end",
"def each(&block)\n find_each(&block)\n end",
"def caching(&block)\n if defined? @collection\n @collection.each(&block)\n else\n @collection = []\n execute.each do |doc|\n @collection << doc\n yield doc if block_given?\n end\n end\n end",
"def each(&block)\n items.each &block\n end",
"def each(&block)\n items.each &block\n end",
"def each(&block)\n @data.each do |attrs|\n yield @resource_class.new(attrs)\n end\n end",
"def each (&block)\n\n @items.each { |i| block.call(i) }\n end",
"def each(&block)\n @items.each(&block)\n end",
"def clone_pool\n super\n end",
"def each\n return enum_for(:each) unless block_given?\n\n @data.collection.each { |item| yield item }\n end",
"def each\n @source.each do |elem|\n yield DropDelegation.wrap_element(elem)\n end\n end",
"def all\n @pool\n end",
"def each\n @node_set.each do |c|\n yield NodeProxy.new(c, parent)\n end\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def collection_method name, &block\n collection_methods[name] = block\n end",
"def find_every(opts, &block)\n collection = []\n\n all_ids(opts) do |partial_ids, data, partial_opts|\n partial_items = partial_ids.map do |id|\n find_single(id, opts, false)\n end\n\n if block_given?\n yield(instantiate_collection( partial_items ), data, opts)\n end\n\n collection.concat partial_items\n end\n\n instantiate_collection( collection )\n end",
"def each\n @node_set.each do |c|\n yield NodeProxy.new(c, parent)\n end\n end",
"def each(&block)\n\n all.each { |wi| block.call(wi) }\n end",
"def each(&block)\n to_a.each(&block)\n end",
"def each(&block)\n get unless loaded\n self.objects.first[1].each(&block) rescue nil\n end",
"def make_collection\n raise NotImplementedError\n end",
"def add_each(collection, &block)\n raise ArgumentError, \"Code block expected\" if not block\n\n collection.each do |v|\n self << yield(v)\n end\n\n # This is IMPORTANT.\n self\n end",
"def each\n if block_given?\n (0...Count()).each { |i| yield self[i] }\n else\n (0...Count()).map { |i| self[i] }\n end\n end",
"def populate klass, n = klass::COUNT\n n.times.map {\n o = klass.new self\n yield o if block_given?\n o }\n end",
"def each_host(&block)\n hosts.each do |host|\n host.instance_exec &block\n end\n end",
"def each(&block)\n @items.each do |item|\n block.call(item)\n end\n end",
"def pool \n @pool\n end",
"def each(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :each ) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n block.call(self.__at(i))\n i += 1\n end\n self\n end",
"def each(&block)\n @all.each(&block)\n end",
"def each\n raise 'Not implemented'\n end",
"def each\n collection.each do |profile|\n yield(profile)\n end\n end",
"def each(&block)\n @size.times { |position| yield self.get(position) }\n end",
"def collection\n @collection.is_a?(Proc) ? @collection.call : @collection\n end",
"def each( & block )\n \n return atomic_cursor.each( & block )\n\n end",
"def each_raw\n iterator.each { |i| yield i }\n end",
"def initialize_pools(members)\n members.each do |member|\n @hosts << member.host_string\n\n if member.primary?\n @primary = member.host_port\n @primary_pool = Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n elsif member.secondary? && [email protected]?(member.host_port)\n @secondaries << member.host_port\n @secondary_pools << Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n end\n end\n\n @max_bson_size = members.first.config['maxBsonObjectSize'] ||\n Mongo::DEFAULT_MAX_BSON_SIZE\n @arbiters = members.first.arbiters\n choose_read_pool\n end",
"def each\r\n @many = true\r\n yield(self)\r\n end",
"def pool\n @pool\n end",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def find(*args)\n Collection.new(super, @mapped_collection)\n end",
"def new_block_el(*args); end",
"def define(name, options={}, &block)\n collection = options.delete(:collection)\n\n if collection\n collection.each do |object|\n define(call_with_params(name, object, options), options, &block)\n end\n else\n self.define_block_container(name, options, &block)\n end\n\n nil\n end",
"def each(&block)\n all.each(&block)\n end",
"def each(&block)\n return to_enum(:each) unless block_given?\n size.times.each { |i| yield @elements[i] }\n self\n end",
"def thread_collect\n collection = Array.new\n thread_each do |e|\n collection << yield(e)\n end\n collection\n end",
"def each(&block)\n @animals.each(&block)\n end",
"def each\n @items.each {|x| yield x}\n end",
"def populate &block\n instance_eval(&block)\n self\n end",
"def each &block # :yields: content, options\n self.class.resources_creator.call(content, options).each &block \n end",
"def each(&block)\n\t\twhile (ip = next_ip)\n\t\t\tblock.call(ip)\n\t\tend\n\tend",
"def execute_pool\n raise NotImplementedError\n end"
] |
[
"0.73428434",
"0.7074579",
"0.67370886",
"0.6692379",
"0.66373587",
"0.663381",
"0.65542465",
"0.6484912",
"0.64779305",
"0.63322324",
"0.6305246",
"0.6257942",
"0.6254976",
"0.6187783",
"0.60987717",
"0.6021459",
"0.6021459",
"0.596405",
"0.5951903",
"0.5940854",
"0.5940416",
"0.59095013",
"0.5905441",
"0.5860806",
"0.5855331",
"0.5855331",
"0.5855331",
"0.5855331",
"0.5855331",
"0.5855331",
"0.5853039",
"0.58331066",
"0.58300936",
"0.58225495",
"0.57932377",
"0.5783523",
"0.57767504",
"0.5750272",
"0.5744375",
"0.5733475",
"0.5733475",
"0.57273906",
"0.57217085",
"0.57186294",
"0.57170403",
"0.56870914",
"0.56865025",
"0.56780493",
"0.5676535",
"0.5663657",
"0.56554204",
"0.56446487",
"0.56446487",
"0.56403124",
"0.56213665",
"0.561824",
"0.5614992",
"0.55959576",
"0.5579541",
"0.55768627",
"0.55715233",
"0.5568941",
"0.5568941",
"0.5567382",
"0.5563124",
"0.555539",
"0.554497",
"0.55356354",
"0.55260277",
"0.55160975",
"0.5514199",
"0.55025995",
"0.5502367",
"0.5491614",
"0.54852796",
"0.5483282",
"0.5467362",
"0.5462543",
"0.5459241",
"0.5458574",
"0.5457131",
"0.54521465",
"0.5450477",
"0.544906",
"0.54489315",
"0.5438603",
"0.5437916",
"0.5437912",
"0.5423801",
"0.54225796",
"0.54090214",
"0.54082674",
"0.5408234",
"0.54051113",
"0.54029626",
"0.5398657",
"0.53966695",
"0.53912455",
"0.5382365",
"0.53811276"
] |
0.60807675
|
15
|
Return the instance obtained calling the factory method of the element in the given index. The factory method should be implemented by subclasses of PoolCollection
|
def [](index)
# TODO Handle exception if the index is out of bound
self.factory(@session, @data[index])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def [](idx)\n self.class.new super\n end",
"def from_index(index)\n self.class.from_index(index)\n end",
"def get_index(index)\n return self.at(index)\n end",
"def [](index)\n @model_class.send(:instantiate, @cursor[index].to_ar_hash)\n end",
"def [](idx)\r\n to_a[idx] || element_class.new(@parent, :index => idx)\r\n end",
"def [](index)\n cast get(index)\n end",
"def get_at_index(index)\n raise NotImplementedError, \"Please implement get_at_index\"\n end",
"def [](index)\n @model_class.new(@cursor[index])\n end",
"def element\n @collection[index]\n end",
"def [](index)\n return get(index)\n end",
"def [](index)\n self.class.new (data[index] or return) # TODO: create RadioButton.\n end",
"def [](index)\n get_subcomposite(index)\n end",
"def [](index)\n get(index)\n end",
"def get_item(index)\n # TODO\n end",
"def [](index)\n return @items[index]\n end",
"def [](index)\n return nil if index >= @size || index < 0\n rod_id = id_for(index)\n if rod_id.is_a?(Model)\n rod_id\n elsif rod_id == 0\n nil\n else\n class_for(index).find_by_rod_id(rod_id)\n end\n end",
"def *(index)\n self.class.new(\"#{@name}[]\", \"#{@id}:#{'%03d' % index}\")\n end",
"def [](index)\n self.__getitem__ index\n end",
"def at(index)\n self[index]\n end",
"def [](index)\n if index.is_a?(Range)\n self.class.new(@list[index], type: @type, api_client: @api_client)\n else\n @list[index]\n end\n end",
"def [](index = nil)\n to_alloc[index]\n end",
"def item(index)\n c = @children[index]\n yield c if block_given?\n return c\n end",
"def [](index)\n demand super(index)\n end",
"def get_item(index)\r\n @list[index]\r\n end",
"def [](index)\r\n @internal_list[index]\r\n end",
"def [](index)\n @items[index]\n end",
"def [](index)\n @items[index]\n end",
"def identity\n self.class.new(size)\n end",
"def at(index)\n return GameStopOrderedItemPanel.new(@tag.at(index), @browser)\n end",
"def [](index)\n @list[index]\n end",
"def [](idx)\n send(idx)\n end",
"def item(index = self.index)\n return @data[index]\n end",
"def new()\n trace(\"Instance #{index} created\")\n index += 1\n end",
"def [](index)\n i = 0\n each { |x| return x if i == index; i += 1 }\n nil # out of index\n end",
"def item(index = self.index)\n @data[index]\n end",
"def get(index)\n raise \"Only positive indexes, #{index}\" if index <= 0\n if index > self.get_length\n return nil\n else\n return internal_object_get(index + 1)\n end\n end",
"def at(index)\n return GameStopGiftCardsPanel.new(@tag.at(index), @spec)\n end",
"def create_instance\n create_instances(1).first\n end",
"def [](idx)\n items[idx]\n end",
"def at(index)\n $tracer.trace(format_method(__method__))\n return GameStopProductContainerItem.new(@tag[index])\n end",
"def get_item(index_num)\r\n @arr.fetch(index_num)\r\n end",
"def [](index)\n get_node(index).element\n end",
"def at_index(index)\n find_by_index(index)\n current\n end",
"def factory(element_xml)\n OpenNebula::PoolElement.new(element_xml,client)\n end",
"def get_item(index_number)\n @chores[index_number]\n end",
"def at(index)\n return GameStopDiscountPanel.new(@tag.at(index), @browser)\n end",
"def [](index)\n lookup(index.to_sym)\n end",
"def [](index)\n return @elements[index] if index.kind_of? Numeric\n return @element_map[index] if @element_map[index] \n return @element_map[index.to_s] \n end",
"def get\n if @pool.empty?\n b = @klass.new(*@args)\n b.instance_exec(self) { |origin| @_origin = origin }\n b\n else\n @pool.pop\n end\n end",
"def [](index)\n @index[index]\n end",
"def [](*index)\n if index[0].kind_of?(Array)\n index = index[0]\n end\n return @delegate[index]\n end",
"def [](index)\n case index\n when Integer\n @lock.synchronize do\n @instance_cache ||= []\n @instance_cache[index] ||= new(\"eth#{index}\", false)\n end\n when nil\n self[next_available_index]\n when /^(?:eth)?([0-9]+)$/\n self[$1.to_i]\n when /^eni-/\n find { |dev| dev.interface_id == index }\n when /^[0-9a-f:]+$/i\n find { |dev| dev.hwaddr.casecmp(index) == 0 }\n when /^[0-9\\.]+$/\n find { |dev| dev.has_ip?(index) }\n end.tap do |dev|\n raise Errors::UnknownInterface, \"No interface found matching #{index}\" unless dev\n end\n end",
"def index_new\n Index.new(self)\n end",
"def [](index); end",
"def initialize collection, index\n @collection = collection\n @index = index\n end",
"def [](index)\n execute\n return @result[index]\n end",
"def [](index)\n self.grid[index]\n end",
"def [](index)\n @puzzle[index]\n end",
"def get(index)\n \n end",
"def get(index)\n current = get_next\n index.times { current = get_next(current) }\n current\n end",
"def [](index)\n all[index]\n end",
"def [](indx)\n elements[indx]\n end",
"def [] index\r\n @list[index]\r\n end",
"def index_item\n if @resources.last && @resources.last.is_a?(ActiveRecord::Base)\n index_resources = @resources.dup\n index_resources << index_resources.pop.class\n Item.new index_resources\n end\n end",
"def [](index)\n end",
"def [](index)\n end",
"def [](idx)\n list_items[idx]\n end",
"def [](index)\n Array.new([index])\n end",
"def item; @data[self.index]; end",
"def at(index)\n return nil if @head.nil? \n return @head if index == 1\n return nil if index > self.size\n self.each_with_index do |current, ind|\n return current if ind == index\n end\n\n end",
"def [](*args, **kwargs)\n new(*args, **kwargs)\n end",
"def at(index)\n return GameStopProductListItem.new(@tag.at(index), @spec)\n end",
"def index\n Index.new(self)\n end",
"def [](index) # i.e. array style index lookup.\n end",
"def find_model_from_index(index)\n @items_to_models[\n item_from_index(index)]\n end",
"def at(index)\n return GameStopAOWPlans.new(@tag.at(index), @spec)\n end",
"def [](index_name)\n Index.new(index_name, self)\n end",
"def [](index)\n @items[index - 1]\n end",
"def [](index)\n @items[index - 1]\n end",
"def [](index)\r\n @library[index]\r\n end",
"def [](index)\n self.fetch[index]\n end",
"def at(index)\n return GameStopHandlingPagePanel.new(@tag.at(index), @spec)\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def []( index )\n reg = to_reg()\n reg[index]\n end",
"def get_item(index)\n @get_items[index]\n end",
"def initialize(index)\n @index = index\n end",
"def [](index); @models[index]; end",
"def create_block_index( index_name, \n permits_duplicates, \n sort_by_proc = nil, \n sort_duplicates_by_proc = nil, \n & indexing_block )\n \n ensure_index_does_not_exist( index_name, permits_duplicates )\n \n index_instance = ::Persistence::Object::Index::BlockIndex.new( index_name, \n instance_persistence_bucket, \n permits_duplicates,\n sort_by_proc, \n sort_duplicates_by_proc,\n & indexing_block )\n\n indexes[ index_name ] = block_indexes[ index_name ] = index_instance\n\n return index_instance\n\n end",
"def at(index)\n return GameStopShippingAddressPanel.new(@panels[index], @spec)\n end",
"def another\n self.class.new(nil, cached? ? [] : io_index.another)\n end",
"def item(index)\n each_with_index { |item, ix| return item if index == ix } && nil\n end",
"def [](i)\n get unless loaded\n self.objects.first[1][i] rescue nil\n end",
"def [](idx)\n return nil if idx >= @size\n while idx >= @so_far.size\n @so_far << generate_next\n end\n @so_far[idx]\n end",
"def at(index)\n @index = index\n self\n end",
"def one\n attributes = klass.collection.find_one(selector, process_options)\n attributes ? Mongoid::Factory.from_db(klass, attributes) : nil\n end",
"def from_index\n Indexer.index[probably_unique_id]\n end",
"def [](i)\n @elements[i]\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n cLabel = CLabel.new(self, rect, item.name)\n \n return cLabel\n end",
"def element_by_xpath(xpath)\r\n temp = Element.new(nil, self)\r\n element_name = temp.element_by_xpath(self, xpath)\r\n return element_factory(element_name)\r\n end",
"def [](index)\n entries[index]\n end"
] |
[
"0.6808642",
"0.6578473",
"0.6386631",
"0.6366075",
"0.630889",
"0.6187956",
"0.6181718",
"0.6135656",
"0.60933757",
"0.60753024",
"0.60713834",
"0.60679036",
"0.5979836",
"0.5911147",
"0.5875202",
"0.58538985",
"0.5852838",
"0.5839747",
"0.5811985",
"0.5810482",
"0.5772087",
"0.5767907",
"0.5767475",
"0.57487345",
"0.57436335",
"0.5727676",
"0.5727676",
"0.5705558",
"0.5656388",
"0.56439316",
"0.5631138",
"0.5630141",
"0.5625141",
"0.5612251",
"0.56104016",
"0.5606613",
"0.5559352",
"0.55588716",
"0.5554029",
"0.5551032",
"0.5548592",
"0.55435073",
"0.55223256",
"0.5518687",
"0.5516682",
"0.5509274",
"0.54979765",
"0.5484106",
"0.5473601",
"0.5470188",
"0.54636484",
"0.5462708",
"0.54484874",
"0.54423696",
"0.5426382",
"0.54232377",
"0.542072",
"0.54059404",
"0.5403759",
"0.5396499",
"0.5392452",
"0.53897613",
"0.5373232",
"0.53730184",
"0.5360788",
"0.5360788",
"0.5338964",
"0.53389263",
"0.53338534",
"0.5330507",
"0.5327795",
"0.5324221",
"0.53218913",
"0.5314497",
"0.5310506",
"0.5296125",
"0.5295083",
"0.529072",
"0.529072",
"0.5288947",
"0.52813655",
"0.528051",
"0.5251785",
"0.5246702",
"0.5243432",
"0.5234442",
"0.52314734",
"0.5220681",
"0.5220038",
"0.52047795",
"0.5197454",
"0.51912314",
"0.5189901",
"0.5172443",
"0.5171788",
"0.51690537",
"0.516416",
"0.51626456",
"0.51591337",
"0.51549757"
] |
0.63306946
|
4
|
Forgets a persistent session. def forget(user) user.forget cookies.delete(:user_id) cookies.delete(:remember_token) end Logs out the current user.
|
def log_out
forget(current_user)
session.delete(:user_id)
@current_user = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget (user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\r\n user.forget\r\n cookies.delete(:user_id)\r\n cookies.delete(:remember_token)\r\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget!\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:username)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n\t user.forget\n\t cookies.delete(:user_id)\n\t cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n\n end",
"def forget(user)\n user.forget # set user.remember_digest as nil\n cookies.delete(:user_id)\n cookies.delete(:remember_token) \n end",
"def forget(user)\n user.delete_remember_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget #nil out remember_digest\n cookies.delete(:current_user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete :id\n cookies.delete :remember_token\n end",
"def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n # Sets the remember_digest attribute to nil in the DB\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget if user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n cookies.delete(:user_type)\n end",
"def forget(user)\n\t user.forget\n\t cookies.delete(:user_id) #delete user_id cookie\n\t cookies.delete(:remember_token) #delete remember_token cookie\n\tend",
"def forget(user)\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n\t\tuser.forget\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\tend",
"def forget(user)\n\t\tuser.forget\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\tend",
"def forget(user)\n\t\tuser.forget\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\tend",
"def forget(user)\n\t\tuser.forget\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\tend",
"def forget(user)\n\t\tuser.forget\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\tend",
"def forget(user)\n\t\tuser.forget\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\tend",
"def forget(user)\n\tuser.forget\n\tcookies.delete(:user_id)\n\tcookies.delete(:remember_token)\n end",
"def forget (user)\n\tuser.forget\n\tcookies.delete(:user_id)\n\tcookies.delete(:remember_token)\nend",
"def forget(user)\n user.forget # Defined in the User model\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend",
"def forget(user)\n user.unpersist # In the database\n cookies.delete(:user_id) # In the browser\n cookies.delete(:remember_token) # In the browser\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:user_type_string)\n cookies.delete(:remember_token)\n end",
"def user_forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget # Calls model function\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend",
"def forget(user)\n\t\t#call the model.forget api to delete the remember_token from user\n\t\tuser.forget\n\t\t#remove cookie from browser\n\t\tcookies[:user_name]=nil\n\t\t#remove remembertoken from browser\n\t\tcookies[:remember_token]=nil\n\tend",
"def forget(user)\n user.forget\n cookies.delete(:investor_id)\n cookies.delete(:remember_token)\n end",
"def forget_user_from_cookie(user)\n user.forget_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget_me(user)\n rememberable = remember_me_adapter(user)\n rememberable.forget_me!\n cookies.delete(remember_cookie_name, forget_cookie_values(user))\n end",
"def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend",
"def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend",
"def forget(user)\n user.update_attribute(:remember_digest, nil)\n cookies.delete(:student_id) if student?\n cookies.delete(:tutor_id) if tutor?\n cookies.delete(:remember_token)\n end",
"def log_out\n current_user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out(user)\n current_user.update_attributes remember_token: User.hash(User.new_remember_token) # overwrite the user's current remember token\n cookies.delete :remember_token # delete the user's cookie\n self.current_user = nil # forget the current user\n end",
"def log_out\n forget(current_user) #called from user.rb. it sets remember_token attribute to nil.\n session.delete(:user_id) #deletes session.\n @current_user = nil # new value of this instance variable.\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\tforget(current_user)\n\tsession.delete(:user_id)\n\t@current_user = nil\nend",
"def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end",
"def forget_me!\n current_user.forget_me!\n cookies.delete(:remember_me_token, domain: Config.cookie_domain)\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def forget_me!\n current_user.forget_me!\n cookies.delete(\n :remember_me_token,\n domain: sorcery_config.cookie_domain\n )\n end",
"def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend"
] |
[
"0.9252601",
"0.9232922",
"0.9220021",
"0.9219706",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92176783",
"0.92110956",
"0.9198116",
"0.9196519",
"0.9196519",
"0.9196519",
"0.9196519",
"0.9196519",
"0.91942555",
"0.9172874",
"0.91722816",
"0.9164833",
"0.91601914",
"0.915348",
"0.9147249",
"0.9122606",
"0.9122606",
"0.911042",
"0.90984404",
"0.908587",
"0.90813977",
"0.9072176",
"0.9072176",
"0.9072176",
"0.9072176",
"0.9072176",
"0.9072176",
"0.90637577",
"0.9041703",
"0.90333885",
"0.90249354",
"0.9017992",
"0.9004381",
"0.8927967",
"0.8844695",
"0.8811222",
"0.87999034",
"0.8797684",
"0.87707937",
"0.8753707",
"0.87018263",
"0.87018263",
"0.84863627",
"0.83927643",
"0.81917197",
"0.81759506",
"0.8173314",
"0.8168051",
"0.8161461",
"0.8151378",
"0.8130068",
"0.81178474",
"0.8104085",
"0.8096957",
"0.8084466",
"0.8074414",
"0.807293",
"0.80630124",
"0.80630124",
"0.80630124",
"0.80630124",
"0.80630124"
] |
0.0
|
-1
|
Remembers a user in a persistent session.
|
def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end",
"def change_password\n @user = User.find_by_id(session[:remember_token])\n end",
"def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def user_remember(user)\n user.remember_user\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def user_remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end",
"def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end",
"def set_session_current_user(user)\n self.current_user = user\n # Try to reuse existing sessions.\n if session[:authpwn_suid]\n token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first\n if token\n if token.user == user\n token.touch\n return user\n else\n token.destroy\n end\n end\n end\n if user\n session[:authpwn_suid] = Tokens::SessionUid.random_for(user,\n request.remote_ip, request.user_agent || 'N/A').suid\n else\n session.delete :authpwn_suid\n end\n end",
"def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end",
"def login(user)\n session[:session_token] = user.reset_session_token\n end",
"def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end",
"def remember user\n # generates the remember token and saves it's encrypted form to the db\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n user.remember\n # abort(@session[:user_id].to_s)\n # cookies.permanent.signed[:user_id] = user.id\n # cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user_session\n @user = user_session.find(params[:id])\n end",
"def login!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end",
"def set_current_user(user)\n sha1 = Digest::SHA1.hexdigest(user.id.to_s + Time.now.to_i.to_s)\n cookies[:remember_token] = { :value => sha1, :expires => 3.years.from_now }\n user.remember_token = sha1\n user.save\n @current_user = user\n end",
"def login(user)\n session[:session_token] = user.reset_session_token!\n end",
"def switch_user\n session[:user_id] = params[:user_id]\n redirect_to \"/admin/account\"\n end",
"def log_in_user!(a_user)\n session[:session_token] = a_user.reset_session_token!\n end",
"def set_user_session(user)\n session[:logged_in_users_id] = user.id\n end",
"def remember(user)\n user.persist\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def save_session user\n # The password_seed method is used to generate the stored token.\n # The remember_token is then stored as a signed cookie along with the\n # user's ID from the database.\n remember_token = password_seed\n cookies.permanent.signed[:remember_user_id] = user.id\n cookies.permanent.signed[:remember_user_token] = remember_token\n \n # The WHIRLPOOL hash of remember_token and the user's password seed is\n # then stored in the database.\n remember_hash = Digest::Whirlpool.hexdigest(remember_token +\n user.password_seed)\n user.update_attributes(:remember_hash => remember_hash)\n user.save\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def login!(user)\n @current_user = user\n session[:session_token] = user.reset_session_token!\n end",
"def sign_in(user)\n # Issues new random piece of text (aka\n # remember_token) to user\n remember_token = User.new_remember_token\n # Giving user plain text token\n cookies.permanent[:remember_token] = remember_token\n # Hashing the version of the remember_token which the host maintains.\n user.update_attribute(:remember_token, User.hash(remember_token))\n #sets the one who signed in (user) to current user\n self.current_user=user\n end",
"def current_user=(new_user)\n current_session.user = new_user\n end",
"def login!(user)\n @current_user = user;\n session[:session_token] = user.reset_session_token!\n end",
"def remember(user)\n user.save_remember_digest\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id # encrypt the user_id instead of plaintext\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember (user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n user.remember!\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def load_user(user)\n session[:user_id] = user.id\n session_reset_timeout!\n user.update_attributes last_login_on: Time.now, login_count: user.login_count + 1\n end",
"def sign_in(user)\n remember_token = User.new_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_digest, User.digest(remember_token))\n cookies.permanent.signed[:user_id] = user.id\n self.current_user = user\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend",
"def log_in(user)\n current_user = user\n session[:session_token] = user.reset_session_token!\n end",
"def restore_last_user\n return @last_user if @last_user\n if session[:last_user_id].present?\n @last_user = User.find_by_id(session[:last_user_id])\n message = translate(\"users.sign_in_back\", user: @last_user.name)\n set_flash_message(message, :success, false)\n session.destroy()\n session[:id] = @last_user.id if @last_user.present?\n return @last_user\n end\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def sign_in(user)\n remember_token = User.new_remember_token # create a new remember token\n cookies.permanent[:remember_token] = remember_token # save the remember token on the client side as a cookie\n user.update_attributes remember_token: User.hash(remember_token) # save the remember token on the server side in the DB\n self.current_user = user\n end",
"def user_log_in(user)\n session[:user_id] = user.id\n end",
"def with_user(new_user, &block)\n begin\n set_user(new_user)\n yield exists?(:previous_user) ? fetch(:previous_user) : nil\n ensure\n reset_user\n end\n \n clear_sessions\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.token\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def set_user_session\n UserSession.current_user = current_user\n end",
"def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end",
"def remember(user)\n user.remember\n # The \"signed\" method encrypts the user_id, since cookies are not themselves encrypted\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end",
"def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def remember(user)\n user.remember\n cookies.permanent.encrypted[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def destroy\n User.find(current_user.id)\n reset_session\n redirect_to new_user_path\n end",
"def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def auto_login(user, should_remember = false)\n session[:user_id] = user.id.to_s\n @current_user = user\n remember_me! if should_remember\n end",
"def remember(user)\nuser.remember\ncookies.permanent.signed[:user_id] = user.id\ncookies.permanent[:remember_token] = user.remember_token\nend",
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end",
"def set_user_session\n @user_session = UserSession.find\n end",
"def lookup_user\n reset_session #use this when they ask you to find a user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id]= user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def log_on_user(user, session, cookies)\n cookies.permanent[TOKEN_COOKIE] = { value: user.id, httponly: true }\n @env[CURRENT_USER_KEY] = user\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent.signed[:remember_token] = user.remember_token\n end",
"def remember(user)\n\t\t#calls the remember method in AdminUser model\n\t\tuser.remember\n\t\t#cookies method helps to do permanent sessions. This is actually a syntactic sugar for a bigger thing. \n\t\tcookies.permanent.signed[:user_name] = user.username\n\t\t#save the remembertoken as well. this dosent need to be encrypted\n\t\tcookies.permanent[:remember_token] = user.remember_token\n\tend",
"def remember\n self.remember_token = User.new_token\n self.remember_digest = User.digest(self.remember_token)\n update_attribute(:remember_digest, self.remember_digest) #for new user, this creates record\n end",
"def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end"
] |
[
"0.6756274",
"0.6643963",
"0.6311661",
"0.6311661",
"0.6282292",
"0.6236429",
"0.6200759",
"0.6200759",
"0.6180203",
"0.6180168",
"0.61691266",
"0.61579084",
"0.61385846",
"0.61253554",
"0.61195314",
"0.60906595",
"0.6069288",
"0.6063457",
"0.60607594",
"0.60518014",
"0.6049487",
"0.6049234",
"0.6021525",
"0.60175854",
"0.6016544",
"0.60150564",
"0.60100454",
"0.6005678",
"0.60014665",
"0.5995368",
"0.5990829",
"0.59906775",
"0.5989443",
"0.597983",
"0.59711486",
"0.59602624",
"0.5959515",
"0.59581184",
"0.595667",
"0.59465754",
"0.59458274",
"0.59447485",
"0.59434605",
"0.59419745",
"0.59359884",
"0.5928424",
"0.59283227",
"0.592354",
"0.5917843",
"0.59163594",
"0.5911159",
"0.59079564",
"0.59015423",
"0.59015423",
"0.589713",
"0.588386",
"0.5878984",
"0.58685917",
"0.5867259",
"0.58665556",
"0.5861745",
"0.5859355",
"0.58582467",
"0.5842939",
"0.5839163",
"0.5835743",
"0.583336",
"0.58286357",
"0.582353",
"0.5817825",
"0.58157396",
"0.58157396"
] |
0.5917629
|
70
|
Returns the current loggedin user (if any). def current_user
|
def signed_in?
!current_user.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n abort \"You have no current user set!\".yellow unless current_user_exists?\n config.current_user\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n return @current_user\n end",
"def current_user\n @current_user ||= login_from_session unless @current_user == false\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end",
"def current_user\n if session[:current_user_id]\n @current_user ||= User.find(session[:current_user_id])\n end\n end",
"def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # ||= is used for memoization of @current_user variable\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def current_user\n load_session\n @current_user\n end",
"def current_user\n \treturn @current_user if defined? @current_user\n \t@current_user = User.first\n end",
"def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end",
"def current_user\n @current_user || User.find(session[:user_id]) if session[:user_id]\n \tend",
"def current_user\n current_session.user\n end",
"def current_user\n\t\tif session[:user_id]\n\t\t\t@current_user ||= User.find_by(id: session[:user_id])\n\t\tend\n\tend",
"def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end",
"def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend",
"def current_user\n @current_user ||= find_logged_in_user\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user || = User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= fetch_user_from_request\n end",
"def current_user\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\n if(@current_user.nil?)\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n @current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end",
"def current_user\n @current_user ||= (login_from_session || login_from_basic_auth || login_from_cookie || login_from_api_key || login_from_config) unless @current_user == false\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find(session[:current_user_id])\n end",
"def current_user\n\t\t@current_user ||= (login_from_session) unless @current_user == false\n end",
"def current_user\n\t\t\treturn unless session[:user_id]\n\t\t\t@current_user ||= User.find_by_id(session[:user_id])\n\t\tend",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n \t@current_user || User.find(session[:user_id])\n end",
"def current_user\n @current_user\n end",
"def current_user\n @current_user ||= User.find(session[:current_user_id]) if session[:current_user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:current_user_id]) if session[:current_user_id]\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end",
"def current_user\n unless current_user == false\n @current_user ||= (login_from_session || login_from_basic_auth || \n login_from_cookie)\n end\n end",
"def current_user\n\t\tif session[:user_id]\n\t\t @current_user = User.find(session[:user_id])\n\t\telse\n\t\t @current_user = nil\n\t\tend\n\t\t @current_user\n end",
"def current_user\n session.user\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n @current_user ||= User.find_by id: session[:user_id]\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find(session[:user_id]) if session[:user_id]\n end\n end",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end",
"def current_user\n session[:user]\n end",
"def current_user\n @current_user ||= auth_user\n end",
"def current_user\n @current_user ||=\n if session[:userid]\n User.find_by_userid(session[:userid])\n end\n end",
"def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:uid] && User.find_by_id(session[:uid])) || nil\n end",
"def current_user\n\t\t@current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\n @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n @current_user ||= current_user_session && current_user_session.user\n end",
"def current_user\n @current_user ||= current_user_session && current_user_session.user\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by_id(session[:current_user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by_id(session[:current_user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by_id(session[:current_user_id])\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end\n end",
"def current_user\n if session[:current_user_id]\n @current_user ||= User.find(session[:current_user_id])\n end \n end",
"def current_user\n\t return unless session[:user_id]\n\t @current_user ||= User.find_by_id(session[:user_id]) \n\tend",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n\n end",
"def current_user\n @current_user ||= (from_session || from_access_token)\n end",
"def current_user\n # retrieve from database on every request instead of \n # storing it as global variable when current_user= \n # is called to prevent user information becoming stale.\n @current_user ||= (session[:uid] && User.find_by_id(session[:uid])) || nil\n end",
"def current_user\n @_current_user ||= session[:current_user_id] &&\n User.find_by(id: session[:current_user_id])\n end",
"def current_user\n @current_user\n end",
"def current_user\n @current_user\n end",
"def current_user\n\t @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend",
"def current_user\r\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\r\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end"
] |
[
"0.89950716",
"0.89950716",
"0.8952277",
"0.8908331",
"0.8861863",
"0.8831171",
"0.88192016",
"0.88192016",
"0.8809397",
"0.8809397",
"0.8801622",
"0.8788534",
"0.87736213",
"0.8765679",
"0.87598276",
"0.8742005",
"0.8727968",
"0.87263536",
"0.8721302",
"0.87144554",
"0.8710601",
"0.8705524",
"0.8704439",
"0.87021554",
"0.87003946",
"0.86965466",
"0.86929905",
"0.86909914",
"0.8689809",
"0.8687235",
"0.86849046",
"0.86849046",
"0.8684085",
"0.8682239",
"0.86764026",
"0.86764026",
"0.86764026",
"0.86764026",
"0.86719596",
"0.8670575",
"0.8670414",
"0.8666774",
"0.8662264",
"0.86619306",
"0.8654459",
"0.86502016",
"0.86490417",
"0.86457616",
"0.86457616",
"0.86443365",
"0.8641734",
"0.86382693",
"0.8637436",
"0.8628979",
"0.8628979",
"0.8620623",
"0.8620623",
"0.8620596",
"0.86142206",
"0.861292",
"0.8606944",
"0.86063576",
"0.8606349",
"0.86017793",
"0.8597458",
"0.8596521",
"0.859639",
"0.859639",
"0.859639",
"0.85920095",
"0.8591691",
"0.85881567",
"0.8586089",
"0.8585774",
"0.85841846",
"0.8583673",
"0.8583673",
"0.8583673",
"0.85822916",
"0.85822916",
"0.85815716",
"0.85815716",
"0.85815716",
"0.8579302",
"0.8578231",
"0.85780334",
"0.857747",
"0.857747",
"0.8575347",
"0.8575347",
"0.8573963",
"0.8573963",
"0.8570181",
"0.85677063",
"0.85668427",
"0.85654604",
"0.85649985",
"0.85649985",
"0.8562551",
"0.8561713",
"0.8561467"
] |
0.0
|
-1
|
Returns true if the user is logged in, false otherwise.
|
def logged_in?
!current_user.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end",
"def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def loggedin?\n @session.nil? ? false : (return true)\n end",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end",
"def logged_in?\n current_user != :false \n end",
"def is_logged_in_user?\n session[:user_authenticated]\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def is_logged_in?\n !session[:user_id].nil?\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend",
"def logged_in?\n return false unless @auth_header\n true\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\r\n\t\t!current_user.nil?\r\n\tend",
"def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end",
"def logged_in?\n\t\tcurrent_user.present?\n\tend",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !!logged_in_user \n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n current_user ? true : false;\n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end",
"def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n current_user != nil ? true : false\n end",
"def logged_in?\n return session['current_user']\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n !current_user.nil?\n end",
"def is_logged_in?\n return true if current_user || current_admin\n end",
"def logged_in?\n\t\t!current_user.nil?\n \tend",
"def logged_in?\n \t\t!current_user.nil?\n \tend",
"def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n !current_user.blank?\n end",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in?\n # !! turns this into a boolean, so we DON'T get nil\n !!session[:user_id]\n end",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def logged_in?\n if session[:username].blank? or\n session[:authenticated].blank? or\n !session[:authenticated]\n return false\n end\n\n return true\n end",
"def user_logged_in?\n current_user.present?\n end",
"def user_logged_in?\n current_user.present?\n end",
"def is_logged_in?\n session[:user_id].present?\n end",
"def logged_in?\n current_user_id.to_i > 0\n end",
"def logged_in?\n current_user.is_a? User\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end"
] |
[
"0.90820295",
"0.87625194",
"0.8754586",
"0.8717396",
"0.86882013",
"0.86488444",
"0.86449414",
"0.86363584",
"0.8630011",
"0.8626397",
"0.8626397",
"0.858086",
"0.8565111",
"0.8559381",
"0.8559381",
"0.8549472",
"0.8547544",
"0.85425085",
"0.8539451",
"0.85383666",
"0.851565",
"0.85100806",
"0.8506615",
"0.8506615",
"0.85062945",
"0.8503895",
"0.8497648",
"0.84898823",
"0.84825575",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84809154",
"0.84692997",
"0.84669876",
"0.84641623",
"0.8463295",
"0.84549075",
"0.84549075",
"0.84549075",
"0.84549075",
"0.84543604",
"0.84522235",
"0.84520274",
"0.84517",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.84509265",
"0.8440924",
"0.8440924",
"0.8440924",
"0.8440924",
"0.8427133",
"0.84236866",
"0.8421213",
"0.84194136",
"0.84103566",
"0.8408121",
"0.8402768",
"0.8402768",
"0.840177",
"0.84010327",
"0.8399597",
"0.8395149",
"0.8392733",
"0.8385173",
"0.8382726",
"0.83812857",
"0.8380195",
"0.8376677",
"0.8375345",
"0.83726704",
"0.83726704",
"0.83684385",
"0.8367623",
"0.8364096",
"0.8359142",
"0.8359142",
"0.8359142",
"0.8359142"
] |
0.0
|
-1
|
validate that the rectangle command has the necessary parameters Params:
|
def validate_rectangule(command)
if command.size == 5
if @drawing_tool.painter.canvas_exist == true
@drawing_tool.painter.new_rectangule(command)
else
puts 'no canvas has been created'
end
else
puts 'missing arguments for this command:'
puts 'R [x1][y1][x2][y2]'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def validate_params\n if command == 'PLACE'\n if params.kind_of?(Array)\n errors[:params] << '[PLACE] Must be three params' unless params.size == 3\n validate_coords\n validate_direction\n else\n errors[:params] << '[PLACE] Not valid params'\n end\n end\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def validate params\n validate_params(params)\n validate_dimension\n end",
"def validate_rect image, width, height, x1, x2, y1, y2\n begin\n assert x1 >= 0\n assert x2 >= 0\n assert x1 <= image.width\n assert x2 <= image.width\n assert x1 <= x2\n assert y1 >= 0\n assert y2 >= 0\n assert y1 <= image.height\n assert y2 <= image.height\n assert y1 <= y2\n rescue => e\n raise ManagedImage::InvalidCropError, \"Crop coordinates #{x1}, #{x2}, #{y1}, #{y2} is invalid for image with size #{image.width}x#{image.height}\"\n end\n end",
"def rectangular _args\n \"rectangular _args;\" \n end",
"def validate_command(command)\n command_validator.validate(command)\n end",
"def valid?\n width.present? && height.present?\n end",
"def validate(command)\n args = command.split(' ')\n\n case args[0]\n when 'C', 'S'\n raise ArgumentError, \"#{WRONG_NUM}: #{command}\" unless args.length == 1\n when 'I'\n raise ArgumentError, \"#{WRONG_NUM}: #{command}\" unless args.length == 3\n\n int1 = integer?(args[1])\n int2 = integer?(args[2])\n raise ArgumentError, \"#{WRONG_TYPE}: #{command}\" unless int1 && int2\n when 'L'\n raise ArgumentError, \"#{WRONG_NUM}: #{command}\" unless args.length == 4\n\n int1 = integer?(args[1])\n int2 = integer?(args[2])\n color = valid_color?(args[3])\n correct_types = int1 && int2 && color\n raise ArgumentError, \"#{WRONG_TYPE}: #{command}\" unless correct_types\n when 'V', 'H'\n raise ArgumentError, \"#{WRONG_NUM}: #{command}\" unless args.length == 5\n\n int1 = integer?(args[1])\n int2 = integer?(args[2])\n int3 = integer?(args[3])\n color = valid_color?(args[4])\n correct_types = int1 && int2 && int3 && color\n raise ArgumentError, \"#{WRONG_TYPE}: #{command}\" unless correct_types\n else\n raise ArgumentError, \"unrecognised command :( : #{command}\"\n end\n end",
"def rectangle?()\n return @type == \"rectangle\"\n end",
"def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n unless l.call(self, attr, val)\n raise \"validation error : #{attr}=#{val} (#{self.class})\"\n end\n end\n end\n end",
"def rect; end",
"def rect; end",
"def check_place_params *args\n if args.length != 3\n throw_error \"wrong number of arguments for place: (#{args.length} for 3)\"\n return false\n end\n # params number is 3 ...\n x = args[0].to_i if is_integer args[0]\n y = args[1].to_i if is_integer args[1]\n face = args[2]\n faces = Constants::FACES\n\n case\n when !is_integer(args[0])\n throw_error \"x should be an integer\"\n when !is_integer(args[1])\n throw_error \"y should be and integer\"\n when face.class != String\n throw_error \"face should be string type\"\n when x > @xmax || x < 0\n throw_error \"x exceed the limitation\"\n when y > @ymax || y < 0\n throw_error \"y exceed the limitation\"\n when faces.index(face.downcase).nil?\n throw_error \"face value should be one of the #{faces}\"\n else\n return true\n end \n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def arguments_valid?\n true if @commands.length > 0\n end",
"def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end",
"def update!(**args)\n @rectangle = args[:rectangle] if args.key?(:rectangle)\n end",
"def _entry_4_validatecommand(*args)\n\n end",
"def arguments_valid?\n true \n end",
"def validate_user_input\n validate_chess_piece_type\n validate_current_position_boundaries\n @is_valid\n end",
"def valid?(x, y)\n x >= 0 && x < MAX_WIDTH && y >= 0 && y < MAX_HEIGHT\n end",
"def valid_params?; end",
"def rectangle(x, y, width, height, options={})\n cur_page.rectangle(x, y, width, height, options)\n end",
"def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"def change_rectangle _val1, _val2\n send_cmd(\"change_rectangle #{_val1} #{_val2}\")\n end",
"def boat_passable_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0200)\r\r\n return false unless check_passage(x2, y3, 0x0200)\r\r\n return false unless check_passage(x3, y2, 0x0200)\r\r\n return check_passage(x3, y3, 0x0200)\r\r\n end",
"def arguments_valid?\n true \n # to do\n end",
"def rect=(rectangle); end",
"def passable_rect?(x, y, d, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n x4 = (x2 + x3) / 2.0\r\r\n y4 = (y2 + y3) / 2.0\r\r\n\r\r\n if((x2.floor != x3.floor && [1, 3, 4, 6, 7, 9].include?(d)) || (y2.floor != y3.floor && [1, 2, 3, 7, 8, 9].include?(d)))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x2, y2, 1)) || ([3, 6, 9].include?(d) && !check_passage(x2, y2, 4))\r\r\n return false if ([3, 6, 9].include?(d) && !check_passage(x2, y3, 4)) || ([7, 8, 9].include?(d) && !check_passage(x2, y3, 8))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x3, y2, 1)) || ([1, 4, 7].include?(d) && !check_passage(x3, y2, 2))\r\r\n return false if ([1, 4, 7].include?(d) && !check_passage(x3, y3, 2)) || ([7, 8, 9].include?(d) && !check_passage(x3, y3, 8))\r\r\n end\r\r\n return true\r\r\n end",
"def validate_pos(x, y)\n return x.between?(0, @size_x - 1) && y.between?(0, @size_y - 1)\n end",
"def validate_coords\n (0..1).each do |index|\n if params.try(:[], index).try(:to_i) > 5 || params.try(:[], index).try(:to_i) < 0\n errors[:params] << \"[PLACE] #{index+1} param should be more than -1 and less than 6\"\n end\n end\n end",
"def validate!\n unless resource_type === 'user_moves'\n fail PayloadValidationError, 'Invalid resource type at \"data.type\", expected \"user_moves\"'\n end\n\n unless raw_given_position.is_a?(Array) && raw_given_position.length == 2\n fail PayloadValidationError, 'Invalid resource type at \"data.attributes.position\", expected Array([x, y])'\n end\n end",
"def command_rect(index = 0)\n r_width = contents_width / columns\n r_height = contents_height\n x = r_width * index\n y = 0\n Rect.new(x, y, r_width, r_height)\n end",
"def valid?\n return false if @height.nil?\n return false if @height < 0\n return false if @width.nil?\n return false if @width < 0\n return false if @x.nil?\n return false if @x < 0\n return false if @y.nil?\n return false if @y < 0\n true\n end",
"def arguments_valid?\n true\n end",
"def check_bounds(sp, params)\n if params[:xdisplay] == :wrap\n sp.x %= @game_window.width\n elsif params[:xdisplay] == :bound\n sp.x = (@game_window.width - sp.width) if sp.x > (@game_window.width - sp.width)\n elsif params[:ydisplay] == :wrap\n sp.y %= @game_window.height - sp.height\n elsif params[:ybound] == :bound\n sp.y = (@game_window.height - sp.height) if sp.y > (@game_window.height - sp.height)\n end\n end",
"def validate_args (args)\n\t# todo\nend",
"def check_parameter_constraints\n check_constraints_for_a if (@repository.parameters[:all])\n check_constraints_for_c if (@repository.parameters[:coord])\n check_constraints_for_d if (@repository.parameters[:delta])\n check_constraints_for_r if (@repository.parameters[:range])\n\n # check mandatory parameter combination\n check_parameter_occurrence\n \n # check mandatory file parameter\n check_mandatory_parameter(:file)\n end",
"def add_rectangle(png_obj, start_x, start_y, width, height, color = nil)\n\t# check to see if it will go out of bounds (thickness and length)\n\tif start_x + width >= png_obj.width then\n\t\tputs \"add_rectangle: out of bounds (width / start_x)\"\n\t\treturn false\n\tend\n\tif start_y + height >= png_obj.height then\n\t\tputs \"add_rectangle out of bounds (height / start_y)\"\n\t\treturn false\n\tend\n\n\t# set default values for nil args\n\tif color == nil then\n\t\tcolor = :black\n\tend\n\n\t# actually add the rectangle\n\t(0...height).each do |row|\n\t\t(0...width).each do |col|\n\t\t\tpng_obj[start_x + col, start_y + row] = color\n\t\tend\n\tend\n\n\treturn true\nend",
"def valid?(x, y)\n return (x >= 0 and x < width and y >= 0 and y < height)\n end",
"def _entry_2_validatecommand(*args)\n\n end",
"def drawRectangle _obj, _args\n \"_obj drawRectangle _args;\" \n end",
"def _entry_6_validatecommand(*args)\n\n end",
"def validate_current_position_boundaries\n if (@initial_position.nil? || row_pos_invalid? || col_pos_invalid?) \n puts \"\\nPlease enter valid chess piece position. Eg: -position a1\"\n puts \"Please type one of these positions\"\n puts valid_boundaries\n @is_valid = false\n end\n end",
"def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end",
"def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end",
"def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction\"\n return false\n end\n return true\n end",
"def arguments_valid?\n true\n end",
"def validate\n REQUIRED_PARAMS.each do |param|\n raise RequiredParameterError, \"Overlay GithubRepo missing required paramater: #{param}\" if (send(param).nil? || send(param).empty?)\n end\n\n # If we are using a publisher, check required publisher params\n if @use_publisher\n REQUIRED_PUBLISHER_PARAMS.each do |param|\n raise RequiredParameterError, \"Overlay GithubRepo missing required paramater: #{param}\" if (send(param).nil?)\n end\n end\n end",
"def love_rectangle(rect_1, rect_2)\n ranges_1 = make_range(rect_1)\n ranges_2 = make_range(rect_2)\n\n match_x = matching_range(ranges_1[:x], ranges_2[:x])\n match_y = matching_range(ranges_1[:y], ranges_2[:y])\n\n if [match_x.empty?, match_y.empty?].any?\n \"No match!\"\n else\n make_output(match_x, match_y)\n end\nend",
"def validate\r\n\r\n end",
"def validate(arg)\n arg.each do |arg|\n if arg[0].to_f > 90 || arg[0].to_f < -90\n msg = \"Latitude '#{arg[0]}' is invalid - must be between -90 and 90\"\n raise Error, msg\n end\n if arg[1].to_f > 180 || arg[1].to_f < -180\n msg = \"Longitude '#{arg[1]}' is invalid - must be between -180 and 180\"\n raise Error, msg\n end\n end\n end",
"def validate_command\n if requester != player\n errors.add(:allowed, I18n.t(\"errors.not_authorized\"))\n end\n unless airlift?\n if game.actions_taken == 4\n errors.add(:allowed, I18n.t(\"player_actions.no_actions_left\"))\n end\n if proposal.turn_nr != game.turn_nr\n errors.add(:allowed, I18n.t(\"movement_proposals.expired\"))\n end\n if destination_is_not_a_neighbor? && another_player_is_not_at_destination?\n errors.add(:allowed, I18n.t(\"movement_proposals.not_allowed\"))\n end\n end\n end",
"def valid_position?\n unless position.present?\n errors[:cmd] ||= []\n errors[:cmd] << 'Robot current position is unknown for some reason'\n end\n errors.blank?\n end",
"def validate_x_y_coords(x, y)\n validate_x_coords(x)\n validate_y_coords(y)\n end",
"def ship_passable_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0400)\r\r\n return false unless check_passage(x2, y3, 0x0400)\r\r\n return false unless check_passage(x3, y2, 0x0400)\r\r\n return check_passage(x3, y3, 0x0400)\r\r\n end",
"def validate_command\n\t \tcommand_types = ['get_authorization_url','update_site_registration', 'get_tokens_by_code','get_user_info', 'register_site', 'get_logout_uri','get_authorization_code','uma_rs_protect','uma_rs_check_access','uma_rp_get_rpt','uma_rp_authorize_rpt','uma_rp_get_gat']\n\t \tif (!command_types.include?(@command))\n\t\t\t\tlogger(:log_msg => \"Command: #{@command} does not exist! Exiting process.\")\n \tend\n\t end",
"def validate_required_parameters!(positions)\n if missing_parameter = positions.detect { |position| !values.key?(position) }\n raise ArgumentError.new(\"Missing Parameter - #{name}(#{missing_parameter})\")\n end\n end",
"def validNewPatientCommand?\n\tif @commands.size < 4\n\t\treturn false \n\telsif @commands[1].size <=0\n\t\treturn false\n\telsif @commands[2].size <=0\n\t\treturn false \n\telsif @commands[3].size <=0\n\t\treturn false\n\tend \n\t\treturn true \n\tend",
"def _checkParams(node_number, port, slaveof)\n valid = node_number.is_a?(Fixnum) && port.is_a?(Fixnum) && ( slaveof.nil? || slaveof.is_a?(String))\n unless valid\n raise TypeError, \"Invalid Params\"\n end\n end",
"def validrptTbCommand?\n\tif @commands.size < 3\n\t\treturn false \n\telsif @commands[1].size <=0\n\t\treturn false\n\telsif @commands[2].size <=0\n\t\treturn false\n\tend \n\t\treturn true \nend",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if (1..2).include? @arguments.length \n end",
"def check_params; true; end",
"def rect(*args)\n Rect.new(self, *args)\n end",
"def validate_question params\n\n end",
"def valid?\n return false if @height.nil?\n return false if @id.nil?\n return false if @name.nil?\n return false if @width.nil?\n true\n end",
"def validrptHivCommand?\n\tif @commands.size < 2\n\t\treturn false \n\telsif @commands[1].size <=0\n\t\treturn false\n\telsif @commands[2].size <=0\n\t\treturn false\n\telsif @commands[3].size <=0\n\t\treturn false\n\tend \n\t\treturn true \nend",
"def _entry_3_validatecommand(*args)\n\n end",
"def edit_crop_rectangle_with_http_info(left, top, width, height, image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditApi.edit_crop_rectangle ...'\n end\n # verify the required parameter 'left' is set\n if @api_client.config.client_side_validation && left.nil?\n fail ArgumentError, \"Missing the required parameter 'left' when calling EditApi.edit_crop_rectangle\"\n end\n # verify the required parameter 'top' is set\n if @api_client.config.client_side_validation && top.nil?\n fail ArgumentError, \"Missing the required parameter 'top' when calling EditApi.edit_crop_rectangle\"\n end\n # verify the required parameter 'width' is set\n if @api_client.config.client_side_validation && width.nil?\n fail ArgumentError, \"Missing the required parameter 'width' when calling EditApi.edit_crop_rectangle\"\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling EditApi.edit_crop_rectangle\"\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_file.nil?\n fail ArgumentError, \"Missing the required parameter 'image_file' when calling EditApi.edit_crop_rectangle\"\n end\n # resource path\n local_var_path = '/image/edit/crop/rectangle/{left}/{top}/{width}/{height}'.sub('{' + 'left' + '}', left.to_s).sub('{' + 'top' + '}', top.to_s).sub('{' + 'width' + '}', width.to_s).sub('{' + 'height' + '}', height.to_s)\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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['imageFile'] = image_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditApi#edit_crop_rectangle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fill_rect(*args)\n raise \"not implemented\"\n end",
"def drawrect(*)\n super\n end",
"def Rect(x_or_origin, y_or_size=nil, w=nil, h=nil)\n # one arg\n if y_or_size.nil? and w.nil? and h.nil?\n case x_or_origin\n when CGRect\n x = x_or_origin.origin.x\n y = x_or_origin.origin.y\n w = x_or_origin.size.width\n h = x_or_origin.size.height\n when UIView, CALayer\n x = x_or_origin.frame.origin.x\n y = x_or_origin.frame.origin.y\n w = x_or_origin.frame.size.width\n h = x_or_origin.frame.size.height\n when Array\n if x_or_origin.length == 2\n x = x_or_origin[0][0]\n y = x_or_origin[0][1]\n w = x_or_origin[1][0]\n h = x_or_origin[1][1]\n elsif\n x = x_or_origin[0]\n y = x_or_origin[1]\n w = x_or_origin[2]\n h = x_or_origin[3]\n else\n raise RuntimeError.new(\"Invalid argument sent to Rect(#{x_or_origin.inspect})\")\n end\n else\n raise RuntimeError.new(\"Invalid argument sent to Rect(#{x_or_origin.inspect})\")\n end\n # two args\n elsif w.nil? and h.nil?\n x_or_origin = SugarCube::CoreGraphics::Point(x_or_origin) unless x_or_origin.is_a? CGPoint\n x = x_or_origin.x\n y = x_or_origin.y\n if y_or_size.is_a?(CGPoint)\n w = y_or_size.x - x\n h = y_or_size.y - y\n else\n y_or_size = SugarCube::CoreGraphics::Size(y_or_size)\n w = y_or_size.width\n h = y_or_size.height\n end\n # three args\n elsif h.nil?\n if x_or_origin.is_a? Numeric\n # x_or_origin: x, y_or_size: y, w: size\n point = SugarCube::CoreGraphics::Point(x_or_origin, y_or_size)\n size = w\n return SugarCube::CoreGraphics::Rect(point, size)\n elsif w.is_a? Numeric\n # x_or_origin: point, y_or_size: w, w: h\n point = x_or_origin\n size = SugarCube::CoreGraphics::Size(y_or_size, w)\n return SugarCube::CoreGraphics::Rect(point, size)\n else\n raise RuntimeError.new(\"Invalid arguments sent to Rect(#{x_or_origin.inspect}, #{y_or_size.inspect}, #{w.inspect})\")\n end\n else\n x = x_or_origin\n y = y_or_size\n end\n return CGRect.new([x, y], [w, h])\n end",
"def valid?\n test_bounds(x, @xmin, @xmax) && test_bounds(y, @ymin, @ymax)\n end",
"def airship_land_ok_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0800) && check_passage(x2, y2, 0x0f)\r\r\n return false unless check_passage(x2, y3, 0x0800) && check_passage(x2, y3, 0x0f)\r\r\n return false unless check_passage(x3, y2, 0x0800) && check_passage(x3, y2, 0x0f)\r\r\n return check_passage(x3, y3, 0x0800) && check_passage(x3, y3, 0x0f)\r\r\n end",
"def validate(args = {})\n end",
"def validate_parameters?(op)\n temp_params = op.temporary[:plan_params]\n errors_noted = \"The following parameters for plan #{op.plan.id} have errors: \"\n er = false\n if temp_params[:fluorescent_marker]\n errors_noted.concat(\"dark_light invalid\") && er = true if !static_params[:dark_light_options].include? temp_params[:dark_light]\n errors_noted.concat(\"marker_type not supported\") && er = true if !static_params[:marker_type_options].include? temp_params[:marker_type]\n end\n op.error :invalid_parameters, errors_noted if er\n op.temporary[:valid_params?] = !er\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 2\n end",
"def _entry_1_validatecommand(*args)\n\n end",
"def _entry_1_validatecommand(*args)\n\n end",
"def validate!\n if not respond_to?(\"perform_#{command}!\")\n type = self.class.to_s.split(\"::\").last.downcase\n error \"Unknown #{y(type)} command: <#{r(command)}>\"\n error \"Run #{y(\"gitpusshuten help #{type}\")} for a list #{y(type)} commands.\"\n exit\n end\n end",
"def validate_xy(x, y)\n (x >= 0 && y >= 0) && (x <= @size - 1 && y <= @size - 1)\n end",
"def second_validate\n across_req_bound = Array.new((2 * (self.across) + 1),1)\n down_req_bound = Array.new((2 * (self.down) + 1),1)\n top_bound = self.plane[0]\n down_bound = self.plane[2 * (self.down)]\n left_bound = self.plane.map{|a| a[0]}\n right_bound = self.plane.map{|a| a[2 * (self.across)]}\n if(top_bound != across_req_bound || down_bound != across_req_bound ||left_bound != down_req_bound || right_bound != down_req_bound)\n puts \"One of the boundaries is not closed\"\n self.valid = false\n end\n cell_validate if(self.valid == true)\n end",
"def valid_in_context *valid_types\n if valid_types.last.is_a?(String)\n msg = valid_types.pop << \" \"\n else\n msg = \"\"\n end\n unless valid_types.include?( state_or_event.class ) || valid_types.include?(nil) && state_or_event.nil?\n v = valid_types.dup.map do |t|\n {\n nil => \"if not nested inside a block\",\n State => \"inside a state definition block\",\n Event => \"inside an event definition block\"\n }[t]\n end\n msg << \"this command is only valid \" << v.join(',')\n raise ArgumentError, msg\n end\n end",
"def rect(x, y, width, height, options = {})\n options = RECT_OPTIONS.merge(options)\n\n \"<rect x=\\\"#{x}\\\" y=\\\"#{y}\\\" width=\\\"#{width}\\\" height=\\\"#{height}\\\" \n style=\\\"fill:#{options[:fill]};stroke:#{options[:stroke]};\n stroke-width:#{options[:stroke_width]};\n fill-opacity:#{options[:fill_opacity]};\n stroke-opacity:#{options[:stroke_opacity]};\n stroke-dasharray:#{options[:dasharray]}\\\"/>\"\n end",
"def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"def sanity_check_ballot_coords\n \n end",
"def drawRectangle(x,y,w,h,fillp=false,color=\"black\")\n @device.drawRectangle(x,y,w,h,fillp,color) ;\n end",
"def valid?\n @x.is_a?(Integer) &&\n @y.is_a?(Integer) &&\n orientation_set?\n end",
"def update!(**args)\n @rectangle = args[:rectangle] if args.key?(:rectangle)\n @strict_restriction = args[:strict_restriction] if args.key?(:strict_restriction)\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def validate_params\n @calls << [:validate_params]\n end",
"def Rect(x, y, w, h, style='')\n\t\t#Draw a rectangle\n\t\tif (style=='F')\n\t\t\top='f';\n\t\telsif (style=='FD' or style=='DF')\n\t\t\top='B';\n\t\telse\n\t\t\top='S';\n\t\tend\n\t\tout(sprintf('%.2f %.2f %.2f %.2f re %s', x * @k, (@h - y) * @k, w * @k, -h * @k, op));\n\tend",
"def initialize(*rect_args)\n if CGRect === rect_args[0]\n @rect = rect_args[0]\n else\n @rect = SugarCube::CoreGraphics::Rect(*rect_args)\n end\n end",
"def initialize(*rect_args)\n if CGRect === rect_args[0]\n @rect = rect_args[0]\n else\n @rect = SugarCube::CoreGraphics::Rect(*rect_args)\n end\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && [email protected]\n valid_args = false if @options.password && [email protected]\n valid_args\n end",
"def valid_board?\n self.valid_rows? && self.valid_cols? && self.valid_squares?\n end"
] |
[
"0.709151",
"0.6689326",
"0.6675113",
"0.66623265",
"0.6648969",
"0.6608778",
"0.6523687",
"0.64216167",
"0.6210206",
"0.61646247",
"0.61527556",
"0.61435866",
"0.61313874",
"0.6093442",
"0.6093442",
"0.60522735",
"0.6040615",
"0.59918547",
"0.59867615",
"0.5982652",
"0.5911426",
"0.58912194",
"0.58910644",
"0.5890033",
"0.58836967",
"0.5876504",
"0.5873214",
"0.5866508",
"0.58601487",
"0.58456856",
"0.58436567",
"0.5842798",
"0.5838896",
"0.5823373",
"0.58005846",
"0.5789409",
"0.578422",
"0.5772732",
"0.5769432",
"0.57597345",
"0.57230544",
"0.5718884",
"0.57164836",
"0.57093734",
"0.5705866",
"0.568599",
"0.56836855",
"0.56761336",
"0.56761336",
"0.5668783",
"0.566299",
"0.5662647",
"0.5656969",
"0.56565034",
"0.5655748",
"0.56551963",
"0.5645357",
"0.5644553",
"0.56420547",
"0.56306076",
"0.56217396",
"0.5619013",
"0.56067693",
"0.5602615",
"0.55954003",
"0.5583936",
"0.5582636",
"0.5575843",
"0.5575708",
"0.55754507",
"0.5575085",
"0.5571206",
"0.5570101",
"0.5568099",
"0.5567932",
"0.55647403",
"0.556092",
"0.5559903",
"0.5554987",
"0.5549957",
"0.55460685",
"0.55460685",
"0.55443513",
"0.5540255",
"0.553792",
"0.55366486",
"0.5530895",
"0.55294716",
"0.5523813",
"0.5516474",
"0.5513392",
"0.55118304",
"0.5511777",
"0.5511003",
"0.5508918",
"0.5507032",
"0.5507032",
"0.5502659",
"0.55016893",
"0.54994816"
] |
0.79302037
|
0
|
GET /events GET /events.json
|
def index
@current_user=current_user
buddies = Buddy.where(:user => current_user)
@events = []
#add buddied pets
pets = []
buddies.each do |buddy|
pets += [buddy.register]
end
pets.each do |pet|
@events += pet.events
end
@events += current_user.events
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def events(project_id, options = {})\n get \"projects/#{project_id}/events\", options\n end",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def events\n data[\"events\"]\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @events = @category.events\n render json: @events \n end",
"def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end",
"def index\n render json: Event.all, status: :ok\n end",
"def show\n render json: @event, status: :ok\n end",
"def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_with(@events)\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def events\n collection(\"events\")\n end",
"def event(event, options = {})\n get \"events/#{event}\", options\n end",
"def past_events\n @events = Event.past\n render json: @events, include: :talks\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end",
"def show\n \trender json: @event\n end",
"def show\n @events = fetch_events\n end",
"def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end",
"def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end",
"def index\n if params[:query].present?\n @events = GroupEvent.send(params[:query])\n else\n @events = GroupEvent.published\n end\n\n render json: @events\n end",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end",
"def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def details\n get(\"v1/event/#{@id}\")\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end",
"def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end",
"def show\n render json: format_event(@event)\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end"
] |
[
"0.83374274",
"0.8239167",
"0.7943348",
"0.79285383",
"0.77672863",
"0.7741231",
"0.767051",
"0.7665724",
"0.765855",
"0.7642782",
"0.7621404",
"0.7615919",
"0.7615919",
"0.7612841",
"0.75691104",
"0.7522856",
"0.74889225",
"0.74821275",
"0.7470079",
"0.74419075",
"0.7440349",
"0.74391896",
"0.74382097",
"0.7410676",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.74094725",
"0.7400324",
"0.7397711",
"0.73774475",
"0.7368036",
"0.73666185",
"0.7364534",
"0.7363736",
"0.73614556",
"0.73614556",
"0.73614556",
"0.73614556",
"0.73614556",
"0.7359803",
"0.73527515",
"0.733405",
"0.73255366",
"0.73206633",
"0.72963685",
"0.72952443",
"0.72864044",
"0.7282481",
"0.7273287",
"0.72730356",
"0.7247015",
"0.7245674",
"0.7228322",
"0.7228322",
"0.722372",
"0.7213213",
"0.7212054",
"0.7182261",
"0.71818924",
"0.7172188",
"0.71336097",
"0.7128381",
"0.71236545",
"0.71224654",
"0.71148163",
"0.7110015",
"0.7110015",
"0.71033436",
"0.71021193",
"0.71013117",
"0.7100825",
"0.70998",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396",
"0.70995396"
] |
0.0
|
-1
|
GET /events/1 GET /events/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def details\n get(\"v1/event/#{@id}\")\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def show\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def show\n render json: @event, status: :ok\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end",
"def event(event, options = {})\n get \"events/#{event}\", options\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def index\n render json: Event.all, status: :ok\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def event(id, options = {})\n get \"events/#{id}\", options\n end",
"def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event_type = EventType.find(@event.event_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def index\n @event = Event.find(params[:event_id])\n\n end",
"def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def show\n \trender json: @event\n end",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_with(@events)\n end",
"def show\n render json: format_event(@event)\n end",
"def show\n @current_event = CurrentEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_event }\n end\n end",
"def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def show\n begin\n @event = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to show invalid event #{params[:id]}\"\n redirect_to events_path, notice: 'Invalid event ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end\n end",
"def index\n @events = @category.events\n render json: @events \n end",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end"
] |
[
"0.75027657",
"0.7400539",
"0.7360897",
"0.7348184",
"0.7346945",
"0.7336607",
"0.73168355",
"0.7287131",
"0.7280633",
"0.7245571",
"0.72305113",
"0.72188705",
"0.72188705",
"0.7218353",
"0.7218353",
"0.72150075",
"0.72042197",
"0.7198604",
"0.7196775",
"0.71922696",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.7191933",
"0.71898276",
"0.7189658",
"0.7185299",
"0.71837133",
"0.7182193",
"0.7177447",
"0.7164624",
"0.71634454",
"0.71586883",
"0.71577144",
"0.7120297",
"0.7120297",
"0.7120297",
"0.7120297",
"0.7120297",
"0.7103938",
"0.70985645",
"0.70859015",
"0.7074526",
"0.70712733",
"0.7068908",
"0.7068908",
"0.7066203",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7059939",
"0.7050139",
"0.7042667",
"0.7038084",
"0.70323914",
"0.7026831",
"0.70242524",
"0.70195365",
"0.69930404",
"0.69843376",
"0.6972568",
"0.69676083",
"0.6949749",
"0.6949619",
"0.6943386",
"0.692872",
"0.692616",
"0.69220835",
"0.69186485",
"0.69128555",
"0.68916076",
"0.6890777",
"0.6875479",
"0.685323",
"0.68514514"
] |
0.0
|
-1
|
POST /events POST /events.json
|
def create
#creating new event with parameters
@event = Event.new(event_params)
#set the new event's current user and register
@event.User= current_user
@event.Register = Register.where(:name => @event.pet_name).first
# Start of the addition of records to food table
#counters= starting/ending dates.
#time is the dy and time for feeding to happen.
counter = @event.starts_at
counter2= @event.ends_at
time = @event.time
while counter<=counter2 do
counter=counter+1.day
time =time+1.day
amount_inbowl= @event.amount
ate_random= Random.rand(amount_inbowl)
left = amount_inbowl-ate_random
Food.create(:Register => Register.where(:name =>
@event.pet_name).first, :weight => amount_inbowl, :User => @event.User ,:date => counter,
:ate => ate_random, :leftovers => left, :time => time)
end
# end of adding records to food table , Karim Farid.
#Check conditions for creating events
buddy_pet = Buddy.where(:user => current_user, :register => @event.Register).first
if !editing_destroying_filter_condition then
flash[:notice] = "Check pet's name is correct or you can create events for this pet!"
redirect_to new_event_path
else
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render :show, status: :created, location: @event }
else
format.html { render :new }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n megam_rest.post_event(to_hash)\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end",
"def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end",
"def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end",
"def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_events\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @myevent = Myevent.new(params[:myevent])\n\n respond_to do |format|\n if @myevent.save\n format.html { redirect_to @myevent, notice: 'Myevent was successfully created.' }\n format.json { render json: @myevent, status: :created, location: @myevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036",
"0.7081109",
"0.7080767",
"0.7071589",
"0.7057984",
"0.70422375",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7016941",
"0.70167124",
"0.70091015",
"0.70081246",
"0.6989661",
"0.6987218",
"0.6970633",
"0.6970633",
"0.6966775",
"0.6948742",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6948119",
"0.6942416",
"0.6936477",
"0.69359535",
"0.69359535",
"0.69318086",
"0.69268054",
"0.6907236",
"0.6905569",
"0.69051725",
"0.6904514",
"0.6902843",
"0.69011873",
"0.6899826",
"0.68961006",
"0.68811166",
"0.68746495",
"0.68642014",
"0.68642014",
"0.6843213",
"0.68419445",
"0.6836244",
"0.68352246",
"0.6820027",
"0.68000513",
"0.6791519"
] |
0.0
|
-1
|
PATCH/PUT /events/1 PATCH/PUT /events/1.json
|
def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html {redirect_to @event, notice: 'Event was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: events_path(@event) }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def update\r\n respond_to do |format|\r\n if @event.update(event_params)\r\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7530572",
"0.7372185",
"0.7176736",
"0.71718925",
"0.7170657",
"0.71421736",
"0.70964724",
"0.70826703",
"0.70826703",
"0.7057757",
"0.7020474",
"0.69892836",
"0.6982003",
"0.69780517",
"0.69597894",
"0.695393",
"0.695393",
"0.6951616",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6921028",
"0.6915807",
"0.6893842",
"0.68831456",
"0.6878714",
"0.68630654",
"0.6858261",
"0.6854892",
"0.6853255",
"0.68461496",
"0.68461496",
"0.68461496",
"0.68397784",
"0.6839455",
"0.6835116",
"0.6824558",
"0.6816245",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.6813774",
"0.68115985",
"0.6807376",
"0.6792763",
"0.6792763",
"0.6792763",
"0.6792763",
"0.6792763",
"0.6792763",
"0.6792763",
"0.6792763",
"0.6789319",
"0.67813647",
"0.6776028"
] |
0.0
|
-1
|
DELETE /events/1 DELETE /events/1.json
|
def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end",
"def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html {redirect_to events_url}\n format.json {head :no_content}\n end\n end",
"def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end",
"def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: t(:event_deleted) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Мероприятие успешно удалено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = current_user.events.find_by_url(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to eventos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eventtype.events.each do |e|\n e.destroy\n end\n @eventtype.destroy\n respond_to do |format|\n format.html { redirect_to eventtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @event.destroy \n respond_to do |format|\n format.html { redirect_to events_url, success: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.mobile { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @create_event = CreateEvent.find(params[:id])\n @create_event.destroy\n\n respond_to do |format|\n format.html { redirect_to create_events_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7693224",
"0.76886576",
"0.76886576",
"0.76886576",
"0.7681075",
"0.7586044",
"0.7569",
"0.7561319",
"0.7541495",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7540414",
"0.75390416",
"0.75378317",
"0.7527901",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7520685",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.7515363",
"0.74965996",
"0.746597",
"0.74608785",
"0.7454681",
"0.7447546",
"0.7440987",
"0.7440808",
"0.74354243",
"0.74334484",
"0.7402408",
"0.738834",
"0.737868",
"0.7372888",
"0.73655",
"0.7339261",
"0.73236173",
"0.7300774",
"0.7297619",
"0.7291121",
"0.7291078",
"0.7289857",
"0.72875506",
"0.7285632",
"0.7284554",
"0.72833604",
"0.7273459",
"0.7270107"
] |
0.73361975
|
88
|
Use callbacks to share common setup or constraints between actions.
|
def set_event
@event = Event.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def 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 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 action\n end",
"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 setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] |
[
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] |
0.0
|
-1
|
find the current user's pet.
|
def pet
current_user.registers.find_by name: @event.pet_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_pet\n @pet = current_user.pets.find(params[:id])\n end",
"def current_poet\n Poet.find_by(id: session[:user_id])\n end",
"def set_user_pet\n @user_pet = UserPet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find_by_id(params[:id]) || Pet.find_by(name: params[:search_query], user_id: current_user.id)\n end",
"def find_pet\n redirect_to pet_path(@pet) if @pet\n end",
"def has_pet?\n current_user_pet && current_user_pet != nil\n end",
"def show\n @title = @pet.name + ' | Mascotas' \n @owner = User.find(@pet.user_id)\n end",
"def show\n\n if !params[:id].nil?\n pet = Pet.find_by_id(params[:id])\n if pet\n render json: pet, include: :user, status: :ok\n else\n render json: {message: 'Pet doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting pet detail, please try it again'}, status: :bad_request\n end\n end",
"def show\n # render plain: params\n @owner = User.find_by_id(params[:id])\n # render plain: @owner.first_name\n @owner_pet [email protected]\n # if @owner_pet.exists?\n # render plain: @owner_pet[0].name\n # else\n # render plain: \"This user has no pets :(\"\n # end\n end",
"def show\n @pet = Pet.find(params[:id])\n end",
"def choose_pet\n \n selected_pet = \"\" \n print(\"Enter pet name: \")\n selected_pet = gets.chomp\n\n until @pets.member?(selected_pet.to_sym) do\n puts(\"That pet not found. Please try again.\")\n print(\"Enter pet name: \")\n selected_pet = gets.chomp\n end\n\n return @pets[selected_pet.to_sym]\n end",
"def show\n @pet = Pet.find_by id: params[:id]\n end",
"def current_petsitter\n\n petsitterobjectview = Petsitter.find_by(id: session[:petsitter] )\n return petsitterobjectview\n \n end",
"def show\n # load all that users pets\n @pets = @user.pets.page(params[:page]).per(3)\n end",
"def index\n @pets = current_user.pets.all\n end",
"def love_pet\n puts \"#{@name} loves their pet #{pet.name} so much.\"\n end",
"def set_pet\n @pet = Pet.friendly.find(params[:id])\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n if session[:user_id]\n User.find_by({ id: session[:user_id] })\n else\n Dog.find_by({ id: session[:dog_id] })\n end\n end",
"def find_pet_by_name(petshop,pet_name)\n for pet_hash in petshop[:pets] do \n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n return nil\n end",
"def find_pet_by_name(pet_shop, name)\n pet_shop[:pets].each do |pet|\n return pet if pet[:name] == name\n end\n return nil\n end",
"def find_pet_by_name(pets, pet_name)\n for pet in pets[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(petshop,pet_name)\n petshop[:pets].each do \n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n return nil\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def create\n @pet = current_user.pets.new(pet_params)\n\n # TODO wipe this out later \n # This assigns pet to user\n # @current_user = current_user\n # @current_user.pets << @pet\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def current_foodie\n # User.find would throw an error if we cannot find the user\n Foodie.find_by({ id: session[:foodie_id] })\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n return pet_shop[:pets][3]\nend",
"def best_friend_name\n # what is self? self is a pet instance ===> self.owner\n # what is self.owner? an user instance ===> so i can use User instance methods\n # self.owner.name\n # PROCESS!!!! what is the thing you have access to? What methods can you call? which will be useful here? \n if self.owner\n self.owner.name\n else\n nil\n end\n # tech debt - if owner is nil this will throw an error! \n end",
"def find_pet_by_name(pet_shop, name)\n pet = nil\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop[:name] == name\n pet = l_pet_shop\n end\n end\n return pet\nend",
"def set_battle_pet\n @battle_pet = BattlePet.where(id: params[:id]).first || BattlePet.where(name: params[:id]).first\n end",
"def set_pet\n @pet = Pet.find_by!(id: params[:pet_id])\n end",
"def find_pet_by_name(pet_shop, pet_name)\n\n for pets in pet_shop[:pets]\n\n if pets[:name] == pet_name\n\n\n return pets\n\n end\n end\n\n return\n end",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n return pet if pet[:name] == pet_name\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, supplied_name)\n for pet in pet_shop[:pets]\n return pet if supplied_name == pet[:name]\n end\n return nil\nend",
"def set_petprofile\n @petprofile = Petprofile.find(params[:id])\n end",
"def find_pet_by_name(shop, name)\n\n pets = shop[:pets]\n for pet in pets\n if pet[:name] == name\n return pet\n end\n end\n nil\nend",
"def find_pet_by_name(petshop, name)\n for pet in petshop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def set_pet\n @pet = params[:id] ? Pet.find(params[:id]) : Pet.new\n end",
"def find_pet_by_name(shop, pet_name)\n for pet in shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name (shop,pet_name)\n for pet in shop[:pets]\n if pet[:name] == pet_name\n return pet\n # else\n end\n end\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet\n return pet\n else return nil\n end\nend\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n # else\n # return nil\n end\n end\n return\nend",
"def find_pet_by_name(pet_shop,pet_name)\n #if pet matches a name in the hash\n #return the hash of information\n match = nil\n for pet in pet_shop[:pets]\n match = pet if(pet[:name] == pet_name)\n end\n return match\n end",
"def show\n @team = Team.find(params[:id])\n @team_pets = @team.pets\n if @team_pets.length > 0\n @pets = current_user.pets.where('id not in (?)', @team_pets)\n else\n @pets = current_user.pets\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def find_pet_by_name(shop,name)\n pet_name = nil ##sets pet_name to nil to ensure nil is returned if pet name is not found. (Ruby will return nil anyway if not found, but good practice to ensure it's correct)\n for pet in shop[:pets]\n if pet[:name] == name\n pet_name = pet\n end\n end\n return pet_name\nend",
"def pets\n @pets\n end",
"def show\n @pet_status = PetStatus.find(params[:id])\n\n end",
"def users_pet\n return \"Few Lines on my pet.\\nI have a #{@pet_name} at my home.\\nIt is #{@pet_size} in size.\\nIt has #{@pet_color} color.\\nIt is #{@pet_class} animal.\"\n end",
"def index\n @pets = []\n if current_user.role.name != 'cliente'\n @pets = Pet.all\n else\n if !current_user.nil?\n id = current_user.data_id\n if !id.nil?\n @client = Client.find(id)\n @pets = @client.pets\n end\n end\n end\n end",
"def pets\n pet_owners.map do |pet_owner|\n pet_owner.pet\n end\n end",
"def find_pet_by_name(shop_hash, name_of_pet)\n for pet in shop_hash[:pets]\n if (pet[:name] == name_of_pet)\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(shop, pet_name)\n for name in shop[:pets]\n if name[:name] == pet_name\n return name\n end\n end\n return\nend",
"def find_pet_by_name(pet_shop, pet_name)\n for item in pet_shop[:pets]\n if item[:name] == pet_name\n return item\n end\n end\n return nil\nend",
"def show\n session[:pet_id] = @pet.id\n end",
"def create \n @pet = Pet.new(pet_params)\n @pet.user = @user\n \n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def busca_por_pet_id(pet_id) \n uri = \"#{ENV['BASE_URI']}/pet/#{pet_id}\"\n \n without_authentication('get', uri)\n end",
"def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end",
"def find_pet_by_name(section, name)\n for pet in section[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(shop, name)\n\n for pet in shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\n\nend",
"def participant\n market.participants[env['REMOTE_USER'].to_i]\n end",
"def create\n# @pet = Pet.new(pet_params)\n@pet = current_user.pets.create(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Has registrado a tu mascota' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_member\n @trello.find_member_by_username(users[@selected_commander][:trello_name])\n end",
"def current_opponent\n Opponent.find_by_id(session[:opponent_id])\n end",
"def current_person\n current_user\n end",
"def user_pet_params\n # params[:user_pet]\n params.require(:user_pet).permit(:user_id, :pet_id)\n end",
"def current_utente\n @current_utente ||= Utente.find_by(username: session[:user_id])\n end",
"def new\n @user = current_user\n @pet = @user.pets.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pet }\n end\n end",
"def find_pet_by_name(pet_shop, name)\n pets = pets\n for pet in pet_shop[:pets]\n if pet[:name] == name\n pets = pet\n nil\n end\n end\n return pets\nend",
"def show\n pet = BattlePet.find(params[:id])\n render json: pet, status: :ok\n end",
"def set_postulation_pet\n @postulation_pet = PostulationPet.find(params[:id])\n end",
"def set_owner\r\n @dog = User.find(params[:id])\r\n end",
"def create\n @pet = Pet.new(pet_params)\n @pet.user_id = current_user.id\n @pet.latitude = current_user.latitude\n @pet.longitude = current_user.longitude\n respond_to do |format|\n if @pet.save\n pet = Pet.find(@pet.id)\n user = User.find(current_user.id)\n format.html { redirect_to @pet, notice: 'Mascota fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end"
] |
[
"0.7257758",
"0.69890344",
"0.69475734",
"0.6631307",
"0.6489425",
"0.6488103",
"0.64471835",
"0.6416743",
"0.6375749",
"0.6352011",
"0.63470936",
"0.6343452",
"0.6283378",
"0.6264878",
"0.6215299",
"0.6207989",
"0.61914",
"0.6186527",
"0.61364883",
"0.61325055",
"0.6121434",
"0.6116024",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6107411",
"0.6080889",
"0.60243773",
"0.60243773",
"0.60198927",
"0.60198927",
"0.6009112",
"0.599857",
"0.599857",
"0.5993703",
"0.59916514",
"0.5986837",
"0.5977123",
"0.59770304",
"0.59604603",
"0.5931834",
"0.5914655",
"0.5911538",
"0.5896445",
"0.58963984",
"0.5896324",
"0.58748347",
"0.5868054",
"0.5857742",
"0.58523387",
"0.5846832",
"0.5846153",
"0.58399254",
"0.583214",
"0.5829889",
"0.5824964",
"0.58231556",
"0.5813522",
"0.57929844",
"0.5783893",
"0.5769648",
"0.57669276",
"0.5749654",
"0.5720173",
"0.5719345",
"0.5706857",
"0.5703348",
"0.57008946",
"0.5699252",
"0.56885046",
"0.5664911",
"0.5663826",
"0.56579274",
"0.56477904",
"0.56356347",
"0.56265163",
"0.5620804",
"0.5593091",
"0.5592492",
"0.55811656",
"0.557554",
"0.5572731",
"0.557219",
"0.5557696"
] |
0.77955025
|
0
|
Never trust parameters from the scary internet, only allow the white list through.
|
def event_params
params.require(:event).permit(:pet_name, :amount, :starts_at, :ends_at, :time)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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 pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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 get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] |
0.0
|
-1
|
condition for creating, editing, destroying privilages.
|
def editing_destroying_filter_condition
buddy_pet = Buddy.where(:user => current_user, :register => @event.Register).first
(([email protected]? && @event.Register.User == current_user) || (!buddy_pet.nil? && buddy_pet.can_schedule))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def permitted?; end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def put_can_create?\n false\n end",
"def can_destroy? user\n self.un_submit? and user.person==self.person\n end",
"def can_edit\n producer.admin?(user) || group_admin?\n end",
"def can_destroy?(someone)\n can_edit? someone\n end",
"def can_edit?(user)\n user && self.creator_id == user.id\n end",
"def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def create?\n @current_user.permission('Ration', :clerk)\n end",
"def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def editable_by?(user)\n \tuser && user == owner\n\tend",
"def update?\n user_is_owner? || user_is_admin?\n end",
"def update_permitted?\n\t\tacting_user.administrator?\n\tend",
"def update?\n owner? || user.is?(:admin)\n end",
"def destroy?\n @current_user.permission('Bid', :clerk)\n end",
"def create?\n record.resourceable.owner == user || user.is?(:admin)\n end",
"def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end",
"def deletion_permitted?\n permitted = false\n permitted = true if self.status.nil? || self.status == 'u'\n permitted\n end",
"def create?\n @current_user.permission('Donor', :clerk)\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\n # - could be clicked accidentally\n # - would be very infrequently used (if ever)\n # - implications of edit are unclear for associated actions\n # - create is meaningless without associating actions which happens in code.\n can [:read, :add_user, :remove_user], Role\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def create?\n @current_user.permission('Commodity', :clerk)\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def created_or_admin(obj)\n if session[:person].id.to_i == obj.creator_id.to_i || session[:person].is_admin\n true\n else\n false\n end\n end",
"def company_edit_permitted?\n acting_user.administrator? || same_company\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def auth_create_filter\n if not self.class.allowed_to_create\n false\n else\n true\n end\n end",
"def destroy?\n @user.nil? ? group = Group.find_by(name: 'public') : group = @user.group\n set_permission = group.permissions.pluck('name').include? 'event pilot signup delete'\n if @record\n set_permission || @user == @record.user\n else\n set_permission\n end\n end",
"def update?\n @current_user.permission('Bid', :clerk)\n end",
"def define_eccept\n if [email protected] || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end",
"def allowed_to_destroy \n allowed_to_save\n end",
"def is_allowed_to_edit?(person)\n if person.id == item_owner.id && status.eql?(\"pending_owner\")\n return true\n elsif person.id != item_owner.id && status.eql?(\"pending_reserver\")\n return true\n end\n return false \n end",
"def can_be_modified_by?( user )\n return false if ( user.restricted? )\n return true if ( user.admin? )\n return self.active\n end",
"def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end",
"def create?\n @current_user.permission('Fdp', :clerk)\n end",
"def new?\n super && !user.admin? && not_a_visitor && !user_has_other_application?\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def destroy?\n user_is_owner_or_admin?\n end",
"def update?\r\n admin? or own? or invited?\r\n end",
"def update?\n user_is_owner_or_admin?\n end",
"def update?\n user_is_owner_or_admin?\n end",
"def update?\n user_is_owner_or_admin?\n end",
"def write_permitted?\n return acting_user.administrator?\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def create?\n user.role == \"Envio\" || user.role == \"Cadastro\" || user.admin?\n end",
"def creatable_by?(creator)\n creator.administrator? || !administrator\n end",
"def check_permission\n raise ActiveRecord::RecordNotFound if self.user.nil?\n raise ActiveRecord::RecordNotFound if self.group.nil?\n return true if !group.group_type.is_approval_required && self.user.can_join_groups?\n return true if (self.is_user_invited? || self.is_request_approved?) && self.user.can_join_groups?\n raise ApiAccessEvanta::RecordOutOfScope if self.group.secret? && !self.is_user_invited?\n raise ApiAccessEvanta::PermissionDenied\n end",
"def creation_allowed_only?\n creation_allowed? && !(\n programme_administrator_logged_in? ||\n Programme.site_managed_programme.present?\n )\n end",
"def can_edit?(user)\n\n end",
"def regenerate?\r\n admin? or own? or invited?\r\n end",
"def user_can_delete?\n false\n end",
"def can_edit?\n return !@energy_usage.approved? || current_user.manager? \n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def person_can_be_removed?\n !person.me? || User.current_user.is_admin? || person.is_programme_administrator?(project.programme)\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def destroy?\n @current_user.permission('Ration', :clerk)\n end",
"def may_create_groups?\n\t\t\tmay_administrate?\n\t\tend",
"def destroy?\n owner? || user.is?(:admin)\n end",
"def editable_by?(user)\n if self.status == :private\n self.user == user || self.featurings.map(&:user).include?(user)\n elsif status == :temporary\n true # XXX FIXME SECURITY HOLE RIGHT HERE: ANY USER CAN MODIFY TEMP SONGS FIXME\n elsif status == :public\n false\n end\n end",
"def image_editor_permissions\n ephemera_permissions\n can [:read, :create, :modify, :update, :publish], curation_concerns\n can [:create, :read, :edit, :update, :publish, :download, :derive], FileSet\n can [:create, :read, :edit, :update, :publish], Collection\n\n # do not allow completing resources\n cannot [:complete], curation_concerns\n\n # only allow deleting for own objects, without ARKs\n can [:destroy], FileSet do |obj|\n obj.depositor == [current_user.uid]\n end\n can [:destroy], curation_concerns do |obj|\n obj.depositor == [current_user.uid]\n end\n cannot [:destroy], curation_concerns do |obj|\n !obj.try(:identifier).blank?\n end\n end",
"def destroy?\n user_is_owner_or_admin?\n end",
"def smart?; self.permission_level = 2; end",
"def create_permitted?\n\t\tif acting_user.guest?\n\t\t\tfalse\n\t\telsif acting_user.administrator?\n\t\t\ttrue\n\t\telse\n\t\t\treturn (0 < acting_user.countries.length())\n\t\tend\n\tend",
"def destroy?\n user.admin_or_owner?\n end",
"def image_editor_permissions\n can [:read, :create, :modify, :update, :publish], curation_concerns\n can [:create, :read, :edit, :update, :publish, :download], FileSet\n can [:create, :read, :edit, :update, :publish], Collection\n\n # do not allow completing resources\n cannot [:complete], curation_concerns\n\n # only allow deleting for own objects, without ARKs\n can [:destroy], FileSet do |obj|\n obj.depositor == [current_user.uid]\n end\n can [:destroy], curation_concerns do |obj|\n obj.depositor == [current_user.uid]\n end\n cannot [:destroy], curation_concerns do |obj|\n !obj.identifier.blank?\n end\n end",
"def editable_by?(user)\n !shipped? && !delivered?\n end",
"def update?\n edit? || owner?\n end",
"def creatable_by?(user)\n user.administrator?\n end",
"def canDelete?(user=current_user,owner=nil)\n return false if user.nil?\n #Rails.logger.debug(\"I got owner as #{owner.name} and user as #{user.name}\")\n return true if self.isAdmin?(user)\n false\n end",
"def edit_grade_levels?\n edit_settings? || owner?\n end",
"def authorization(action, object = \"default - missing something?\")\n if action == \"create\"\n not_authorised and return unless current_user.can_create?\n elsif action == \"update\"\n not_authorised and return unless current_user.can_update?(object)\n elsif action == \"destroy\"\n not_authorised and return unless current_user.can_destroy?(object)\n elsif action == \"owner\"\n not_authorised and return unless current_user.owner?(object)\n elsif action == \"admin\"\n not_authorised and return unless current_user.admin_only\n end\n end",
"def can_edit_delete_update_problem\n\t\tunless current_user==Problem.find(params[:id]).creator || current_user.admin?\n\t\t\tflash[:danger] = \"You are not allowed to edit/delete this problem\"\n redirect_to root_path\n\t\tend\t\t\t\n\tend",
"def can_modify\n\t\tself.changed_attributes.each do |attr|\n\n\t\t\tif attr.to_s == \"reports\"\n\t\t\t\tself.reports.each do |r|\n\t\t\t\t\tunless r.changed_attributes.blank?\n\t\t\t\t\t\tif r.owner_ids.include? self.created_by_user_id\n\t\t\t\t\t\telsif r.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.errors.add(:reports,\"You cannot edit #{attr.name.to_s}\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\n\t\t\telsif attr.to_s == \"recipients\"\n\t\t\t\trecipients_changed\n\t\t\telsif attr.to_s == \"payments\"\n\t\t\t\told_payment_not_deleted\n\t\t\telse\n\t\t\t\t## only in case of \n\t\t\t\tif self.owner_ids.include? self.created_by_user.id.to_s\n\t\t\t\telsif self.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\telse\n\t\t\t\t\tself.errors.add(:owner_ids,\"You cannot edit the field: #{attr.to_s}\")\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\tend",
"def not_last_owner?\n if self.role == \"Member\" || project.memberships.where(role: \"Owner\").count > 1\n true #before_destroy will delete\n else\n false #before_destroy won't delete\n end\n end",
"def can_be_modified_by?( user )\n if ( user.admin? )\n true\n elsif ( user.manager? )\n ( user.id == self.user.id ) or ( not self.committed )\n else\n ( user.id == self.user.id ) and ( not self.committed )\n end\n end",
"def update?\n @current_user.permission('Ration', :clerk)\n end",
"def creatable_by?(user)\n true\n end",
"def expire_guest?\r\n admin? or own? or invited?\r\n end",
"def check_resource_ownership\n if admin_user.is_not_root?\n\n condition_typus_users = @item.respond_to?(Typus.relationship) && [email protected](Typus.relationship).include?(admin_user)\n condition_typus_user_id = @item.respond_to?(Typus.user_foreign_key) && !admin_user.owns?(@item)\n\n not_allowed if (condition_typus_users || condition_typus_user_id)\n end\n end",
"def update?\n user_is_owner_or_admin?\n end",
"def create?\n @current_user.permission('Department', :clerk)\n end",
"def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end",
"def permissions_policy(&block); end",
"def can_edit?\n head(:forbidden) unless current_user.review_space_admin? || @space.editable_by?(current_user)\n end",
"def can_create? cuser\n cuser and cuser.admin? or cuser.groups.exists? :id => Group::MOVIES\nend",
"def check_update_permission\n return if owner? || @article.is_public_editable\n redirect_to articles_url\n end",
"def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end",
"def prevent_manager_removal(resource, permission)\n permission.access_type==Policy::MANAGING && permission.contributor==current_user.person && resource.contributor != current_user\n end",
"def create?\n !@current_user.admin?\n end",
"def update?\n # the edit here refers to the edit in material_shared_policy\n # that edit lets any admin, project_admin, or material_admin to edit the material\n # admins and material_admins makes sense in this case. project_admins require access\n # so they can update project and project cohorts of materials they aren't the owner of\n # and are not part of their project yet\n # This is needed when there are multiple authors on a project. An non project admin\n # author creates the material. Then the project admins needs to find it and mark\n # configure the advanced configuration options. Otherwise a portal admin needs to\n # get involved.\n edit? || owner?\n end",
"def editable_by?(user)\n\t \t# user && user == owner\n\t user == user\n \tend",
"def permit?(action, member)\n case action\n when :destroy\n member.membership_active? && member.is_admin?\n end\n end",
"def permission_required \n render_403 unless admin? || @user == current_user\n end",
"def can_create_opinion_from_admin?\n toggle_allow(admin_creation_is_enabled?) if permission_action.subject == :opinion\n end"
] |
[
"0.66528875",
"0.6462354",
"0.64532983",
"0.64038527",
"0.6397447",
"0.6326881",
"0.62941253",
"0.629344",
"0.6265116",
"0.62566596",
"0.62420607",
"0.62340254",
"0.62340254",
"0.62340254",
"0.62340254",
"0.618461",
"0.61804456",
"0.6167035",
"0.6161301",
"0.6161017",
"0.6147886",
"0.61418366",
"0.6140836",
"0.61398214",
"0.6136788",
"0.6131648",
"0.6129504",
"0.6129504",
"0.6129504",
"0.6127618",
"0.6117236",
"0.6113849",
"0.6102785",
"0.6096341",
"0.6091826",
"0.60864866",
"0.6084986",
"0.6082487",
"0.6076002",
"0.6072325",
"0.60692346",
"0.60559976",
"0.6055394",
"0.6038846",
"0.60264033",
"0.6023287",
"0.6023287",
"0.6023287",
"0.601244",
"0.6010379",
"0.6009664",
"0.600477",
"0.6004018",
"0.598746",
"0.5984303",
"0.5983498",
"0.59762555",
"0.597483",
"0.5973904",
"0.59691596",
"0.5969086",
"0.5967035",
"0.5962236",
"0.5957241",
"0.5954837",
"0.5945276",
"0.5938571",
"0.59327084",
"0.5928643",
"0.5928439",
"0.5923694",
"0.59231246",
"0.59187967",
"0.5915847",
"0.5914145",
"0.5912696",
"0.5912326",
"0.59120095",
"0.5910753",
"0.5899357",
"0.5899337",
"0.5890331",
"0.588792",
"0.58817685",
"0.5879063",
"0.58762854",
"0.5874737",
"0.5868431",
"0.5853892",
"0.5853755",
"0.5850954",
"0.58427894",
"0.5837736",
"0.5837227",
"0.5829343",
"0.5829213",
"0.58280945",
"0.5824192",
"0.58233446",
"0.58214146"
] |
0.609196
|
34
|
filter for creating, editing and destroying
|
def editing_destroying_filter
unless editing_destroying_filter_condition
flash[:notice] = "You're not authorized to edit or delete!"
redirect_to events_path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filter\n end",
"def filter\n super\n end",
"def filters\n end",
"def filters; end",
"def filters; end",
"def destroy_filter\n not actuale?\n end",
"def filter(options={})\n super\n end",
"def filters\n [\n [\"Id\", \"id\"],\n [\"Added By\", \"created_by\"], \n [\"Updated By\", \"updated_by\"]\n ]\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def filter\n @filter\n end",
"def apply_filter\n end",
"def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end",
"def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end",
"def execute()\n filters = prepare_filters\n return_filtered_model(filters)\n end",
"def filter_params\n params.require(:filter).permit(:title, :department, :user, :commit)\n end",
"def add_filter\n @filter = true \n end",
"def update!(**args)\n @filter_created = args[:filter_created] if args.key?(:filter_created)\n @filter_deleted = args[:filter_deleted] if args.key?(:filter_deleted)\n @filter_id = args[:filter_id] if args.key?(:filter_id)\n end",
"def filter_params\n params.require(:filter).permit(:template, :name, :code)\n end",
"def filter_params\n params.require(:filter).permit(:name, :slug)\n end",
"def destroy\n if params[:id] != '-1'\n @filter = Filter.find(params[:id])\n else\n @filter = Filter.where( :name => params[:filter][:name], :group => params[:filter][:group], :pattern => params[:filter][:pattern] ).first\n end\n\n Auditlog( self.class.name, @filter )\n\n if @filter\n @filter.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to filters_url }\n format.json { head :no_content }\n end\n end",
"def filter(record)\n true\n end",
"def create\n @filter = Filter.find_or_create_by_name( params[:filter][:name], :group => params[:filter][:group], :pattern => params[:filter][:pattern] )\n\n Auditlog( self.class.name, @filter )\n\n respond_to do |format|\n if @filter\n format.html { redirect_to @filter, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def create\n \t@query = current_user.queries.find(params[:query_id])\n @filter = current_user.queries.find(params[:query_id]).filters.new(params[:filter])\n\n respond_to do |format|\n if @filter.save\n format.html { redirect_to @query, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def filter!(filter)\n # {:scope => :transaction, :merchant => { :matcher => 'ATM WITHDRAWAL' }}\n # {:scope => :collection, :name => :credit_card_payments }\n @transactions.reject! do |t|\n t.send(filter[:field]).downcase == filter[:matcher].downcase\n end\n end",
"def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end",
"def filter(name, function)\n design_doc.create_filter(name, function)\n end",
"def editing_destroying_filter_condition\n buddy_pet = Buddy.where(:user => current_user, :register => @event.Register).first\n (([email protected]? && @event.Register.User == current_user) || (!buddy_pet.nil? && buddy_pet.can_schedule))\n end",
"def filter_params\n params.require(:filter).permit(:name, :description, :opt_in)\n end",
"def edit\n\n @filters = @user.user_filters\n @filter = UserFilter.new\n @parent = @user\n @survey = @user.current_survey\n\n end",
"def index\n allowed_items = get_allowed_item_types(current_container)\n @actions = NotificationFilter.actions\n #select just allowed objects in configuration \n @models = NotificationFilter.models.delete_if{ |m| !allowed_items.include?(m.name) } \n @filters = @user.notification_filters || {}\n end",
"def filter_params\n params.require(:filter).permit(:name, :brand, :description, :notes)\n end",
"def filter\n\t\treturn @filter\n\tend",
"def filter(objects) objects end",
"def entry_filter; end",
"def index\n\n if ! params[\"template_id\"].nil?\n\n @template = Template.find(params[\"template_id\"])\n\n if ! @template.nil?\n\n @filters= Filter.where(\"template = ?\",params[\"template_id\"])\n\n end\n\n end\n\n if @filters.nil?\n\n @filters = Filter.all\n\n end\n\n end",
"def filter!; end",
"def filters\n @filters ||= {}\n end",
"def prepare_filters\n params = instance_values.symbolize_keys\n filters = clean_params(params)\n validate_filters(filters)\n end",
"def filter(player)\n \tfilters = players.select{|player| player.position == position}\n \tif(filters.count>0) \n \t\treturn true\n \telse\n \t\treturn false;\n end\n\n def create_player(name,position)\n \tif (filter(Player.new(name,position)) == false)\n \t\tPlayer.new(name,position)\n \tend\n end\n\nend",
"def filter(filter)\n current_widget.filter filter\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def filter_params\n params.require(:filter).permit(:name)\n end",
"def only *filter_list\n filter.only filter_list\n self\n end",
"def create\n @query_filter = QueryFilter.new(params[:query_filter])\n @query_filter.owner = @account\n \n respond_to do |format|\n if @query_filter.save\n flash[:notice] = 'Filter was successfully created.'\n format.html { redirect_to(account_path(@account)) }\n format.xml { render :xml => @query_filter, :status => :created, :location => [@account, @query_filter] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query_filter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def filterable?; @filterable; end",
"def validate_filter\n ensure_filter_only_attributes\n ensure_no_unsupported_filters\n end",
"def filter(options={})\n raise NotImplementedError\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def _filter r, options\n return r if params[:f].blank?\n return resource_class.filter r, params[:f], options if resource_class.respond_to? :filter\n r\n end",
"def set_filter\n @filter = Filter.friendly.find(params[:id])\n end",
"def cache_content_filter_data\n if name && name_id_changed?\n self.lifeform = name.lifeform\n self.text_name = name.text_name\n self.classification = name.classification\n end\n self.where = location.name if location && location_id_changed?\n end",
"def named_filter; end",
"def Filter=(arg0)",
"def allowed_filterables\n %i[created_at updated_at name].freeze\n end",
"def filter_for(item)\n self.class.filter_for filter, item\n end",
"def server_object_filter\n self.parameters[:object_filter].to_h if self.parameters.has_key?(:object_filter)\n end",
"def after_update\n super\n clear_instance_filters\n end",
"def filter_index\n filter\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def filter_params ownerable\n params = ActionController::Parameters.new(self.class.name_to_sym => self.attributes)\n permitted_params = PermittedParams.new(params, ownerable)\n permitted_params.filter_for self\n end",
"def filtered_attributes(keys,scope)\n case scope\n when :new\n %i( id date catalogs catalog_definitions treatments complete just_created )\n when :existing\n keys\n else\n keys - %i( catalog_definitions )\n end\n end",
"def new\n @filter = Object::Filter.new\n @filter.source = @source\n\n if params[:positive] == 'false'\n @filter.positive = false\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filter }\n end\n end",
"def filter\n @filter = params[:q]\n end",
"def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @widgets = Widget.active.popular.find(:all,{}, {:conditions => @conditions, :include => @included}) \n\r\n \n #generate filters for results\n filter_headings(Widget, @widgets)\n\n ...\n\r\n end\n\n\n....\n\n\nend",
"def filters\n self.class.filters\n end",
"def filtering_params(params)\n params.slice(:id, :tipo)\n end",
"def record_filter_params\n permitted_params = [\n :name,\n :record_created_by,\n :is_destroyed,\n :record_created_on,\n :record_created_after,\n :record_created_before,\n :filename,\n :file_content_type,\n :file_size,\n :file_size_less_than,\n :file_size_greater_than,\n :file_md5hashsum,\n project_affiliation_filter_term_attributes: [:id, :project_id, :_destroy],\n annotation_filter_terms_attributes: [:id, :created_by, :term, :context, :_destroy]\n ]\n params.require(:record_filter).permit(permitted_params)\n end",
"def filter!(options)\n @list = ObjectsFilter.new(all, options).objects\n index_by_fullname\n end",
"def filter\n params.merge!(user_id: session[:user_id])\n case params[:filter_select]\n when gender_and_location_filter\n @posts = Post.filter_by_gender(post_filter_params).filter_by_location(post_filter_params)\n when pace_filter\n @posts = Post.filter_by_pace(post_filter_params)\n when age_filter\n @posts = Post.filter_by_age(post_filter_params)\n when time_filter\n @posts = Post.filter_by_time(post_filter_params)\n when commitment_filter\n @posts = Post.filter_by_commitment(post_filter_params)\n end\n\n render json: @posts, each_serializer: PostSerializer\n end",
"def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n end",
"def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n end",
"def create_with_scope(name)\n attribute = self.attribute\n lambda {|model, values| model.filter(attribute.to_sym => values)}\n end",
"def new\n @query_filter = QueryFilter.new\n @query_filter.owner = @account \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query_filter }\n end\n end",
"def filtered_entries; end",
"def set_filter\n @filter = Filter.find(params[:id])\n end",
"def set_filter\n @filter = Filter.find(params[:id])\n end",
"def set_filter\n @filter = Filter.find(params[:id])\n end",
"def filter(collection)\n collection\n end",
"def filter(collection)\n collection\n end",
"def populate_filters(_inputs)\n super.tap do\n self.class.filters.each do |name, filter|\n next if given?(name)\n\n model_field = self.class.model_field_cache_inverse[name]\n next if model_field.nil?\n\n value = public_send(model_field)&.public_send(name)\n public_send(\"#{name}=\", filter.clean(value, self))\n end\n end\n end",
"def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @object_type = args[:object_type] if args.key?(:object_type)\n end",
"def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @object_type = args[:object_type] if args.key?(:object_type)\n end",
"def filter_argument; end",
"def filtering_params(params)\n\t\t params.slice(:name, :category_id, :trademark)\n\t\tend",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def index\n case params[:filter].to_s\n when 'my'\n authorize Group.new(:owner_id => current_user.id), :update?\n @groups = Group.where(:owner_id => current_user.id)\n else\n authorize Group.new, :update?\n @groups = Group.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def new\n @game = current_user.games.build\n @filters = Filter.all.map{ |c| [c.name, c.id] }\n end",
"def create_without_scope(name)\n attribute = self.attribute\n lambda {|model, values| model.filter(~{attribute.to_sym => values})}\n end",
"def update\n @filter = Filter.find(params[:id])\n\n Auditlog( self.class.name, @filter )\n\n respond_to do |format|\n if @filter.update_attributes(params[:filter])\n format.html { redirect_to @filter, notice: 'Filter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_filters(filters); end",
"def index\n @selected_filters = Hash.new\n @events = Event.all\n if params[:filter]\n if params[:filter][:my]\n @events = @events.user_events current_user\n @selected_filters[:my] = 1\n end\n if params[:filter][:all]\n @selected_filters[:all] = 1 \n else\n @selected_filters[:recent] = 1 \n @events = @events.after\n end \n else\n @events = @events.after\n end\n end",
"def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end",
"def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end",
"def create_filter(title, expression)\n filter = {\n \"userFilter\" => {\n \"content\" => {\n \"expression\" => expression\n },\n \"meta\" => {\n \"category\" => \"userFilter\",\n \"title\" => title\n }\n }\n }\n puts filter.to_json\n GoodData.post \"/gdc/md/#{@project_id}/obj\", filter\n end"
] |
[
"0.6643153",
"0.6589274",
"0.65296906",
"0.6472652",
"0.6472652",
"0.6192152",
"0.61384386",
"0.6123383",
"0.6048902",
"0.6048902",
"0.6048902",
"0.6036455",
"0.5999356",
"0.59461135",
"0.59461135",
"0.5912195",
"0.5888386",
"0.588031",
"0.5863743",
"0.5859606",
"0.5857915",
"0.5836772",
"0.5824527",
"0.58041376",
"0.5803352",
"0.5803352",
"0.5790718",
"0.5788107",
"0.57597584",
"0.57445097",
"0.57319707",
"0.5723004",
"0.5716367",
"0.5711825",
"0.57014847",
"0.5678092",
"0.5677175",
"0.5659578",
"0.5639459",
"0.56303126",
"0.5615395",
"0.55921537",
"0.55755424",
"0.5573376",
"0.5570915",
"0.5570225",
"0.55630374",
"0.5554998",
"0.55417377",
"0.55399954",
"0.5539618",
"0.5531648",
"0.5531648",
"0.5527278",
"0.55152965",
"0.5515279",
"0.5480075",
"0.547921",
"0.5475435",
"0.5473976",
"0.5440166",
"0.54363185",
"0.54350585",
"0.54290396",
"0.54290396",
"0.5427798",
"0.54174703",
"0.54148924",
"0.54080665",
"0.54031265",
"0.5397847",
"0.53962916",
"0.5392855",
"0.53924716",
"0.5391768",
"0.5383412",
"0.5382789",
"0.5382649",
"0.5380356",
"0.53778833",
"0.53744006",
"0.53744006",
"0.53744006",
"0.5373299",
"0.5373299",
"0.53698117",
"0.53687423",
"0.53687423",
"0.5367153",
"0.5365476",
"0.5359605",
"0.5353023",
"0.5344658",
"0.5344597",
"0.5343857",
"0.533796",
"0.53364384",
"0.5335707",
"0.5335707",
"0.53315306"
] |
0.656373
|
2
|
list all books GET /books new%20york%20times%20bestseller%20
|
def index
base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'
and_key = '&key='
key = ENV['GOOGLE_BOOKS_API_KEY']
googleurl = base_url + and_key + key
response = RestClient.get(googleurl)
@books = JSON.parse(response)
respond_to do |format|
format.html
format.json { render json: @books }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"def get_books\n # clears the screen\n system(\"clear\")\n puts \"Please enter what you are looking for today: \"\n puts \"\"\n query = gets.chomp.downcase\n results = Api.call_api(query)\n\n add_book_to_reading_list(results)\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def list\n if params[:query]\n @searched = true\n @books = Book.active.search(params[:query])\n else\n @books = Book.active_reverse.paginate :page => params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend",
"def index\n @books = Book.page(params[:page]) # utilise le helper du gem kaminari pour faire la pagination des livres automatiquement\n end",
"def list\n @books = Book.all\n end",
"def index\n @books = Book.where([\"name LIKE ?\", \"%#{params[:search]}%\"])\n end",
"def show\n \t@books = Book.find_all_by_title(params[:book_name])\n end",
"def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end",
"def book_list\n\t\tputs \"Here are the books in our library:\"\n\t\[email protected] { |book| puts \"#{book.name}\" }\n\tend",
"def index\n\t\tif (params[:data] != nil)\n\t\t\t@book = Book.new\n\t\t\t@client = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\t@search = @client.search_books(params[:data])\n\t\t\t#@search = @client.search_books(\"the lord of the rings\")\n\t\t\t@results = @search.results.work\n\t\t\t#https://image.tmdb.org/t/p/w300_and_h450_bestv2\n\t\tend\n\n @books = Book.all\n end",
"def searchLists(author = '', title = '', publisher = '')\n url = \"https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json\"\n params = {\n author: author,\n title: title,\n publisher: publisher\n }\n \n self.request(url, params)\n end",
"def index\n if params[:search]\n @books = Book.search(params[:search]).order(\"created_at DESC\").paginate(page: params[:page], per_page: 3)\n else\n @books = Book.paginate(page: params[:page], per_page: 3)\n end\n end",
"def list_books\n @books = Book.all\n @books.each.with_index(1) do |book, i|\n puts \"#{i}.#{book.title} - #{book.author}\" \n #puts \"------------\"\n end\n puts \" \"\n puts \" \"\n end",
"def search\n @keywd = params[:keywd]\n @genre = params[:genre]\n if params[:page].present?\n @page = params[:page]\n else\n @page = 1\n end\n searcher = BookSearcher.new\n @result = searcher.search(@keywd, @page, @genre)\n @books = searcher.get_books\n @message = searcher.get_message\n\n respond_to do |format|\n format.html { render 'search/index' }\n format.json { render json: @books, status: :ok }\n end\n end",
"def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"def index\n @books = params[:search] ? Book.select{|book| book.title.downcase.include?(params[:search].downcase)} : Book.all\n end",
"def book\n fetch('harry_potter.books')\n end",
"def search_book_by_name(book)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{URI::encode(book)}&key=#{get_access_key}\"\n\tres = JSON.load(RestClient.get(url))\n return res\t\nend",
"def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q])\n rescue\n []\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def search_url\n \"http://books.google.com/books/feeds/volumes?q=ISBN#{ isbn }\"\n end",
"def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end",
"def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end",
"def index\n\n @books = Book.all\n\n end",
"def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end",
"def index\n #@books = Book.all\n end",
"def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n books_with_isbn = Book.where(isbn: params[:search])\n if books_with_isbn.any? and not request.format.json?\n redirect_to books_with_isbn.first\n return\n else\n search\n @books = @books.first(params[:limit].to_i) if params[:limit]\n @query = params[:search]\n unless request.format.json?\n @books = @books.paginate(page: params['page'])\n end\n end\n respond_to do |format|\n format.html\n format.json { 'show' }\n end\n end",
"def index\n \t@books = Book.paginate :page => params[:page], :per_page => 10, :order => 'name'\n \t#:per_page => 50\n end",
"def search\n if params[:search].present?\n @books = Book.search(params[:search])\n else\n @books = Book.all\n end\n end",
"def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q]) if (params[:t] == \"title\" || params[:t].blank?)\n results = client.book_by_isbn(params[:q]) if params[:t] == \"isbn\"\n return results\n end",
"def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q]) if (params[:t] == \"title\" || params[:t].blank?)\n results = client.book_by_isbn(params[:q]) if params[:t] == \"isbn\"\n return results\n end",
"def index\n @books = Book.get_avaible_books\n end",
"def index\n\n @books = Book.paginate(:page => params[:page], :per_page => 2)\n\n end",
"def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end",
"def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end",
"def index\n if current_student\n student_id = current_student.id \n @books = Book.fetch_books_by_university(student_id)\n elsif current_admin\n @books = Book.all\n elsif current_librarian\n library_id = current_librarian.library_id\n @books = Book.fetch_books_by_library(library_id)\n end\n\n if !params[:search].nil?\n @books = @books & Book.search(params[\"search_by\"].downcase, params[:search])\n end\n end",
"def index\n @books = Book.all.page(params[:page]).per(5)\n end",
"def index\n @books = Book.all\n\t# @book = Book.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @bookings = Booking.all\n if params[:search]\n @search_term = params[:search]\n @bookings = @bookings.search_by(@search_term)\n end\n end",
"def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end",
"def index\n @m = \"/books\" \n @books = (params[:search].blank?) ? (params[:type].blank?) ? Book.all.page(params[:page]).per(20) : Book.where(:type_id=> params[:type]).page(params[:page]).per(20) : (params[:type].blank?) ? Book.all.params[:search].page(params[:page]).per(20) : Book.where(:type_id=> params[:type]).params[:search].page(params[:page]).per(20) \n @types = Type.all\n @book = Book.new\n @bookrent = Bookrent.new\n end",
"def search\n books, editionparams, descriptionparams = searchbooks(params)\n @hitcount = books.size\n filterbooks(books, editionparams, descriptionparams)\n @books = books\n respond_to do |format|\n format.html # search.html.erb\n format.xml\n format.atom\n #format.xml { render :xml => @books }\n end\n end",
"def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end",
"def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n rescue\n []\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n if params.has_key?(:search) && params[:search].strip != \"\" #for rental search across site\n @books = Book.search(params[:search], :match_mode => :any, :star => true, :page => params[:page], :per_page => 10)\n if (@books.count == 0)\n @books = nil\n end\n\n elsif params[:category] #for category search\n @book_ids = BookCategory.where('category_id = ?', params[:category]).pluck(:book_id)\n if (@book_ids)\n @books = Book.where(:id => @book_ids).paginate(:page => params[:page], :per_page => 10)\n if (UserBook.find_by_book_id(@book_ids) == nil)\n @books = nil\n end\n else\n @books = nil\n #flash[:alert] = \"We didn't find any book in this category :(\" #not showing up\n end\n \n #elsif params[:value] #for autosuggest on search bar\n # @books = Book.search(params[:value], :match_mode => :any, :star => true)\n \n else \n @books = Book.where(:id => [1..191]).paginate(:page => params[:page], :per_page => 10) #paginate(:page => params[:page], :per_page => 1) #(limit: 10)\n flash.now[:alert] = \"Please type in something to search. Some recent listings have been shown. Also, we just opened up the listing feature :)\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n\n end",
"def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n if params[:search]\n @lib_books = []\n @library.lib_books.each do |lib_book|\n @book = Book.find_by_id(lib_book.book_id)\n if params[:title] != \"\"\n next if [email protected]? params[:title].downcase\n end\n if params[:author] != \"\"\n next if [email protected]? params[:author].downcase\n end\n if params[:published] != \"\"\n next if [email protected]_s.eql? params[:published]\n end\n if params[:subject] != \"\"\n next if [email protected]? params[:subject].downcase\n end\n @lib_books.push(lib_book)\n end\n else\n @lib_books = @library.lib_books\n end\n end",
"def list_books\n puts \"\"\n puts \"Current Catalogue:\"\n puts \"\"\n puts \"A-G:\"\n \t@shelf_ag.to_s\n \tputs \"H-P:\"\n \t@shelf_hp.to_s\n \tputs \"Q-Z:\"\n \t@shelf_qz.to_s\n end",
"def search\n book = Book.new(params)\n render json: book.search\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\n @books = Book.all\n end",
"def index\r\n @books = Book.all\r\n end",
"def index\n @page = (params[:page] || 0).to_i\n @keywords = params[:keywords]\n @year = params[:year]\n search = Search.new(@page, PAGE_SIZE, @keywords, @year)\n @books, @number_of_pages = search.books_by_name_year\n end",
"def index\n @books= Book.all\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @books.to_xml }\n end\n end",
"def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend",
"def show_all_books\n\t\tputs \"\\nAll Books\\n\"\n\t\tBook.all.each do |book|\n\t\t\tputs \"#{book.id} #{book.title}\"\n\t\tend\nend",
"def index\n @library_books = Library::Book.all.paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @wordbooks = Wordbook.search(params[:search])\n end",
"def index\n @books = Book.order('id').paginate(:page => params[:page], :per_page => 10)\n end",
"def fullsearch\n if params[:isbn]\n @books = Book.where(:ISBN => params[:isbn])\n elsif params[:title]\n @books = Book.where(\"Title LIKE :title1\", { :title1 => \"#{params[:title]}%\"})\n elsif params[:author]\n @books = Book.where(\"Authors LIKE :author1\", { :author1 => \"#{params[:author]}%\"})\n elsif params[:description]\n @books = Book.where(\"Description LIKE :description1\", { :description1 => \"#{params[:description]}%\"})\n else\n @books = Book.all\n end\n end",
"def index\n \n @user = current_user\n @search = current_user.books.search(params[:q])\n @books = @search.result\n end",
"def index \n @book_shop = find_book_shop_params\n @books = @book_shop.books.all\n end",
"def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end",
"def index\n @bookitems = Bookitem.all\n \n end",
"def book\n @books=Book.all\n @book=Book.find(params[:id])\n end"
] |
[
"0.6574737",
"0.6512965",
"0.6406941",
"0.6403643",
"0.639265",
"0.6378496",
"0.63364017",
"0.62823755",
"0.628039",
"0.62725616",
"0.6264768",
"0.6233181",
"0.6230956",
"0.6225182",
"0.62113553",
"0.61759335",
"0.60934335",
"0.60906374",
"0.60858744",
"0.60771304",
"0.60396266",
"0.6039209",
"0.603845",
"0.6037721",
"0.60364956",
"0.6030314",
"0.602513",
"0.60241354",
"0.60241354",
"0.60239744",
"0.60162765",
"0.6005333",
"0.60043746",
"0.60005736",
"0.6000551",
"0.59957963",
"0.5991801",
"0.5991801",
"0.5980826",
"0.5963467",
"0.59630525",
"0.5956556",
"0.5956534",
"0.59508044",
"0.59503096",
"0.5949483",
"0.59435356",
"0.5940175",
"0.59357876",
"0.5917156",
"0.59052616",
"0.5901386",
"0.58966213",
"0.58966213",
"0.5890845",
"0.58820814",
"0.58799976",
"0.5879723",
"0.58765596",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.5875641",
"0.58702224",
"0.58606493",
"0.5853484",
"0.58482933",
"0.58406335",
"0.5840295",
"0.5835692",
"0.58337533",
"0.5828461",
"0.5816635",
"0.5814701",
"0.58080006",
"0.5799347",
"0.579735",
"0.5795312"
] |
0.6440141
|
2
|
show a single book GET /books/:id
|
def show
@book = Book.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @book = Book.where(id: params[:id]).first\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find params[:id]\n end",
"def show\n @book=Book.find(params[:id])\n\n end",
"def show\n\t\t@book=Book.find(params[:id])\n\tend",
"def show\n @books = Book.find(params[:id])\n puts @book\n end",
"def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.where(\"id = #{params[:id]}\").first\n # @book = Book.where(\"id = ? \", params[:id]).first\n # @book = Book.find params[:id]\n end",
"def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end",
"def get_book\n @book = Book.where(id: params[:book_id]).first\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n flash[:msg] = \"Show Successful\"\n end",
"def show\n @book = Book.find_by_id(params[:id])\n if @book.present?\n render json: {\n type: 'success',\n result: @book\n }, status: :ok\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def retrieve_book\n @book = Book.find(params[:book_id])\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def find_book\n\t@book = Book.find(params[:id])\nend",
"def show\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @book = Book.find(params[:book_id])\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @book.to_xml }\n end\n end",
"def show\n @book = Book.active.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def load_book\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @book }\n end\n end",
"def book\n @books=Book.all\n @book=Book.find(params[:id])\n end",
"def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def show\n @library = Library.find(Book.find(params[:id]).library_id)\n end",
"def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end",
"def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end",
"def show\n @book = Book.find(params[:id]) # Find Book instance from id in params\n @userbook = UserBook.find_by(user_id: current_user.id, book_id: @book.id) # Find UserBook instance associated with current user and book to display the current user's book activity\n end",
"def show\n @authorid = params[:id]\n @author = Author.find( params[:id] )\n @publishedBooks = Book.where( \"author = '#{@author.name}' \" )\n end",
"def show\n @note_book = NoteBook.find(params[:id])\n end",
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def show\n @book_of_class = BookOfClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_of_class }\n end\n end",
"def show\n \t@books = Book.find_all_by_title(params[:book_name])\n end",
"def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"def show\n @librarybook = Librarybook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @librarybook }\n end\n end",
"def show\n @user = User.find(params[:id])\n @books = @user.books\n end",
"def show\n @mybook = Mybook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mybook }\n end\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def show \n @books = Book.find(params[:id])\n @authorname= @book.author\n\n end",
"def show\n @addbook = Addbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @addbook }\n end\n end",
"def show\n @book_user = BookUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_user }\n end\n end",
"def book(id)\n\t\t\tresponse = request('/book/show', :id => id)\n\t\t\tHashie::Mash.new(response['book'])\n\t\tend",
"def show\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book = Book.find_by_id(@book_review.book_id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend",
"def edit\n\t\t@book = Book.find(params[:id])\n\tend",
"def show\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book_type }\n end\n end",
"def show\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book_type }\n end\n end",
"def show\n @usersbook = Usersbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usersbook }\n end\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def show\n @booker = Booker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booker }\n end\n end",
"def show\n @book_shelf = BookShelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def show\n @title = \"Show Book\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @death_record_book = DeathRecordBook.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @death_record_book }\n end\n end",
"def show\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cookbook }\n end\n end",
"def show\n @book_catalog_entrie = BookCatalogEntrie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_catalog_entrie }\n end\n end",
"def show\r\n @book = Book.find(params[:id])\r\n lookup_permission @book.id\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def show\n @booking = Booking.find(params[:id])\n end",
"def show\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ebook }\n end\n end",
"def show\n @user = User.find(params[:id])\n @books = Book.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end",
"def edit \n @book = Book.find params[:id]\n end",
"def book\n sql = \"SELECT * FROM books WHERE books.id = $1\"\n values = [@book_id]\n book_data = SqlRunner.run(sql, values)\n book = Book.map_items(book_data).first\n return book\n end",
"def show\n @chapter = @book.chapters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chapter }\n end\n end",
"def show\n query = \"SELECT * FROM Booking WHERE bookingId = #{params[:id]}\"\n @booking = Booking.find_by_sql(query).first\n end",
"def show\n @house_book = HouseBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @house_book }\n end\n end",
"def show\n\t\t@book = Book.find(params[:id])\n\t\t@book_reviews = BookReview.find_all_by_book_id(@book.id).reverse\n\n\t\t#@tweets = Tweet.find_all_by_book_id(@book.id)\n\n\t\t@tweets = Tweet.where(\"tweets.updated_at <= (SELECT MIN(t.updated_at) FROM tweets AS t WHERE t.from_user=tweets.from_user)\").order(\"tweets.tweet_id desc\").find_all_by_book_id(@book.id).first(108)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @book }\n\t\tend\n\tend",
"def show\n @message = Message.find(params[:id])\n @book = Book.find_by_id(:book_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @message }\n end\n end",
"def new\n @book = Book.find(params[:book_id])\n render :new\n end",
"def show\n @book_edition = BookEdition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_edition }\n end\n end",
"def show\n @booking=Booking.find(params[:id])\n end",
"def show\n \t@num = params[:num]\n \trender :\"book/show\"\n end"
] |
[
"0.8860182",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.868795",
"0.8587743",
"0.85245574",
"0.84266007",
"0.83051723",
"0.8207208",
"0.8133303",
"0.8118453",
"0.81122506",
"0.81122506",
"0.8024711",
"0.8024711",
"0.8024711",
"0.8024711",
"0.8024711",
"0.8024711",
"0.8024711",
"0.8024711",
"0.8024711",
"0.80210936",
"0.7977228",
"0.78635293",
"0.7836834",
"0.7830736",
"0.7820933",
"0.7792771",
"0.7792771",
"0.7792771",
"0.7792771",
"0.7792771",
"0.7792771",
"0.7792771",
"0.7792771",
"0.7781659",
"0.7758414",
"0.77523226",
"0.7722978",
"0.769621",
"0.7690543",
"0.76605135",
"0.7642136",
"0.76415795",
"0.7623991",
"0.7619812",
"0.75866526",
"0.7558318",
"0.7539059",
"0.75182736",
"0.74812466",
"0.74544704",
"0.7449866",
"0.7446032",
"0.7437877",
"0.7391752",
"0.7367481",
"0.7360223",
"0.73211265",
"0.726845",
"0.726845",
"0.726845",
"0.7267505",
"0.7259705",
"0.72568196",
"0.72493505",
"0.72026354",
"0.71965903",
"0.7191954",
"0.7191954",
"0.7184019",
"0.71811014",
"0.71811014",
"0.71545964",
"0.71479326",
"0.7146019",
"0.71445477",
"0.71390766",
"0.7105951",
"0.7104575",
"0.7103891",
"0.70861393",
"0.7075878",
"0.706969",
"0.7054308",
"0.7046321",
"0.7038574",
"0.7021936",
"0.70101863",
"0.6977831",
"0.69657105",
"0.6963761",
"0.6960404",
"0.6954851"
] |
0.86197567
|
9
|
new book creation form GET /books/new
|
def new
@book = Book.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n\t\t@book = Book.new\n\tend",
"def new\n @book = Book.new\n end",
"def new\n @book = Book.new\n end",
"def create\n\t@book = Book.new(book_params)\n\tif @book.save\n\t\tredirect_to root_path\n\telse\n\t\trender 'new'\n\tend\nend",
"def new\n @book = Book.new\n end",
"def new\n @book = Book.new\n \n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n\t\t@book = Book.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @book }\n\t\tend\n\tend",
"def new\n load_form_data\n @book = Book.new\n end",
"def create\n\t\t@book = Book.new(book_params)\n\t\[email protected]\n\t\tredirect_to books_path\n\tend",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n\n\t \t@book = Book.new\n\t \tif params[:book]\n\n\t \t\t@book = Book.new(book_params)\n\n\t \t\t# lay id nguoi dang logi ngan vao owner_id de xac nhan chinh chu\n\t \t\t@book[:owner_id] = current_user.id\n\n\t \t\tif @book.save\n\n\t \t\t\tflash[:success] = \"Saved book!\"\n\t \t\t\tredirect_to '/books'\n\t \t\tend\n\t \tend\n \tend",
"def create\n\t\t@books = Book.new(params [:book])\n\n\t\[email protected]\n\n\t\t#redirects to \"show\" method\n\t\tredirect_to @books\n\tend",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, 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 end\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def create\n @book = Book.new(book_params)\n if @book.save\n flash[:notice] = \"Book record successfully created\"\n redirect_to books_url\n else\n render \"new\"\n end\n end",
"def create\n @book = Book.new(book_params)\n if @book.save\n redirect_to book_path(@book)\n #based on the routes (@ localhost.../routes, or rakes route, we can use the defined path as opposed to a link)\n else\n render 'new'\n #goes back to the new method if the book is not saved\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", 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 end\n end",
"def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, 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 end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to root_path, notice: 'Book was successfully created.'\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n @book = Book.new(params[:book])\n \n\n respond_to do |format|\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 end\n end",
"def create\n logger.debug \"#{book_params}\"\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\r\n @page_title = '書籍情報作成'\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :created, :location => book_url(@book) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def new\n @book = Book.find(params[:book_id])\n render :new\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@book = Book.new(params[:book])\n\t\[email protected] = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @book.save\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully created.' }\n\t\t\t\tformat.json { render :json => @book, :status => :created, :location => @book }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to @book, notice: 'Book was successfully created.'\n else\n render :new\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @book = params[:book_id]\n render :new\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def create\n @book = Book.new(book_params)\n @book.save\n redirect_to root_path\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', 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 end\n end",
"def create\n #raise params.inspect\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = t('book.title2')+\" \"+t('created')\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def create\r\n @book = Book.new(book_params)\r\n\r\n respond_to do |format|\r\n if @book.save\r\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\r\n format.json { render :show, status: :created, location: @book }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @book = current_user.books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n do_response @book\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book }\n format.json { render action: 'show', 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 end\n end",
"def create\n @book = params[:book]\n add(@book)\n end",
"def new\n @book = Book.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.xml { head :ok }\n format.json { render json: @book, status: :created, location: @book }\n\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n puts \"*** From create: \" \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book}\n format.json { render action: 'show', 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 end\n end",
"def new\n @current_book = Book.find_by_id(params[:book_id])\n @chapter = Chapter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :json => @chapter }\n end\n end",
"def create\n book = Book.create(params[:book])\n redirect_to(book)\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @book }\n end\n end"
] |
[
"0.8106571",
"0.80645764",
"0.80645764",
"0.80461204",
"0.796564",
"0.7950408",
"0.7909847",
"0.7909847",
"0.78766656",
"0.78507346",
"0.7844588",
"0.7816297",
"0.7811607",
"0.7789207",
"0.778869",
"0.77886724",
"0.7776589",
"0.77749383",
"0.7739362",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7725305",
"0.7716367",
"0.77147716",
"0.7711489",
"0.7708944",
"0.76853853",
"0.7675322",
"0.7673801",
"0.7672364",
"0.7665812",
"0.76532096",
"0.7639826",
"0.7639826",
"0.7639826",
"0.7639826",
"0.7639826",
"0.76381016",
"0.76329726",
"0.75977355",
"0.75968254",
"0.75899357",
"0.75899357",
"0.75899357",
"0.75796777",
"0.7574568",
"0.7574568",
"0.75686765",
"0.7566591",
"0.75539976",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7545904",
"0.7539347",
"0.7537642",
"0.7528271",
"0.7528271",
"0.7528271",
"0.7528271",
"0.7528271",
"0.7528271",
"0.7528271",
"0.7528271",
"0.7527215",
"0.7522137",
"0.7521693",
"0.7520202",
"0.751983",
"0.75133127",
"0.7503955",
"0.74883485",
"0.7474247",
"0.74591297",
"0.74559253",
"0.74415076",
"0.7436548"
] |
0.80287987
|
10
|
edit book form GET /books/:id/edit
|
def edit
@book = Book.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit\n @book = Book.find(params[:id])\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def edit \n @book = Book.find params[:id]\n end",
"def edit\n\t\t@book = Book.find(params[:id])\n\tend",
"def edit\n\n\t \t@book = Book.find(params[:id])\n\n\t \t# check quyen xem \n \t\tcheck_view(@book)\n\n\t \tif params[:book]\n\n\t \t\[email protected]_attributes(book_params)\n\t \n\t \tflash[:success] = \"Updated book!\"\n\t end\n \tend",
"def edit\n @ebook = Ebook.find_by_id(params[:id])\n end",
"def edit\n @book = @organism.books.find(params[:id])\n end",
"def update\n @book = get_book\n if @book.update(book_params)\n redirect_to book_path(@book)\n else\n render 'edit'\n end\n end",
"def update\n\t\t@book = Book.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book.update_attributes(params[:book])\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @book = Book.where(id: params[:id]).first\n @book.update_attributes(book_params)\n if @book.errors.empty?\n redirect_to book_path(@book)\n else\n render \"edit\"\n end\n end",
"def update\n @book = Book.find(params[:id])\n if @book.update_attributes(book_params)\n flash[:notice] = \"Book's information successfully updated\"\n redirect_to books_url\n else\n render \"edit\"\n end\n end",
"def edit\n @author = Author.find(params[:id])\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @book.update(book_params)\n flash[:success] = \"BOOK was successfully updated\"\n redirect_to books_path\n else\n render 'edit'\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # 1. Query the DB to get the item we want to edit.\n # We have the id to lookup form the url /books/:id i.e. it's in params[:id]\n book = Book.find params[:id]\n\n # 2. Call .update() on that object, passing in the new values from the form submit, in params[:book]\n book.update(\n title: params[:book][:title],\n author: params[:book][:author],\n description: params[:book][:description],\n image_url: params[:book][:image_url]\n )\n\n redirect_to book_path(book.id)\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_book(selected)\n\tedit_book_title(selected)\n\tedit_book_author(selected)\n\tedit_book_isbn(selected)\nend",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @book = Book.find(params[:id])\n @subjects = Subject.all\n end",
"def edit\n @book = Book.find(params[:id])\n @subjects = Subject.all\n end",
"def edit\n\n end",
"def update\n if @book.update(book_params)\n redirect_to root_path, notice: 'Book was successfully updated.'\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n # Check the fields were valid\n # If so, save the book. Otherwise, re-show the form\n if @book.update(article_params)\n flash[:msg] = \"Update Successful\"\n redirect_to books_path\n else\n render 'edit'\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to '/books', notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@book = Book.new(book_params)\n\t\[email protected]_id = current_user.id\n if @book.save\n \tflash[:notice] = 'successfully editted'\n redirect_to book_path(@book.id)\n else\n \t@books = Book.all\n \t@user = current_user\n\t render :index\n\tend\n\tend",
"def edit\n # Renders the edit form\n end",
"def edit\n\n end",
"def edit\r\n end",
"def edit\n locals biblebook:, chapter:\n end",
"def update\n @book = current_user.books.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n if @book.update_attributes(params[:book])\n redirect_to [:admin,@book], notice: 'Book was successfully updated.' \n else\n render action: \"edit\" \n end\n end",
"def update\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n if @authors_book.update_attributes(params[:authors_book])\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\r\n \r\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = t('book.title2')+\" \"+t('updated')\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end",
"def update\n @book = Book.find(params[:id])\n @book.update(book_params)\n redirect_to root_path\n end",
"def update\n @book_edition = BookEdition.find(params[:id])\n\n respond_to do |format|\n if @book_edition.update_attributes(params[:book_edition])\n format.html { redirect_to @book_edition, notice: 'Book edition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n new\n end",
"def update\n @addbook = Addbook.find(params[:id])\n\n respond_to do |format|\n if @addbook.update_attributes(params[:addbook])\n flash[:notice] = 'Addbook was successfully updated.'\n format.html { redirect_to(@addbook) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n \n end",
"def edit\n @recipe = Recipe.find(params[:id])\nend",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_path }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def update\n debugger\n chapter.book = book\n if chapter.save\n redirect_to(book_chapter_path([book, chapter]), notice: 'Chapter was successfully updated.')\n else\n render action: 'edit'\n end\n end",
"def update\n book = Book.find(params[:id])\n book.update_attributes(params[:book])\n redirect_to(book)\n end"
] |
[
"0.8895451",
"0.8895451",
"0.8878588",
"0.88532704",
"0.84685713",
"0.8055678",
"0.7769998",
"0.75619185",
"0.7511897",
"0.74881977",
"0.7444019",
"0.7432385",
"0.7426125",
"0.73585135",
"0.7344598",
"0.7344273",
"0.7324524",
"0.73114526",
"0.73114526",
"0.73114526",
"0.7309942",
"0.7307891",
"0.7303936",
"0.7303936",
"0.7303936",
"0.7303936",
"0.7293391",
"0.72925425",
"0.72834426",
"0.7266249",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72634965",
"0.72622585",
"0.7246645",
"0.7246645",
"0.7225853",
"0.72155946",
"0.71936685",
"0.71661395",
"0.71640575",
"0.71478856",
"0.71339977",
"0.7129933",
"0.71127033",
"0.7110993",
"0.70923615",
"0.70920396",
"0.70879734",
"0.70760876",
"0.7073514",
"0.70708436",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7050446",
"0.7043046",
"0.70420915",
"0.7035335",
"0.7020134",
"0.70026386",
"0.7002037",
"0.69966805",
"0.69869065",
"0.6981438",
"0.69681424",
"0.696556",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.69635165",
"0.6959706",
"0.6957774"
] |
0.8858947
|
5
|
create a new book POST /books
|
def create
@book = Book.new(book_params)
@book.save
redirect_to root_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, 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 end\n end",
"def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", 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 end\n end",
"def create\n @book = Book.new(params[:book])\n \n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, 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 end\n end",
"def create\n logger.debug \"#{book_params}\"\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\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 end\n end",
"def create\n @book = params[:book]\n add(@book)\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to root_path, notice: 'Book was successfully created.'\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@book = Book.new(book_params)\n\t\[email protected]\n\t\tredirect_to books_path\n\tend",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\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 end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def create\n book = Book.create(params[:book])\n redirect_to(book)\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: \"Book was successfully created.\" }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @book = Book.new(book_params)\r\n\r\n respond_to do |format|\r\n if @book.save\r\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\r\n format.json { render :show, status: :created, location: @book }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.xml { head :ok }\n format.json { render json: @book, status: :created, location: @book }\n\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t@book = Book.new(book_params)\n\tif @book.save\n\t\tredirect_to root_path\n\telse\n\t\trender 'new'\n\tend\nend",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', 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 end\n end",
"def create\n \n Book.create(\n title: params[:book][:title],\n author: params[:book][:author],\n description: params[:book][:description],\n image_url: params[:book][:image_url]\n )\n\n redirect_to books_path\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book }\n format.json { render action: 'show', 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 end\n end",
"def create\n @book = Book.new(book_params)\n if @book.save\n flash[:notice] = \"Book record successfully created\"\n redirect_to books_url\n else\n render \"new\"\n end\n end",
"def create\n\t\t@book = Book.new(params[:book])\n\t\[email protected] = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @book.save\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully created.' }\n\t\t\t\tformat.json { render :json => @book, :status => :created, :location => @book }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book}\n format.json { render action: 'show', 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 end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :created, :location => book_url(@book) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end",
"def create\n @book = Book.new(get_book_with_api(book_params[:title]))\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '本を新規登録しました。' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params_create)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: '添加成功!' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@books = Book.new(params [:book])\n\n\t\[email protected]\n\n\t\t#redirects to \"show\" method\n\t\tredirect_to @books\n\tend",
"def create\n @book = Book.new(book_params)\n puts \"*** From create: \" \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n redirect_to @book, notice: 'Book was successfully created.'\n else\n render :new\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #raise params.inspect\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = t('book.title2')+\" \"+t('created')\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n \n respond_to do |format|\n if @book.save_and_index\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = \"Create New Book\"\n\n process_publisher\n\n all_book_params= params[:book]\n\n @book = Book.new(params[:book])\n\n process_authors\n\n process_subjects\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to edit_book_path(@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 end\n end",
"def create\n @book = Book.new(book_params)\n if @book.save\n redirect_to book_path(@book)\n #based on the routes (@ localhost.../routes, or rakes route, we can use the defined path as opposed to a link)\n else\n render 'new'\n #goes back to the new method if the book is not saved\n end\n end",
"def create\n @book = current_user.books.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), 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 end\n end",
"def create\n @authors_book = AuthorsBook.new(params[:authors_book])\n\n respond_to do |format|\n if @authors_book.save\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully created.' }\n format.json { render json: @authors_book, status: :created, location: @authors_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:success] = 'Added new Book...!'\n redirect_to :new_user_book, {user_id: @current_user}\n # @book = Book.new(book_params)\n #\n # respond_to do |format|\n # if @book.save\n # format.html { redirect_to @book, notice: 'Book was successfully created.' }\n # format.json { render action: 'show', 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 # end\n end",
"def create\n @cook_book = CookBook.new(params[:cook_book])\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render json: @cook_book, status: :created, location: @cook_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n rewriteParams\n @book = Book.new(params[:book])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book = current_user.books.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @book = current_user.books.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render action: 'show', 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 end\n end",
"def create\n @library_book = LibraryBook.new(library_book_params)\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render :show, status: :created, location: @library_book }\n else\n format.html { render :new }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n @book.user = current_user\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = current_user.books.build(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.create(book_params)\n if @book.errors.empty?\n redirect_to book_path(@book)\n else\n render \"new\"\n end\n end",
"def create\n @book = Book.new(params[:book])\n @book.user = current_user\n respond_to do |format|\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 render_error_response(\"\", \"new\", @book)\n end\n end\n end",
"def create\n @addbook = Addbook.new(params[:addbook])\n\n respond_to do |format|\n if @addbook.save\n flash[:notice] = 'Addbook was successfully created.'\n format.html { redirect_to(@addbook) }\n format.xml { render :xml => @addbook, :status => :created, :location => @addbook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n @book.user = current_user\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author_book = AuthorBook.new(author_book_params)\n\n respond_to do |format|\n if @author_book.save\n format.html { redirect_to @author_book, notice: 'Author book was successfully created.' }\n format.json { render :show, status: :created, location: @author_book }\n else\n format.html { render :new }\n format.json { render json: @author_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params.merge(user_id:current_user.id))\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = current_user.books.build(book_params)\n if @book.save\n flash[:notice] = \"Book Created Succesfully\"\n redirect_to @book\n else\n redirect_to new_book_path\n flash[:alert] = \"Something wrong with your book parameters.\"\n end\n end",
"def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n # BookMailer.creation_email(@book).deliver_now\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n #flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to @book, :notice => 'Book was successfully created.' }\n format.json { render :json => @book, :status => :created, :location => @book }\n else\n load_data\n\n format.html { render :action => \"new\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @usersbook = Usersbook.new(params[:usersbook])\n\n respond_to do |format|\n if @usersbook.save\n format.html { redirect_to @usersbook, notice: 'Registro criado com sucesso!' }\n format.json { render json: @usersbook, status: :created, location: @usersbook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usersbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @authors_book = AuthorsBook.new(authors_book_params)\n\n respond_to do |format|\n if @authors_book.save\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully created.' }\n format.json { render :show, status: :created, location: @authors_book }\n else\n format.html { render :new }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@book = Book.new(params[:book])\n\t\[email protected] = @book.title.titleize\n\t\[email protected]_first = @book.author_first.titleize\n\t\[email protected]_last = @book.author_last.titleize\n\t\t@all_categories = get_all_categories\n\t\n\t\trespond_to do |format|\n\t\t\tif @book.save\n\t\t\t\tflash[:notice] = 'Book was successfully created.'\n\t\t\t\tformat.html { redirect_to(:action => 'index', :choice => ' ') }\n\t\t\telse\n\t\t\t\tflash[:notice] = 'Book was not created. Please try again.'\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @my_book = MyBook.new(my_book_params)\n\n respond_to do |format|\n if @my_book.save\n format.html { redirect_to @my_book, notice: 'My book was successfully created.' }\n format.json { render :show, status: :created, location: @my_book }\n else\n format.html { render :new }\n format.json { render json: @my_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n byebug\n @book = Book.new(book_params)\n respond_to do |format|\n if @book.save\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book }\n else\n load_data\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @librarybook = Librarybook.new(params[:librarybook])\n\n respond_to do |format|\n if @librarybook.save\n format.html { redirect_to(@librarybook, :notice => 'Librarybook was successfully created.') }\n format.xml { render :xml => @librarybook, :status => :created, :location => @librarybook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @librarybook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lib_book = LibBook.new(lib_book_params)\n\n respond_to do |format|\n if @lib_book.save\n format.html { redirect_to university_library_lib_books_path, notice: 'Lib book was successfully created.' }\n format.json { render :show, status: :created, location: @lib_book }\n else\n format.html { render :new }\n format.json { render json: @lib_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cook_book = CookBook.new(cook_book_params)\n\n respond_to do |format|\n if @cook_book.save\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully created.' }\n format.json { render :show, status: :created, location: @cook_book }\n else\n format.html { render :new }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @books = Book.all\n @book = current_user.books.new(book_params)\n if @book.save\n redirect_to book_path(@book), notice: 'Book was successfully created.'\n else\n puts @book.errors.full_messages\n render :index, notice: 'error'\n\n end\n end",
"def create\n @book = Book.new(params[:book])\n @book.user_id = current_user.id\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book_catalog_entrie = BookCatalogEntrie.new(params[:book_catalog_entrie])\n\n respond_to do |format|\n if @book_catalog_entrie.save\n format.html { redirect_to @book_catalog_entrie, notice: 'Book was successfully created.' }\n format.json { render json: @book_catalog_entrie, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_catalog_entrie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_book = OrderBook.new(order_book_params)\n\n respond_to do |format|\n if @order_book.save\n format.html { redirect_to @order_book, notice: 'Order book was successfully created.' }\n format.json { render :show, status: :created, location: @order_book }\n else\n format.html { render :new }\n format.json { render json: @order_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # params[:book] --> inspect the html file then you can see the name as name=book[title] and name=book[author]\n # Book.create(params[:book]) # create and save it in db\n @book=Book.new(book_params)# create instant or copy \n # it take book_params method to checked\n \n # save it to database\n if @book.save \n redirect_to books_path # go to books path\n else\n render action: \"new\" # back to the action new\n end\n end",
"def create\n @book_of_class = BookOfClass.new(params[:book_of_class])\n\n respond_to do |format|\n if @book_of_class.save\n format.html { redirect_to @book_of_class, notice: 'Book of class was successfully created.' }\n format.json { render json: @book_of_class, status: :created, location: @book_of_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_of_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @booktitle = Book.find_by_title(book_params[:title])\n if Book.where(:title => book_params[:title]).present?\n @book = Book.find(@booktitle.id)\n @book.count = @book.count + book_params[:count].to_i\n else\n if !(Author.where(:name => book_params[:author_name]).present?)\n @author = Author.create(:name => book_params[:author_name],\n :category => book_params[:category])\n end\n @book = Book.new(book_params)\n @book.author_id = Author.find_by_name(book_params[:author_name]).id\n end\n\n \n respond_to do |format|\n if @book.save\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @book = Book.new(params[:book])\n\n @user = User.find(current_user.id)\n @book = Book.new(params[:book])\n @book.user_id = @user.id\n\n respond_to do |format|\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 end\n end",
"def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n\n respond_to do |format|\n if @borrowed_book.save\n format.html { redirect_to @borrowed_book, notice: \"Borrowed book was successfully created.\" }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n puts @book.as_json \n format.json { render :show, status: :created, location: @book }\n else\n \n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(admin_book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to admin_book_path(id: @book.id), notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store\n @book = Book.new(book_params)\n if @book.save\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {},\n }, status: :bad_request\n end\n end"
] |
[
"0.838368",
"0.8304108",
"0.82515216",
"0.82497156",
"0.81905425",
"0.81901467",
"0.81901467",
"0.81901467",
"0.81901467",
"0.81901467",
"0.81868017",
"0.81836116",
"0.8183202",
"0.81655633",
"0.8095692",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.8087854",
"0.8075007",
"0.80658084",
"0.8064339",
"0.8064339",
"0.8048534",
"0.80356485",
"0.8013175",
"0.80041623",
"0.7979861",
"0.7977004",
"0.7955799",
"0.79322916",
"0.7929236",
"0.79217356",
"0.7897027",
"0.78916603",
"0.7882544",
"0.7882544",
"0.78814614",
"0.7856864",
"0.78529614",
"0.78346825",
"0.78346825",
"0.78346825",
"0.7749315",
"0.7738495",
"0.77124375",
"0.770886",
"0.77052605",
"0.76717514",
"0.7669421",
"0.7663239",
"0.76349103",
"0.7631345",
"0.7606593",
"0.76005083",
"0.75739306",
"0.7556227",
"0.7546669",
"0.75406265",
"0.753989",
"0.7538398",
"0.75361186",
"0.7532976",
"0.75272965",
"0.75230354",
"0.75129515",
"0.751086",
"0.7504209",
"0.7495459",
"0.7489457",
"0.74395657",
"0.7426653",
"0.7412659",
"0.7401663",
"0.73935986",
"0.73891634",
"0.7385154",
"0.738379",
"0.73531437",
"0.73491275",
"0.73456943",
"0.73310983",
"0.73102236",
"0.730891",
"0.7308",
"0.730579",
"0.7290046",
"0.7274697",
"0.727448",
"0.72738814"
] |
0.8001763
|
37
|
update an existing book PUT /books/:id
|
def update
@book = Book.find(params[:id])
@book.update(book_params)
redirect_to root_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n\t\t@book = Book.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book.update_attributes(params[:book])\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n book = Book.find(params[:id])\n if book.update(book_params)\n redirect_to book_path(book), notice: 'successfully'\n else\n redirect_to book_path(book), notice: 'error'\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n book = Book.find(params[:id])\n book.update_attributes(params[:book])\n redirect_to(book)\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n if @book.update_attributes(book_params)\n flash[:notice] = \"Book's information successfully updated\"\n redirect_to books_url\n else\n render \"edit\"\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end",
"def update\n if @book.update(book_params)\n redirect_to root_path, notice: 'Book was successfully updated.'\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.where(id: params[:id]).first\n @book.update_attributes(book_params)\n if @book.errors.empty?\n redirect_to book_path(@book)\n else\n render \"edit\"\n end\n end",
"def update\n @book = get_book\n if @book.update(book_params)\n redirect_to book_path(@book)\n else\n render 'edit'\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\[email protected] = book.title\n\t\t\[email protected] = strip_tags(book.description)\n\t\t\[email protected] = book.work.original_title\n\t\t\[email protected] = book.num_pages\n\t\t\[email protected] = book.average_rating\n\t\t\[email protected] = book.authors.author.name\n\t\t\[email protected] = book.publisher\n\t\t\[email protected]\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end",
"def update\n @book = current_user.books.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_path }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n if @library_book.update_attributes(params[:library_book])\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to '/books', notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # 1. Query the DB to get the item we want to edit.\n # We have the id to lookup form the url /books/:id i.e. it's in params[:id]\n book = Book.find params[:id]\n\n # 2. Call .update() on that object, passing in the new values from the form submit, in params[:book]\n book.update(\n title: params[:book][:title],\n author: params[:book][:author],\n description: params[:book][:description],\n image_url: params[:book][:image_url]\n )\n\n redirect_to book_path(book.id)\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book.update(book_params)\n respond_with(@book, :flash => true)\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @book.update(book_params)\n flash[:success] = \"BOOK was successfully updated\"\n redirect_to books_path\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: '本の情報を更新しました。' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = t('book.title2')+\" \"+t('updated')\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n if @cook_book.update_attributes(params[:cook_book])\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n if @authors_book.update_attributes(params[:authors_book])\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end",
"def update\n @librarybook = Librarybook.find(params[:id])\n\n respond_to do |format|\n if @librarybook.update_attributes(params[:librarybook])\n format.html { redirect_to(@librarybook, :notice => 'Librarybook was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @librarybook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to current_user_path, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n debugger\n chapter.book = book\n if chapter.save\n redirect_to(book_chapter_path([book, chapter]), notice: 'Chapter was successfully updated.')\n else\n render action: 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @library_book.update(library_book_params)\n format.html { redirect_to @library_book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_book }\n else\n format.html { render :edit }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n book_updater = UpdateBook.new(current_user, params[:id], book_params)\n book_updated = book_updater.update\n @book = book_updater.book\n\n if book_updated\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_book = UserBook.find(params[:id])\n\n respond_to do |format|\n if @user_book.update_attributes(params[:user_book])\n format.html { redirect_to new_user_book_path, notice: 'Your book was successfully updated. You can add more or go back to your shelf' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @library_book.update(library_book_params)\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_book }\n else\n format.html { render :edit }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: @book.title + ' の更新に成功しました。' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @addbook = Addbook.find(params[:id])\n\n respond_to do |format|\n if @addbook.update_attributes(params[:addbook])\n flash[:notice] = 'Addbook was successfully updated.'\n format.html { redirect_to(@addbook) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.83026975",
"0.80287564",
"0.801523",
"0.800828",
"0.7988397",
"0.79877347",
"0.7982169",
"0.7956935",
"0.792501",
"0.7908734",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79035634",
"0.78873044",
"0.78415084",
"0.7826188",
"0.7798445",
"0.7796941",
"0.7796941",
"0.7796941",
"0.7796941",
"0.7788438",
"0.77824205",
"0.77785426",
"0.77764434",
"0.77764434",
"0.77764434",
"0.7765086",
"0.77515846",
"0.7751309",
"0.7727112",
"0.7706346",
"0.767663",
"0.76669246",
"0.7647289",
"0.76234853",
"0.76128966",
"0.7609341",
"0.76075065",
"0.7578919",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75768244",
"0.75644684",
"0.75578266",
"0.7556892",
"0.75501055",
"0.75360644",
"0.75360644",
"0.75286305",
"0.7494311",
"0.7467655",
"0.7467655",
"0.7467655",
"0.7467655",
"0.74413556",
"0.74391913",
"0.7417877",
"0.7414714",
"0.74120635",
"0.74086136",
"0.73851085",
"0.7379689",
"0.7366777",
"0.7357784",
"0.7355",
"0.7336966",
"0.73238695",
"0.73061967",
"0.72929454",
"0.72645265"
] |
0.8020123
|
2
|
destroy an existing book DELETE /books/:id
|
def destroy
@book = Book.find(params[:id])
@book.destroy
redirect_to root_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @book = Book.where(id: params[:id]).first\n @book.destroy\n redirect_to books_path\n end",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n redirect_to books_path\n end",
"def delete\n\t\tBook.find(params[:id]).destroy\n\t\tflash[:success] = \"Deleted book!\"\n\t\tredirect_to '/books'\n\tend",
"def destroy\n # Find the book by the given ID and destroy it\n @book = Book.find(params[:id])\n @book.destroy\n \n flash[:msg] = \"Delete Successful\"\n \n # Reload the book index\n redirect_to books_path\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book.destroy\n redirect_to books_url, notice: 'Book was successfully destroyed.'\n end",
"def destroy\n @book.destroy\n redirect_to books_path, notice: 'Book was successfully destroyed.'\n end",
"def destroy\n @book.destroy\n redirect_to root_path, notice: 'Book was successfully destroyed.'\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n redirect_to root_path, notice: \"The book \\\"#{@book.title}\\\" has been REMOVED!\"\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@book = Book.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to books_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n redirect_to admin_books_url \n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_books_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Book.find(params[:id]).destroy\n redirect_to :action => 'list'\n end",
"def destroy\n @book = UhaBook.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(uha_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end",
"def destroy\n @book = Book.find(params[:id])\n if @book.destroy\n flash[:notice] = \"Book successfully destroyed\"\n redirect_to books_url\n else\n flash[:notice] = \"Can't delete book because of dependent copies assigned\"\n redirect_to books_url\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_uri, notice: '本を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@book = Book.find(params[:id])\n @book = current_user.books.find(params[:id])\n book2delete = @book.title\n @book.destroy\n flash[:notice] = \"Removed: #{book2delete}\"\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: @book.title + ' の削除に成功しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to user_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find_by_id(params[:id])\n if @book.present?\n if @book.destroy\n render json: {\n type: 'success',\n result: {}\n }, status: :created\n else \n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book.destroy\n flash[:success] = I18n.t(:book_destroyed)\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '書籍が削除されました。' }\n format.json { head :no_content }\n end\n end",
"def remove\n @book = Book.find(params[:id])\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to book_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end",
"def destroy\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/books\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8693791",
"0.86770105",
"0.85342723",
"0.8418383",
"0.8411704",
"0.8406299",
"0.83924395",
"0.83873576",
"0.8375257",
"0.8348966",
"0.83411103",
"0.8285003",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8238436",
"0.82201636",
"0.82201636",
"0.82042927",
"0.8199751",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8181992",
"0.8161779",
"0.81478745",
"0.81386787",
"0.8137923",
"0.8116842",
"0.81102604",
"0.81037253",
"0.806615",
"0.8057772",
"0.8051424",
"0.80192256",
"0.79978335",
"0.7996958",
"0.79941684",
"0.7984615",
"0.7984615",
"0.7983474",
"0.7983015",
"0.79792786",
"0.7964927",
"0.793774",
"0.791378",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79107445",
"0.79101926",
"0.7909536",
"0.7895137",
"0.7887641",
"0.788199",
"0.788199",
"0.788199",
"0.7878906",
"0.7878906",
"0.7878906"
] |
0.8648044
|
2
|
Use callbacks to share common setup or constraints between actions.
|
def set_other_spiritual_association
@other_spiritual_association = OtherSpiritualAssociation.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def 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 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 action\n end",
"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 setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; 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 around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] |
[
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def other_spiritual_association_params
params.require(:other_spiritual_association).permit(:organization_name, :association_description, :associated_since_year, :associated_since_month, :duration_of_practice, :sadhak_profile_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 strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def quote_params\n params.permit!\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 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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n 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 sensitive_params=(params)\n @sensitive_params = params\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212",
"0.6291073",
"0.6283318",
"0.6240518",
"0.62398005",
"0.62181634",
"0.6214569",
"0.62109077",
"0.61940056",
"0.61784893",
"0.61742175",
"0.61721945",
"0.6162829",
"0.61528105",
"0.6152724",
"0.61469215",
"0.6122237",
"0.61168486",
"0.61067575",
"0.6106625",
"0.60911",
"0.6081634",
"0.6070881",
"0.6062597",
"0.6021349",
"0.6017612",
"0.60133123",
"0.60113484",
"0.6006092",
"0.6006092",
"0.60013616",
"0.6000388",
"0.5997203",
"0.5991786",
"0.599171",
"0.599018",
"0.59803563",
"0.59669757",
"0.59596956",
"0.5958921",
"0.59588784",
"0.5957653",
"0.59536135",
"0.595352",
"0.59439486",
"0.5940021",
"0.5937903",
"0.5937903",
"0.5935101",
"0.5930797",
"0.59260094",
"0.5925016",
"0.5917673",
"0.59099996",
"0.5907993",
"0.5906815",
"0.59056044",
"0.5897754",
"0.5897269",
"0.5896547",
"0.589625",
"0.5893799",
"0.5892099",
"0.58870953",
"0.5883051",
"0.58797866",
"0.5874013",
"0.58691907",
"0.5868823",
"0.58668876",
"0.586648",
"0.5864312",
"0.5863242",
"0.58631074",
"0.58626693",
"0.5861018",
"0.5859546",
"0.58549064",
"0.5854862",
"0.5850909",
"0.58506316"
] |
0.0
|
-1
|
photos, videos ready KEY = "watsan" photos, videos ready KEY = "security" photos done?, videos ready KEY = "health" photos done, videos ready
|
def parse_osm
db = OSM::Database.new
parser = OSM::StreamParser.new(:filename => "kibera." + KEY + ".osm", :db => db)
result = parser.parse
db.nodes.each do |key,node|
if node.tags['media:video_device_number'] and node.tags['media:video_number']
video_numbers = node.tags['media:video_number'].split(",")
video_numbers.each do |video_number|
check_and_upload(node.id, node.tags['media:video_device_number'], video_number, node.lat, node.lon, node.name, 'video')
end
end
if node.tags['media:camera_device_number'] and node.tags['media:camera_number']
camera_numbers = node.tags['media:camera_number'].split(",")
camera_numbers.each do |camera_number|
check_and_upload(node.id, node.tags['media:camera_device_number'], camera_number, node.lat, node.lon, node.name, 'camera')
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end",
"def get_uploads2( subscription_url )\n #raise ActiveSupport::Base64.decode64( subscription_url ).to_yaml\n movie = {}\n\n status = \"false\"\n count = ''\n upload_index = ''\n upload_counts = ''\n upload_index = \"1\"\n while status = \"false\"\n url = \"#{subscription_url}?start-index=#{upload_index}\"\n # uploadされている動画ごとのURLを配列で取得\n upload_counts,upload_index,item_counts_per_page,upload_feed_urls = \n get_uploads_entry_url( url )\n\n count = upload_counts - upload_index\n\n if item_counts_per_page > count\n status = \"true\"\n else\n upload_feed_urls.each do |upload_feed_url|\n upload_feed_xml = get_channnel_xml( upload_feed_url ) \n doc = REXML::Document.new( upload_feed_xml )\n # http://gdata.youtube.com/feeds/api/users/playyouhousejp/uploads/M8nu4gkOlbI\n id = doc.elements[\"/entry/id\"].text\n movie_title = doc.elements[\"/entry/media:group/media:title/\"].text\n movie_thumbnail = doc.elements[\"/entry/media:group/media:thumbnail/\"].attributes['url']\n movie_play_url = doc.elements[\"/entry/media:group/media:player/\"].attributes['url']\n\n # 各movie情報をIDをキーにして値に情報群のハッシュを配列構造を持たせる\n movie_array = [\n \"movie_title\" => movie_title,\n \"movie_thumbnail\" => movie_thumbnail,\n \"movie_play_url\" => movie_play_url,\n ]\n movie[\"#{id}\"] = movie_array\n end\n\n upload_index += 1\n end\n end\n\n return movie\n end",
"def producer_public_videos(page_token = '')\n\n @producer_public_videos ||= begin\n result = []\n\n channels_response = get_channel_data\n uploads_list_id = channels_response.data.items.first['contentDetails']['relatedPlaylists']['uploads']\n\n public_uploads = get_public_uploads(uploads_list_id, page_token) \n playlist_items = public_uploads.items\n video_ids = playlist_items.map { |item| item[\"snippet\"][\"resourceId\"][\"videoId\"] }\n\n metadata_list = get_metadata(video_ids)\n duration_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"contentDetails\"][\"duration\"] }\n end.reduce(&:merge)\n\n view_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"statistics\"][\"viewCount\"] }\n end.reduce(&:merge)\n\n { \n :next_page_token => public_uploads.next_page_token, \n :items => serialize_playlist_items(playlist_items, duration_hash, view_hash)\n }\n end\n end",
"def videos_test\n end",
"def call\n videos = search_youtube\n if videos.any?\n r = context.redis_instance\n user_key = context.user.search_key\n # delete current users video list\n r.del user_key\n message = []\n videos.each.with_index do |video, idx|\n # push videos to list\n video_obj = { id: video.id, title: video.title }\n r.rpush user_key, video_obj.to_json\n message.push [ idx, video.title ].join(\" - \")\n end\n r.expire user_key, 60 unless Rails.env.development?\n message.push \"THIS MESSAGE WILL BE DESTROYED IN 60 SECONDS\"\n context.message = message.join \"\\n\"\n else\n context.errors = \"Sorry but couldn't find any vides for #{query}.\"\n context.fail!\n end\n end",
"def get_vidio_playlist key id\n\t#playlstId is the Uploads ID in channel_details\n\tchannel_vidios = Youtube.get('/playlistItems?part=snippet&playlistId=UU-lHJZR3Gqxm24_Vd_AJ5Yw&key=' + key)\nend",
"def get_datas\n tnurl=\"/images/no-image.jpg\"\n if self.source_url.match(/(youtube.com*)/)\n vid=self.source_url.match(/=([A-Za-z0-9]*)/) ? self.source_url.match(/=([A-Za-z0-9\\d_\\-]*)/)[0].gsub(/=/,'') : self.source_url\n unless vid.blank?\n \n client=YouTubeIt::Client.new(:dev_key => YOUTUBE_API_KEY)\n \n \n begin\n youtube_data=client.video_by(vid)\n rescue\n youtube_data=nil\n self.errors.add(:source_url, \"Invalid video url, removed from youtube\")\n self.source_url=nil\n end \n \n \n unless youtube_data.nil? \n self.title= self.title.blank? ? youtube_data.title : self.title\n self.description= self.description.blank? ? youtube_data.description : self.description\n tnurl=youtube_data.thumbnails[0].url\n self.media_content_url=youtube_data.media_content[0].url\n end\n end\n self.provider=\"youtube\"\n elsif self.source_url.match(/(vimeo.com*)/)\n tnurl='/images/video/vimeo.png' \n vid=self.source_url.match(/vimeo.com\\/([^&]+)/)[1]\n unless vid.blank?\n vimeo_data=Vimeo::Simple::Video.info(vid)\n if vimeo_data && vimeo_data.size>0\n tnurl=vimeo_data[0][\"thumbnail_medium\"]\n self.title= self.title.blank? ? vimeo_data[0][\"title\"] : self.title\n self.description= self.description.blank? ? vimeo_data[0][\"description\"] : self.description\n end\n end\n\n #self.media_content_url=\"/videos/#{self.id}\"\n\n\n self.media_content_url=\"http://www.vimeo.com/moogaloop.swf?clip_id=#{vid}&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=\"\n self.provider=\"vimeo\"\n elsif self.source_url.match(/(dailymotion.com*)/)\n self.provider=\"dailymotion\" \n tnurl='/images/video/dailymotion.png' \n elsif self.source_url.match(/(myspace.com*)/)\n self.provider=\"myspace\" \n tnurl='/images/video/myspace.png' \n end\n\n self.thumbnail_url=tnurl\n\n\n end",
"def keepvid_urls(url)\n doc = Hpricot(open(\"http://keepvid.com/?url=#{URI.escape(url)}\"))\n urls = {}\n (doc/\"a\").each do |e|\n if (href = e.attributes[\"href\"]) =~ /save-video\\.(\\w{3})/\n urls[$1.to_sym] = \"http://keepvid.com#{href}\"\n end\n end\n\n # flv\n # http://keepvid.com/save-video.flv?http%3A%2F%2Fwww.youtube.com%2Fget_video%3Fvideo_id%3DtsgXMRB4TeQ%26t%3DOEgsToPDskKWdRg2fuNSdntV1dNSi1H5\n \n # mp4\n # http://keepvid.com/save-video.mp4?http%3A%2F%2Fwww.youtube.com%2Fget_video%3Fvideo_id%3DtsgXMRB4TeQ%26t%3DOEgsToPDskKWdRg2fuNSdntV1dNSi1H5%26fmt%3D18\n \n urls\nend",
"def create_videos\n end",
"def each_turns_next_video\n videos = user_rota.all.map{ |user| Video.next_for(user) }.compact\n if videos.any?\n videos\n else\n Video.pending\n end\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def valid_videos\n self.videos.select{ |video|\n video.exist? && video.embed? && video.auto_play?\n }\n end",
"def finish_events\n audio_event = @vj.fetch_last_event(:audio)\n audio_event.set_duration_now! unless audio_event.nil?\n video_event = @vj.fetch_last_event(:video)\n video_event.set_duration_now! unless video_event.nil?\n end",
"def has_videos?\n videos[:list][I18n.locale.to_sym].length > 0 || videos[:mpg][I18n.locale.to_sym].length > 0\n end",
"def magic\n\t @word = Word.find(params[:id])\n\t\ttitle = @word.title\n if params[:more]\n\t\t @pics = Rails.cache.fetch(\"olive/#{title}\",:expires_in => 5.hours) do\n \t\t\tresults = Parallel.map([Olive::Tumblr,Olive::Instagram,Olive::Px]) do |p|\n \t\t\t\tphotos(p,title)\n \t\t\tend\n \t\t\tresults[0] + results[1] + results[2]\n \t\tend\n \telse\n \t opt = params[:ctag].blank? ? '' : @word.ctag_list.join(\" \")\n @pics = Grape::WordImage.new(title).parse(opt)[0..14]\n\t end\n\n\t\trender_json 0,\"ok\",@pics\n\tend",
"def getVideoURL\n if (request.post?)\n cVideoID = self.findKeyInJSON(params[:params], \"VideoID\", 2)\n cOS = self.findKeyInJSON(params[:params], \"OS\", 2)\n \n case cOS.to_s\n when \"100\"\n # We have that file stored in S3 yet?\n # Check it later!\n # Just hard-code it\n returnFileName = \"http://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vods3/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n returnFileName += \"/playlist.m3u8\"\n when \"101\"\n # android\n returnFileName = \"rtsp://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vod/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n else\n # ignore\n end\n \n # Update Video Played Count\n begin\n b = Videotemp.find(cVideoID)\n if(b.playedCount == nil || b.playedCount == '')\n playedCount = 1\n else\n playedCount = b.playedCount\n playedCount = playedCount.to_i + 1\n end\n b.playedCount = playedCount.to_i\n b.save\n rescue Exception => e\n # ignore\n end\n \n # Return JSON response\n cRequestID = self.findKeyInJSON(params[:params], \"RequestID\", 1)\n rData = {\"VideoStreamUrl\" => returnFileName}\n self.jsonRender(rData, 'WOWZA URL', cRequestID, '100')\n end\n end",
"def video_names \n\t\tvideos.map{|v| v.name}\n\tend",
"def videos\n @hot_video_mapper.build_video_items(@list_data['items'])\n end",
"def get_channel_vidios key\n\tchannel_details = Youtube.get('/channels?part=contentDetails&id=UC-lHJZR3Gqxm24_Vd_AJ5Yw&key' + key)\n\t\n\n\tp channel_details\n\tget_vidio_playlist key id\nend",
"def tags\n if properties.key?(:media_content) and\n properties[:media_content][:url].present? and\n properties.key?(:media_thumbnail) and\n properties[:media_thumbnail][:url].present?\n %w[image]\n else\n []\n end\n end",
"def analyze_session session\n watched_video_set = Set.new\n conversion_complete = false\n \n mark_landing = false\n version = \"\"\n analyze session do |action|\n if !mark_landing && action[\"_type\"] == \"page_load\"\n unless front_porch? action\n return\n end\n mark_landing = true\n version = extract_version action[\"pageurl\"] \n end\n\n if action[\"_type\"] == \"play_action\"\n if action[\"packageid\"] == \"4\"\n watched_video_set.add \"Free Episode\"\n elsif action[\"packageid\"] == \"5\"\n watched_video_set.add \"90s\"\n end\n elsif action[\"_type\"] == \"slider_action\"\n if action[\"pageurl\"] =~ /^http:\\/\\/www2\\.hulu\\.jp\\/?(\\?.*)?$/\n puts action[\"pageurl\"]\n watched_video_set.add \"Homepage Preview\"\n end\n elsif action[\"_type\"] == \"page_load\" \n if conversion? action\n conversion_complete = true\n end\n end\n end\n\n unless mark_landing\n return\n end\n if conversion_complete\n @total_conversions[version] ||= 0\n @total_conversions[version] += 1\n watched_video_set.each do |content_id|\n @watch_conversions[version] ||= {}\n @watch_conversions[version][content_id] ||= 0\n @watch_conversions[version][content_id] += 1\n end \n end\n watched_video_set.each do |content_id|\n @total_visitors[version] ||= 0\n @total_visitors[version] += 1\n @watch_visitors[version] ||= {}\n @watch_visitors[version][content_id] ||= 0\n @watch_visitors[version][content_id] += 1\n end \n end",
"def videos_params\n params.require(:video).permit(:title, :author, :year, :duration, :video_url, :image_url, :is_winner, :is_entrant, :is_other, :id_for_app)\n end",
"def public_videos\n Video.joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).where(:channel_id => self.channels.where(:private => false).collect(&:id))\n end",
"def find_speaker(photos)\n photos.select { |p| p.has_key?('caption') && p['caption'] == '_SPEAKER_' }\nend",
"def video_previews_in_all_languages\n previews = []\n (videos[:list][:es] + [videos[:featured][:es]]).compact.each do |video|\n filename = video.sub(/#{Pathname.new(video).extname}$/, '')\n video_filename_without_extension = filename.gsub(/_(#{Document::LANGUAGES.join('|')})$/, '')\n previews << \"#{class_multimedia_path}#{video_filename_without_extension}.jpg\"\n Document::LANGUAGES.each do |l|\n previews<< \"#{class_multimedia_path}#{video_filename_without_extension}_#{l}.jpg\"\n end\n end\n return previews\n end",
"def create \n @video = Video.new() #get the attachemnt and create a video object with it\n\n if @video.save #if it saves then get the urll\n @video.create_url(params[:filepath]) \n\n if signed_in? #if the user is signed in add the video to their account\n current_user.videos << @video \n\n else #if they arent't uses sessions and a delete key\n @video.session_id = SecureRandom.urlsafe_base64(15) \n @video.delete_key = SecureRandom.urlsafe_base64(30) \n session[:owned_videos] ||= [] #if the current session doesn't have any owned_videos then create the array\n session[:owned_videos] << @video.session_id #add videos session id to array\n end\n\n @video.save \n send_to_heywatch @video\n render json: {url: \"/videos/#{@video.id}\"}\n else #error saving the video take them back to try again TODO show errors\n redirect_to \"/\"\n \n end\n end",
"def search_by_tags(tags,page,per_page)\n begin\n\t args = { 'dev_id'=>@api_key, \n\t 'tag' => tags,\n\t 'per_page' => per_page,\n 'page' => page }\n videos = xmlrpc_get_xml('youtube.videos.list_by_tag',args,'//video') \n rvideos = []\n for video in videos\n html = html_code(video.elements[\"id\"].text,\n video.elements[\"thumbnail_url\"].text ) \n v = { :title => video.elements[\"title\"].text,\n :thumb => video.elements[\"thumbnail_url\"].text,\n :thumb_width => 80,\n :thumb_height => 60,\n :creator => video.elements[\"author\"].text,\n\t :html => html }\t \n\t rvideos << v\n\t end\n\t return rvideos\n \t rescue Exception\n return nil\n\t end \t \t \n\tend",
"def contains_video?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_video?}\n result\n end",
"def recommend_videos\n #recommend only videos\n @id = current_user.id\n @tags = params[:tags]\n limit = 50 / @tags.count\n limit += 1 if limit == 0\n counter = 0\n offset = params[:offset] #how many posts to skip before returning the new data\n @recommended_video_posts = Array.new\n @post = Post.find(params[:post_id]) #the reference post for the recommendations\n @post_user = @post.user #the reference post user\n #loop through the tags of the video in order to derive their associated posts\n if @tags.any?\n @tags.each do |tag|\n if counter > 50\n break\n end\n Tag.where(\"text ILIKE ?\", \"%#{tag}%\").order(view_count: :desc, likes_count: :desc, created_at: :desc, id: :asc).offset(offset).limit(limit).find_each do |tag|\n post = tag.post\n url = post.posts_media_url\n #only add the post to the array if it is in a movie format(mp4, mov)\n @recommended_video_posts << post if !current_user.reported_posts.include?(post) and (url.end_with?(\"mov\") or url.end_with?(\"mp4\")) and (post.id != @post.id)\n end\n counter += 1\n end\n end \n if @recommended_video_posts.any? \n #sort the recommended posts so that the creator of the reference post has his or her content more prevalant.\n @recommended_video_posts.sort! do |a,b|\n if a.user == @post_user and b.user != @post_user\n return -1\n elsif b.user == @post_user and a.user != @post_user\n return 1\n elsif a.user != @post_user and b.user != @post.user\n return -1\n else\n return 0\n end\n end\n render :recommend_videos, status: 200\n else\n render json: nil, status: 404\n end\n end",
"def download_all_videos_from_pl id,d_name\n\tmy_directory = \"#{@dir}#{d_name}\"\n\n\t videos_already_saved_array = get_all_titles_from_dir my_directory\n\n\t videos_already_saved_titles, videos_already_saved_paths = \n\t \t\t\t\t\tvideos_already_saved_array.map{|e| e[0]}, videos_already_saved_array.map{|e| e[2]}\n\n\t@current_playlist_video_titles.each do |v|\n\t\t\tsource = 'youtube'\n\t\t\tindex = @current_playlist_video_titles.index(v)\n\t\t\tp index\n\t\t\tvid = @current_playlist_video_ids[index]\n\t\t\tp vid\n\n\t\tif !videos_already_saved_titles.include?(v)\t\n\t\t\t\n\t\t\tvideo_string = \"http://www.youtube.com/watch?v=#{vid}\"\n\t\t\tdownload_video = \"viddl-rb #{video_string} -d 'aria2c' -s '#{my_directory}'\"\n\n\t\t\tcaptured_stdout = ''\n\t\t\tcaptured_stderr = ''\n\t\t\tstdin, stdout, stderr, wait_thr = Open3.popen3(\"#{download_video}\")\n\t\t\tpid = wait_thr.pid\n\t\t\tstdin.close\n\t\t\tcaptured_stdout = stdout.gets(nil)\n\t\t\taborted = captured_stdout.include? \"Download aborted\"\n \t\t\t# captured_stderr = stderr.read\n\t\t\twait_thr.value # Process::Status object returned\n\n\t# extract the info we need\n\t\t\tputs \"STDOUT: \" + captured_stdout\n\t\t\t# puts \"STDERR: \" + captured_stderr\n\n\t\t\t# go to Vimeo to download if it doesnt work\n\t\t\tif aborted\n\t\t\t\tartist_match_results = match_best v, @rule_artists\n\t\t\t\t@song_artist = artist_match_results[0]\n\t\t\t\tremaining_words = artist_match_results[1]\n\t\t\t\tsong_match_results = match_best remaining_words, @rule_titles\n\t\t\t\t@song_title = song_match_results[0]\n\n\t\t\t\tsource='vimeo'\n\t\t\t\tget_vimeo_manually @song_artist,@song_title,@mydir,\"vimeo\"\n\t\t\t\t# Process.kill(\"KILL\", stream.pid)\n\t\t\t\t# get_vimeo_manually v,my_directory,source \n\t\t\tend\n\n\t\t\tp \"already have it\" if videos_already_saved_titles.include?(v)\n\t\tend\n\n\n\tend\n\n\t\nend",
"def set_video_metatags! tags, record\n metadata = record.vimeo_metadata\n metadata = metadata[:horizontal] if metadata.key?(:horizontal)\n return unless metadata.present?\n\n tags.merge!({\n 'og:type' => 'video.other',\n 'og:image' => metadata[:thumbnail],\n 'og:video' => metadata[:download_url],\n 'og:video:duration' => metadata[:duration],\n 'og:video:release_date' => record.created_at.to_s(:db),\n 'twitter:card' => 'player',\n 'twitter:player:url' => metadata[:embed_url],\n 'twitter:player:width' => metadata[:width],\n 'twitter:player:height' => metadata[:height],\n })\n end",
"def show\n @video = Video.find(params[:id])\n @profesor = @video.profesor\n @observador = @video.observador\n delete_key = @video.attach_file_name\n end",
"def index\n @camera = Camera.find_by(id: params[:camera_id])\n unless @camera\n @q = current_user.videos.ransack params[:q]\n @videos = @q.result.latest.page(params[:page]).per 6\n else\n unless @camera.user == current_user\n flash[:danger] = \"You don't have permissions!\"\n redirect_to cameras_path\n else\n @q = @camera.videos.ransack params[:q]\n @videos = @q.result.latest.page(params[:page]).per 6\n end\n end\n\n\n end",
"def hash\n [ad_mode_begin, ad_mode_complete, bytes_delivered, engagement_score, play_rate, play_request, video, duration, video_engagement_1, video_engagement_25, video_engagement_50, video_engagement_75, video_engagement_100, video_impression, name, video_percent_viewed, video_seconds_viewed, video_view].hash\n end",
"def index\n\t\t\n\t\t#session[:test] = \"xxx\"\n\t\t#render :text => session[:valid_api_key] and return \n\t\t\n\t\t@menuItem = \"home\"\n\t\t\n\t\t#if request.fullpath.include?(\"/lang/\")\n\t\t#\tredirect_to(\"/\")\n\t\t#\treturn\n\t\t#enA\n\t\t\n\t\tif params[:route]\n\t\t\tresult = Route.find_by_sql([\"select video_id from routes where id = ? limit 1\", params[:route]])\n\t\t\tredirect_to(:action => 'video', :video_id => result[0].video_id) and return if (result && result.length == 1 && result[0].video_id)\n\t\tend\n\t\t\n\t\tsession[:return_to] = request.fullpath\n\t\t@page_title = @vm_string_table[:web_title_index]\n\t\t\n\t\tflash[:login] ? @login_message = flash[:login] : @login_message = \"\"\n\t\n\t\t#New tracks\n\t\t@videos_new = Video.find_by_sql(\"SELECT start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, submitted_at, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on uploads.id = videos.upload_id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by submitted_at desc limit 4\")\n\t\n\t\t#Popular tracks\n\t\t@videos_popular = Video.find_by_sql(\"SELECT start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, times_played/(DATEDIFF(now(), submitted_at)+1) as performance, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on uploads.id = videos.upload_id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by performance desc limit 4\")\n\t\t\n\t\t#Recently played\n\t\t@videos_recently = Video.find_by_sql(\"SELECT start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on videos.upload_id = uploads.id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by latest_playback desc limit 4\")\n\t\n\t\t#Random route\n\t\t@random_route = Route.find_by_sql(\"SELECT videos.youtube, times_played, routes.id as route_id FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by rand() limit 1\")[0]\n\t\t\n\t\t#Slider\n\t\t@slider = Video.find_by_sql(\"select * from (SELECT content, start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, times_played/(DATEDIFF(now(), submitted_at)+1) as performance, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on uploads.id = videos.upload_id inner join contents on contents.city like end_locality_en where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by performance desc limit 20) tab order by rand()\")\n\t\t#######\n\t\t\t\t\n\t\trender :action => 'startpage_'+@vm_language\n\tend",
"def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend",
"def rss_video\n @language = params[:DLANG] || 'ENG'\n I18n.locale = @locale = Language::CODE3_LOCALE[@language] || :en\n\n @days = params[:DAYS].to_i || 1\n @days = 1 if @days > 31 || @days < 1\n\n @host = \"#{request.protocol}#{request.host}#{request.port == 80 ? '' : \":#{request.port}\"}\"\n\n # Get list of updated files\n @files = get_updated_files(@days).map do |file|\n {\n lesson_id: file[0],\n title: get_lesson_title(file[0], @language),\n updated: file[1][0].updated,\n files: file[1].group_by { |x| x['ftype'].downcase }\n }\n end.select do |file|\n file[:title]\n end\n end",
"def after_save(video) \n expire_cache_for(video) \n end",
"def show\n gon.videos = []\n gon.videos_urls = []\n gon.tags = []\n @course.holes.each do |hole|\n gon.videos << hole.video if hole.video.present?\n gon.videos_urls << hole.video.video if hole.video.present?\n gon.tags << hole.video.tags if hole.video.present?\n end\n end",
"def prominence!\n @filters[:prominent].each do |filter|\n @query = Ydl::Videos.where(filter => @options[filter])\n return @query if @query.any?\n end\n end",
"def index\n begin\n keyword_id = params[:keyword_id]\n @type = params[:type]\n if !keyword_id.blank?\n @keyword = Keyword.find(keyword_id)\n @media = @keyword.media.paginate(:per_page => Medium::COLS * Medium::ROWS, :page => params[:page]) # :total_entries => @keyword.media.size\n @title = \"#{Medium.model_name.human(:count => :many).titleize} Associated with Keyword \\\"#{@keyword.title}\\\"\".s\n else\n if [email protected]?\n @media = Medium.where(:type => @type).order('created_on DESC')\n @media = @media.send(session[:filter]) if !session[:filter].blank?\n @media = @media.paginate(:per_page => Medium::FULL_COLS * Medium::FULL_ROWS, :page => params[:page]) # :total_entries => Medium.where(:type => @type).count\n @title = @type.constantize.model_name.human.titleize.pluralize\n else\n #@pictures = Picture.all.limit(Medium::COLS * Medium::PREVIEW_ROWS).order('RAND()')\n # TODO: railsify the sql query below\n @pictures = Picture.find_by_sql [\"SELECT * FROM media m JOIN (SELECT MAX(ID) AS ID FROM media) AS m2 ON m.ID >= FLOOR(m2.ID*RAND()) where m.type = 'Picture' LIMIT ?\", Medium::COLS * Medium::PREVIEW_ROWS]\n @videos = Video.order('RAND()').limit(Medium::COLS)\n @documents = Document.order('RAND()').limit(Medium::COLS)\n @online_resources = OnlineResource.order('RAND()').limit(Medium::COLS)\n @titles = { :picture => ts(:daily, :what => Picture.model_name.human(:count => :many).titleize), :video => ts(:daily, :what => Video.model_name.human(:count => :many).titleize), :document => ts(:daily, :what => Document.model_name.human(:count => :many).titleize), :online_resource => ts(:daily, :what => OnlineResource.model_name.human(:count => :many).titleize) }\n @more = { :type => '' }\n end\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to media_path\n else\n respond_to do |format|\n format.html do\n @media_search = MediaSearch.new({:title => '', :type => 'simple'})\n @current_tab_id = :home\n @current_tab_id = @type.underscore.to_sym unless @type.blank?\n if defined? @media.offset\n if @type == 'Document'\n render 'documents/paged_index_full'\n elsif @type == 'OnlineResource'\n render 'online_resources/paged_index_full'\n else\n if @type.blank?\n calculate_keyword_font_sizes\n render 'paged_index'\n else\n render 'paged_index_full'\n end\n end\n else\n calculate_keyword_font_sizes\n # render index.rhtml\n end\n end\n format.js # index.js.erb\n format.xml do\n @media = Medium.all.order('id')\n render :xml => @media\n end\n format.json do\n @media = Medium.all.order('id')\n render :json => @media #Hash.from_xml(render_to_string(:action => 'index.xml.builder'))\n end\n end\n end\n end",
"def video_names \n\t\tvideo_trainings.map{|v| v.name}\n\tend",
"def index\n # if params[:search] and params[:tag]\n # @media_files = MediaBookmark.where( \"lower(topic) like ? or lower(description) like ? or lower(title) like ?\", \n # \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\").page(params[:page])\n \n # elsif params[:search]\n # @media_bookmarks = MediaBookmark.where( \"lower(topic) like ? or lower(description) like ? or lower(title) like ?\", \n # \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\").page(params[:page])\n # elsif params[:tag]\n # @current_tag = params[:tag]\n # @media_bookmarks = MediaBookmark.tagged_with(params[:tag]).page(params[:page])\n # else\n # @media_bookmarks = MediaBookmark.all.page(params[:page])\n # end\n # @media_bookmarks_topic = @media_bookmarks.group_by { |t| t.topic }\n\n @media_files = MediaFile.all.page(params[:page])\n end",
"def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end",
"def scenario_results_with_videos\n scenario_result_id_to_count = StepVideo\n .where.not(result_step_id: nil) # most likely aborted during uploaded\n .group(:scenario_result_id).count\n scenario_result_ids_with_videos = scenario_result_id_to_count.select { |key, value| value > 1 }\n ScenarioResult.where(id: scenario_result_ids_with_videos.keys)\n end",
"def video_tracks\n tracks.select { |t| t.video? }\n end",
"def video_tracks\n tracks.select { |t| t.video? }\n end",
"def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end",
"def index\n ip = index_params()\n published = ip[:published].boolean? ? ip[:published] : (ip[:published].nil? ? DEFAULT_PUBLISHED : ip[:published].to_b)\n @videos = Video.includes(:video_motifs).where(:published => published)\n @motif_ids = ip[:motif_ids] || (ip[:query] || []).select { |val|\n val.starts_with? '__'\n }.map { |val| val[2..-1] }\n @keywords = ip[:keywords] || (ip[:query] || []).select { |val|\n !val.starts_with? '__'\n }\n @videos = @videos.has_combined_motifs(@motif_ids) if !@motif_ids.empty?\n @videos = @videos.keywords_include(@keywords) if [email protected]?\n @videos = @videos.order('created_at DESC')\n render :json => @videos, :include => ALL_INCLUDES\n end",
"def index\n @story_categories = StoryCategory.all\n @video_categories = NsojTvCategory.all.order(\"created_at DESC\")\n @categoryMode = false\n @hide_main_nav = true\n\n @forward_link = \"\"\n @selected_video = nil\n @category = nil\n @videos = nil\n\n if params.has_key?(:vc)\n @category = NsojTvCategory.where(\"lower(title) = ?\", params[:vc]).first\n if [email protected]?\n @forward_link = \"vc=#{params[:vc]}&\"\n @videos = NsojTv.where(nsoj_tv_category_id: @category.id).order(\"created_at DESC\")\n end\n end\n\n if params.has_key?(:v)\n @selected_video = NsojTv.where(\"link ilike '%#{params[:v]}%'\").first\n puts(\"Selected video '#{@selected_video.title}'\")\n end\n\n if @videos.nil?\n @videos = NsojTv.order(\"created_at DESC\")\n end\n\n if @selected_video.nil?\n @selected_video = @videos.first\n \n @selected_video.touch(:last_accessed_at)\n @selected_video.increment!(:access_counter)\n end\n\n end",
"def featured_videos\n Video.joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).where(:channel_id => self.channels.where(:featured => true).collect(&:id)).order('featured_at DESC')\n end",
"def add_video_to_my_queues(video)\n visit home_path\n #find(\"a[href='/videos/#{video.to_param}']\").click\n find(\"a[href='/videos/#{video.token}']\").click\n click_link \"+ My Queue\"\n end",
"def combine_video(presentation)\n term = presentation['term']\n args = []\n for slide in presentation['slides']\n args.push command_arg(slide['video'])\n end\n args = args.join(' ')\n combined_arg = command_arg(\"#{BUILD_DIR}/#{term}/#{term}-combined.mpg\")\n final = \"#{DIST_DIR}/#{term}/#{term}.avi\"\n final_arg = command_arg(final)\n `cat #{args} > #{combined_arg}`\n `ffmpeg -y -i #{combined_arg} -r 25 -qscale:v 1 #{final_arg}`\n presentation['video'] = final\nend",
"def index \n @pos = 0\n if params[:name] != nil && (params[:name][0..3] == \"http\" || params[:name][0..2] == \"www\")\n client = YouTubeIt::Client.new(:dev_key => \"AI39si4IGrrB9qyNNgKqtW7YKqTSxpG54pBcyVZ8wQANOPcKeDVgGDorcP9DkrxFcPsI_gW3pJ0T2oAFB3stXtaWG_hbAsdNfA\")\n playlist_id = params[:name].split('=').last\n new_playlist = Playlist.new\n new_playlist.update_attributes(:name => client.playlist(playlist_id).title, :position => 1)\n new_playlist.save\n @isprelist = true\n @agent ||= init_agent\n page = @agent.get(params[:name])\n len = page.at(\"#watch7-playlist-length\").text.to_i rescue nil\n if len == nil\n len = page.at(\".first .stat-value\").text.to_i\n end\n startindex = 1\n maxresults = 0\n while len - startindex > 0\n if len - startindex > 50\n maxresults = 50\n else\n maxresults = len - maxresults\n end\n playlist_vids = client.playlist(playlist_id, {'start-index' => startindex, 'max-results' => maxresults}).videos\n for vid in playlist_vids\n new_vid = new_playlist.videos.build\n title = vid.title\n norm_url = \"www.youtube.com/watch?v=\" + vid.media_content[0].url.split('?')[0].split('/').last\n url = vid.media_content[0].url rescue nil\n thumb_url = vid.thumbnails[0].url\n width = 560.to_s\n height = 315.to_s\n embed = '<iframe width=' + width + ' height=' + height + ' src=' + url + ' frameborder=\"0\" allowfullscreen></iframe>'\n new_vid.copy_vids(title, norm_url, thumb_url, \"Youtube\", embed)\n startindex += 1\n end\n end\n @playlists = new_playlist\n else\n current_user.update_attribute(:last_psearch, params[:name])\n @isprelist = false\n @playlists = Playlist.order(:name).where(\"name like ?\", \"%#{current_user.last_psearch}%\")\n @playlists = @playlists.order(\"cached_votes_up DESC\")\n @playlists = @playlists.where(\"privacy = 'Public'\")\n @playlists = @playlists.paginate(:page => params[:page], :per_page => 2)\n end\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def liked_videos\n video_ids = self.likes.where(likeable_type: \"Video\").where(is_like: true).map {|like| like.likeable_id}\n Video.with_attached_video_file.find(video_ids)\n end",
"def movies_disliked_key\n \"user:#{self.id}:movies_disliked\" \n end",
"def build_video_metadata record, tags\n return unless record.try(:vimeo_metadata).present?\n\n {\n '@context' => 'http://schema.org',\n '@type' => 'VideoObject',\n 'publisher' => build_organization_metadata,\n 'name' => tags['og:title'],\n 'description' => tags['og:description'],\n 'uploadDate' => tags['og:article:published_time'],\n 'image' => tags['og:image'],\n 'thumbnailUrl' => tags['og:image'],\n 'contentUrl' => tags['og:video'],\n 'embedUrl' => tags['twitter:player:url'],\n 'duration' => tags['og:video:duration'],\n 'interactionCount' => record.try(:views),\n }\n end",
"def tag_bucket(photos, name: \"Tag Bucket\")\n # We're not sure how many unique tags there are in each sectionm\n # but we can find out in O(t) time\n # we could also specialize approaches for each type of input\n\n # do we try to compose ideal slides based on tags?\n all_tags = {}\n\n # if slides == nil\n # slides = []\n\n # # O(n)\n # photos.each do |photo|\n # slides << Slide.new([photo])\n # end\n # end\n\n slides = verts(photos).slides\n\n # O(t), where t is number of tags\n # O(n*t) space?\n slides.each do |slide|\n slide.tags.each do |tag_name, present|\n all_tags[tag_name] = [] unless all_tags.key?(tag_name)\n all_tags[tag_name] << slide\n end\n end\n\n slideshow = SlideShow.new(name: name)\n added_slides = {}\n\n all_tags.each do |tag_name, tag_bucket|\n available_slides = []\n tag_bucket.each do |tagged_slide|\n available_slides << tagged_slide unless added_slides.key?(tagged_slide)\n # slideshow.add_slide(tagged_slide)\n added_slides[tagged_slide] = true\n end\n next if available_slides.size == 0\n\n # convet the slides back to photos since we're going\n # to pass it through another system\n\n tmp_photos = []\n available_slides.each do |slide|\n tmp_photos += slide.photos\n end\n\n # Use an alternate strategy inside the bucket depending on how large it is\n if available_slides.size <= BRUTE_LIMIT\n tmp_show = brute(tmp_photos)\n elsif available_slides.size <= GREEDY_LIMIT\n tmp_show = greedy_cycle(tmp_photos)\n else\n tmp_show = greedy_cycle_glue(tmp_photos)\n end\n\n # alt approach =\n if available_slides.size > BRUTE_LIMIT\n annealing_show = simulated_annealing(tmp_photos)\n else\n annealing_show = nil\n end\n\n if annealing_show && annealing_show.score > tmp_show.score\n step_2 = annealing_show\n else\n step_2 = tmp_show\n end\n\n step_2.slides.each do |slide|\n slideshow.add_slide(slide)\n end\n\n end\n\n\n pees = []\n slideshow.slides.each do |slide|\n pees += slide.photos\n end\n\n anneal_show = simulated_annealing(pees)\n slideshow.slides = anneal_show.slides\n\n\n slideshow\n end",
"def check_if_encoded_and_get_thumbnail_urls(queue_again = false)\n details = self.vimeo_details\n return false if details.blank?\n # If it's already been tried twice just re-upload it\n if self.ecc >= 2\n self.ecc = 0\n self.redo_vimeo_transfer\n else\n # Set as transcoded if it has completed\n self.vimeod = true if details['is_transcoding'].to_i == 0\n # Save image thumbnails\n if details['thumbnails'].present? && details['thumbnails']['thumbnail'].present? && details['thumbnails']['thumbnail'].last['_content'].match(/default\\..*\\.jpg/) == nil\n self.remote_image_url = details['thumbnails']['thumbnail'].last['_content']\n elsif queue_again\n self.ecc += 1\n Resque.enqueue_in(20.minutes, Video, self.id) # queue to check and see if it got encoded\n false\n end\n self.save\n end\n end",
"def media_list\n @redis.hkeys(\"contact_media:#{self.id}\") - ['pagerduty']\n end",
"def select_streams(info)\n unless info[:video].empty?\n # There can be only one (video stream).\n info[:video] = info[:video].first\n end\n\n unless info[:audio].empty?\n audio_streams = []\n audio_stream = nil\n\n # Finds the highest quality English audio stream available\n info[:audio].each do |s|\n if s[:language] == 'eng'\n # Surround tracks\n audio_stream ||= s if s[:codec] == 'dts' # DTS\n audio_stream ||= s if s[:codec] == 'dca' # DTS (older ffmpeg)\n audio_stream ||= s if s[:codec] == 'eac3' # Dolby Digital Plus\n audio_stream ||= s if s[:codec] == 'ac3' # Dolby Digital\n # Stereo tracks\n audio_stream ||= s if s[:codec] == 'alac' # Apple lossless\n audio_stream ||= s if s[:codec] == 'flac' # Open-source lossless\n audio_stream ||= s if s[:codec] == 'opus' # Open-source lossy\n audio_stream ||= s if s[:codec] == 'aac' # AAC\n audio_stream ||= s if s[:codec] == 'vorbis' # OGG Vorbis\n audio_stream ||= s if s[:codec] == 'mp3' # MP3\n end\n end\n\n audio_streams << audio_stream if audio_stream != nil\n\n # Adds all of the non-English audio streams.\n info[:audio].each do |s|\n if s[:language] != 'eng'\n audio_streams << s\n end\n end\n\n info[:audio] = audio_streams\n end\n \n unless info[:subtitle].empty?\n # Removes all non-english subtitle streams.\n info[:subtitle].delete_if { |s| s[:language] != 'eng' }\n\n # Removes Bluray PGS subtitles because ffmpeg doesn't have encoding nor OCR support.\n info[:subtitle].delete_if { |s| s[:codec] == 'hdmv_pgs_subtitle' }\n\n # Removes subtitles marked as \"signs and songs\" which are usually forced.\n info[:subtitle].delete_if { |s| s[:title].downcase.include? 'sign' }\n\n # Default to the last subtitle stream (first one is usually forced subs)\n info[:subtitle] = info[:subtitle].last unless info[:subtitle].empty?\n end\n\n return info\nend",
"def checkForThumbs(commit) #:doc:\n prev_commit_blob_ids = Array.new\n prev_commit = Commit.find(:first, :conditions => [\"id = ?\", commit.previous_commit_id])\n if prev_commit\n prev_commit.blobs.find_each(:batch_size => 1500) do |pb|\n prev_commit_blob_ids.push(pb.id)\n end\n end\n \n blobs_without_thumb = Array.new\n new_thumbs = 0\n new_thumbs_without_thumb = 0\n prev_thumbs_ok = true\n commit.blobs.find_each(:batch_size => 1500) do |blob|\n if blob.thumbnail_name == nil and not prev_commit_blob_ids.include?(blob.id) and not blobs_without_thumb.include?(blob.blob_hash)\n blobs_without_thumb.push(blob.blob_hash)\n new_thumbs_without_thumb += 1\n new_thumbs += 1\n elsif blob.thumbnail_name == nil and not blobs_without_thumb.include?(blob.blob_hash)\n blobs_without_thumb.push(blob.blob_hash)\n prev_thumbs_ok = false\n elsif blob.thumbnail_name != nil and not prev_commit_blob_ids.include?(blob.id)\n new_thumbs += 1\n end\n end\n \n if blobs_without_thumb.size == 0 # we have all thumbs, do nothing\n return\n elsif prev_thumbs_ok and new_thumbs_without_thumb == new_thumbs # all new thumbs missing\n XmppHelper::sendXmppMessage(@device.xmppname, \"thumbs \" + commit.commit_hash)\n else\n # some thumbs are missing. get them.\n i = 0\n blobs_per_message = 100\n message = blobs_without_thumb[i...blobs_per_message]\n while message != nil do\n XmppHelper::sendXmppMessage(@device.xmppname, \"thumbs \" + commit.commit_hash + \" \" + message.join(\" \"))\n i += blobs_per_message\n message = blobs_without_thumb[i...blobs_per_message]\n end\n end \n end",
"def fetch_videos(range = nil)\n channel = Yt::Channel.new url: self.url\n range ||= self.last_fetched.to_datetime..DateTime.now\n\n videos = channel.videos.where(\n published_after: range.first,\n published_before: range.last\n )\n\n self.last_fetched = DateTime.now\n self.save\n\n videos.map do |video|\n self.videos.create yt_id: video.id\n end\n end",
"def video\n\t\tif params[:category_id]==\"all\"\n\t\t@search=OldFlashFile.all\n\t\t\t\tif [email protected]?\n\t\t\t\t@status= @search.map{|f| {:title =>f.title, :imageUrl=>request.protocol+request.host_with_port+f.preview_image.url(:small), :videoUrl=>(f.video.content_type==\"video/x-flv\") ? \"#{request.protocol+request.host_with_port+f.video.url}\".gsub(\".flv\", \".mp4\") : \"#{request.protocol+request.host_with_port+f.video.url}\" ,:videotype=>f.video.content_type}}\n\t\t\t\telse\n\t\t\t\t@status=nil \n\t\t\t\tend\n\n\t\telse\n\t\targs={:search=>{:filter=>params[:filter],:category_id=>params[:category_id]}}\n\n\t\t@search = ContentSearch.new(args) \n\t\t@results = Kaminari.paginate_array( @search.results )\n\t\t@total = @search.total\n\n\t\t\tif [email protected]?\n\t\t\t@status= @results.map{|f| {:title =>f.title, :imageUrl=>request.protocol+request.host_with_port+f.preview_image.url(:small), :videoUrl=>(f.video.content_type==\"video/x-flv\") ? \"#{request.protocol+request.host_with_port+f.video.url}\".gsub(\".flv\", \".mp4\") : \"#{request.protocol+request.host_with_port+f.video.url}\",:videotype=>f.video.content_type}}\n\n\t\t\telse\n\t\t\t@status=nil \n\t\t\tend\n\t\tend\n\n\t\trender :json =>@status.to_json\n\t\tend",
"def video_params\n params.require(:video).permit(:name, :description, :video_url, :filename, :key)\n end",
"def index\n @congratulations_videos = CongratulationsVideo.all\n end",
"def push video, relevance=Time.now.to_i\n content_zset[video.id] = relevance.to_i\n end",
"def collect_media(prefix=\"\")\n media = {}\n\n s3_media = list_objects(prefix)\n puts \"Found #{s3_media.count} objects\"\n s3_media.each do |object|\n path = object[:key].slice(6, object[:key].length)\n media[path] ||= {}\n media[path][:s3] = object\n end\n\n local_media = list_files(prefix)\n puts \"Found #{local_media.count} files\"\n local_media.each do |file|\n path = file[:path].slice(6, file[:path].length)\n media[path] ||= {}\n media[path][:local] = file\n end\n\n media\nend",
"def movies_liked_key\n \"user:#{self.id}:movies_liked\"\n end",
"def videolist_params\n params.require(:videolist).permit(:videoid, :videoURL, :flag, :title, :category, :author, :description, :uptime, :tag)\n end",
"def backwardvideo\n Pusher['photo-call'].trigger('previous-video' , {\n control: \"1\"\n })\n render text: \"ok\"\n end",
"def video_params\n params.require(:video).permit(:title, :link, :published_at, \n :likes, :dislikes, :uid, :description, :view_count)\n end",
"def generate_video_poll\n # randomly pull out 6 videos\n video_poll = VideoPoll.new(\n room_id: id\n )\n puts ' '\n puts 'chosen'\n unless unplayed_videos.length >= 6\n update(last_playlist_completion_time: Time.now)\n reload\n end\n unchosen_videos = unplayed_videos\n 6.times.each do\n video_index = rand(unchosen_videos.length)\n video = unchosen_videos[video_index]\n # byebug if !video\n unchosen_videos.delete_at(video_index)\n c_video = CandidateVideo.create(\n video: video,\n video_poll: video_poll,\n )\n c_video.reload\n # if !c_video\n # byebug\n # end\n end\n video_poll.save\n video_poll.reload\n video_poll\n end",
"def videos_upload\n\n file_extname = File.extname self.file_upload.original_filename\n new_file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}#{self[:employee_id]}#{file_extname}\"\n folder_path = \"/videos/#{Time.now.strftime(\"%Y\") }/#{Time.now.strftime(\"%m\") }/#{Time.now.strftime(\"%d\") }/\"\n url_path = folder_path + new_file_name\n full_folder_path = \"#{Rails.root.to_s}/public#{folder_path}\"\n new_file_path = \"#{Rails.root.to_s}/public#{url_path}\"\n unless File.exist? full_folder_path\n `mkdir -p #{full_folder_path}`\n end\n\n Dir.mkdir(full_folder_path) unless File.exists?(full_folder_path)\n\n if !self.file_upload.original_filename.empty?\n self.status = Document::ENCODE_PROCESS\n self.original = url_path\n #`touch #{new_file_path}`\n File.open(new_file_path, \"wb\") do |f|\n f.write(self.file_upload.read)\n f.close\n end\n self.save!\n # async encoding video files\n begin\n Backburner.enqueue Document, \"#{Rails.root.to_s}/public\", url_path, self.id\n rescue => ex\n puts 'async task fail'\n puts ex\n self.status = Document::ENCODE_FAILED\n self.save\n end\n end\n\n end",
"def has_video?\n false\n end",
"def index\n @lecture = Tutorial.find(params[:lecture_id])\n @videotuts = @lecture.videos.order(:id)\n \n \n end",
"def link_to_access_video text = nil, results = String.new, counter = 1\n @afdoc.external_video(:h264).each do |ds|\n results << link_to((text + \" (\" + counter.to_s + \")\"), ds.datastreams[\"ACCESS1\"].label, :class => \"btn btn-inverse\")\n counter = counter + 1\n end\n return results.html_safe\n end",
"def videos_count\n videos.joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).count\n end",
"def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end",
"def event_photo(photos)\n speakers = find_speaker(photos)\n if speakers.empty?\n photo = photos.shuffle[0]\n else\n photo = speakers[0]\n end\n src = photo['photo_link']\n name = photo['member']['name']\n \"<img src=\\\"#{src}\\\" class=\\\"event-photo\\\" alt=\\\"Photo by #{name}\\\" />\"\nend",
"def video_params\n\t params.require(:video).permit(:title, :link, :img, :category, :site, :tag_list)\n\tend",
"def get_media_per_user_single\n playlist_array = []\n current_user.workout_sets.find(params[:id]).media.each do |v|\n sources_array = []\n videos_hash = {}\n sources_array << {\n src: rails_blob_path(v.video),\n type: 'video/mp4'\n }\n videos_hash[:name] = v.title\n videos_hash[:sources] = sources_array\n playlist_array << videos_hash\n end\n gon.mediaSets = playlist_array\n end",
"def complete\n for p in params[:parts][:part]\n part = Part.find_by_mrokhash(p[:mrokhash])\n part.movie_file_meta_data = true\n part.update_attributes(p)\n expire_page rip_url(part.rip) if part.rip\n end\n head :ok\n end",
"def index\n\t\tif params[:filter].present?\n\t\t\tparams[:filter][:order] = 'publication_date' unless params[:filter][:order].present?\n\t\t\tparams[:filter][:order_type] = 'asc' unless params[:filter][:order_type].present?\n\t\telse\n\t\t\tparams[:filter] = { order: 'publication_date', order_type: 'desc' }\n\t\tend\n\n\t\tparams[:youtube_channel_name].strip! if params[:youtube_channel_name].present?\n\t\tnulls_last = ' NULLS LAST'\n\t\torder_by = 'youtube_videos.'\n\t\tunless %w{id title youtube_video_id is_active linked ready deleted posted_on_google_plus client publication_date updated_at}.include?(params[:filter][:order])\n\t\t\tif params[:filter][:order] == 'tier'\n\t\t\t\torder_by = 'geobase_localities.population'\n\t\t\telse\n\t\t\t\torder_by = 'geobase_' + params[:filter][:order].pluralize + '.name'\n\t\t\tend\n\n\t\t\torder_by = 'email_accounts.email' if params[:filter][:order] == 'email'\n\t\t\torder_by = 'youtube_channels.youtube_channel_name' if params[:filter][:order] == 'youtube_channel_name'\n\t\telse\n\t\t\tif params[:filter][:order] == 'client'\n\t\t\t\torder_by = 'clients.name'\n\t\t\telse\n\t\t\t\torder_by += params[:filter][:order]\n\t\t\tend\n\n\t\t\tnulls_last = '' if %w{linked is_active ready deleted posted_on_google_plus}.include?(params[:filter][:order])\n\t\tend\n\n params[:limit] = DEFAULT_LIMIT unless params[:limit].present?\n column_names = YoutubeVideo.column_names\n column_names.delete(\"yt_stat_json\")\n column_names_string = \"youtube_videos.\" + column_names.join(\",youtube_videos.\")\n\t\t@youtube_videos = YoutubeVideo.unscoped.distinct.select(\"#{column_names_string}, #{order_by}\").joins(\n \"LEFT OUTER JOIN youtube_channels ON youtube_channels.id = youtube_videos.youtube_channel_id\n LEFT OUTER JOIN google_accounts ON google_accounts.id = youtube_channels.google_account_id\n LEFT OUTER JOIN email_accounts ON email_accounts.email_item_id = google_accounts.id\n LEFT OUTER JOIN geobase_localities ON geobase_localities.id = email_accounts.locality_id\n LEFT OUTER JOIN geobase_regions ON geobase_regions.id = geobase_localities.primary_region_id\n LEFT OUTER JOIN geobase_countries ON geobase_countries.id = geobase_regions.country_id\n LEFT OUTER JOIN geobase_regions regions ON regions.id = email_accounts.region_id\n LEFT OUTER JOIN geobase_countries countries ON countries.id = regions.country_id\n LEFT OUTER JOIN clients ON clients.id = email_accounts.client_id\n \t\t\tLEFT OUTER JOIN youtube_video_annotations ON youtube_video_annotations.youtube_video_id = youtube_videos.id\n LEFT OUTER JOIN youtube_video_cards ON youtube_video_cards.youtube_video_id = youtube_videos.id\n LEFT OUTER JOIN call_to_action_overlays ON call_to_action_overlays.youtube_video_id = youtube_videos.id\n #{'RIGHT JOIN yt_statistics on youtube_videos.id = yt_statistics.resource_id AND yt_statistics.resource_type = \\'YoutubeVideo\\'' if params[:grab_statistics_succeded].present? || params[:processed].present? || params[:grab_statistics_error_type].present?}\"\n )\n \t\t.by_display_all(params[:display_all])\n \t\t.by_id(params[:id])\n .by_youtube_channel_id(params[:youtube_channel_id])\n \t\t.by_title(params[:title])\n \t\t.by_youtube_channel_name(params[:youtube_channel_name])\n \t\t.by_youtube_video_id(params[:youtube_video_id])\n \t\t.by_email(params[:email])\n \t\t.by_tier(params[:tier])\n \t\t.by_locality_id(params[:locality_id])\n \t\t.by_region_id(params[:region_id])\n \t\t.by_linked(params[:linked])\n \t\t.by_is_active(params[:is_active])\n .by_channel_is_active(params[:channel_is_active])\n .by_gmail_is_active(params[:gmail_is_active])\n .by_channel_is_verified(params[:channel_is_verified])\n .by_has_youtube_video_id(params[:has_youtube_video_id])\n \t\t.by_country_id(params[:country_id])\n \t\t.by_client_id(params[:client_id])\n .by_bot_server_id(params[:bot_server_id])\n \t\t.by_ready(params[:ready])\n .by_deleted(params[:deleted])\n .by_grab_statistics_succeded(params[:grab_statistics_succeded])\n .by_grab_statistics_error_type(params[:grab_statistics_error_type])\n .by_processed(params[:processed])\n .by_posted_annotations(params[:annotations_posted])\n .by_posted_cards(params[:cards_posted])\n .by_posted_call_to_action_overlays(params[:call_to_action_overlays_posted])\n .by_posted_on_google_plus(params[:posted_on_google_plus])\n .by_last_event_time(params[:table_name], params[:field_name], params[:last_time])\n \t\t.page(params[:page]).per(params[:limit])\n \t\t.order(order_by + ' ' + params[:filter][:order_type] + nulls_last)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\tjson_text = []\n\t\t\t\t@youtube_videos.each do |yv|\n\t\t\t\t\tjson_object = {}\n\t\t\t\t\tga = yv.try(:youtube_channel).try(:google_account)\n ea = ga.try(:email_account)\n\t\t\t\t\tjson_object[:id] = GoogleAccountActivity.find_by_google_account_id(ga.id).try(:id)\n\t\t\t\t\tjson_object[:email_account_id] = ea.try(:id)\n\t\t\t\t\tjson_object[:email] = ea.try(:email)\n\t\t\t\t\tjson_object[:password] = ea.try(:password)\n\t\t\t\t\tjson_object[:ip] = ea.try(:ip_address).try(:address)\n\t\t\t\t\tjson_text << json_object\n\t\t\t\tend\n\t\t\t\trender :json => json_text.uniq.to_json\n\t\t\t}\n\t\tend\n\tend",
"def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end",
"def index\n @recommendations = current_user.recommendations.sort_by(&:created_at).reverse!\n recommendations_ids = @recommendations.collect(&:id)\n\n @provider_logos = AmazonS3.instance.provider_logos_hash_for_recommendations(@recommendations)\n @profile_pictures = User.author_profile_images_hash_for_recommendations(@recommendations)\n\n @activities = PublicActivity::Activity.order(Arel.sql('created_at desc')).where(trackable_id: recommendations_ids, trackable_type: 'Recommendation', owner_id: current_user.connected_users_ids)\n @activity_courses = {}\n @activity_courses_bookmarked = {}\n return unless @activities\n\n @activities.each do |activity|\n if activity.user_ids.present? && (activity.user_ids.include? current_user.id)\n @activity_courses[activity.id] = Recommendation.find(activity.trackable_id).course\n @activity_courses_bookmarked[activity.id] = @activity_courses[activity.id].bookmarked_by_user? current_user if @activity_courses[activity.id].present?\n else\n @activities -= [activity]\n end\n end\n end",
"def media_list\n DATABASE.execute(\"SELECT media.cover_name FROM media_members JOIN media ON media_members.media_id = media.id WHERE media_members.member_id = #{id};\")\n end",
"def index #for private videos\n\t \t@base = Vimeo::Advanced::Base.new(\"6e5c231d7fe43552b47b7dbd2971a795d5bbc3ca\", \"7f54ccb85f39876529230420e73c34ac75a63c9d\")\n\t \tputs \"#{@base.inspect}//////////////////////////////\"\n\t \trequest_token = @base.get_request_token\n\t \tputs \"#{request_token}////////////////////////////////\"\n\t \tsession[:oauth_secret] = request_token.secret\n\t \tredirect_to @base.authorize_url\n end",
"def index\n @videogames = Videogame.all.paginate(:page => params[:page], :per_page => 8)\n end",
"def recent_videos\n videos.first(6)\n end",
"def pausevideo\n Pusher['photo-call'].trigger('pause-video' , {\n control: \"1\"\n })\n render text: \"ok\"\n end",
"def video_params\n params.require(:video).permit(:name, :description, :content, :link, :visit, :active, :section_id, :tag_list, :posted_at)\n end",
"def call\n\n # service jobs:\n # 1 - Demander à youtube search de trouver du contenu pour certains chanel_id\n contents_attributes = @channels_ids.map do |channel_id|\n Youtube::Search.new(channel_id).call\n end\n # contents_attributes # => [[<channel_id1> => {video1}, {video2}], [<channel_id2> => {}, {}]]\n\n contents_attributes.flatten!\n # contents_attributes # => [{channel_id1_video1}, {channel_id1_video2}, {channel_id2_video1}, {channel_id2_video2}, ...]\n\n # 2 - creation contenu non existant dans la DB (via youtube url)\n contents_attributes.each do |content_attributes|\n content_attributes[:theme] = @theme\n Content.create_with(content_attributes).find_or_create_by(url: content_attributes[:url])\n end\n end",
"def video_params\n params.fetch(:video, {})\n end",
"def associate_random_videos(user_id)\n 100.times do\n user = User.find(user_id)\n video = Video.all[rand(0...15)]\n if user.videos.include?(video)\n next\n else\n user.videos << video\n end\n end\n end",
"def youtube_list(user)\n require 'youtube_it'\n client = YouTubeIt::Client.new\n\n offset = 1\n videos = []\n while true # keep requesting more videos until there are none left\n resp = client.videos_by(:user => user, :offset => offset)\n break if resp.videos.size == 0\n offset += 25\n videos = videos + resp.videos.map {|v| [\"http://www.youtube.com/watch?v=#{v.unique_id}\", \"YT: #{v.title}\"]}\n end\n return videos\nend",
"def attachments_to_remember\n return [] unless self.class.remember_attachments?\n (self.database.get(self.id)[\"_attachments\"] || {}).keys.reject do |a| \n a.match(VERSION_REGEX) || \n !(self.class.remember_attachments.map { |attachment_name_pattern|\n a.match attachment_name_pattern\n }.inject(false) {|b, sum| sum || b})\n end \n end",
"def video_params\n params.require(:video).permit(:youtube_id, :thumbnail, :artist, :title_korean, :title_english, :youtube_user_id, :description, :hotness, :cheesiness, :english_percentage, :english_subtitle, :official, :youtube_views, :definition, :duration, :dimension, :caption, :category, :licensed_content, :approval_rating, :upvotes_per_views, :likes, :upload_date, :upvotes, :downvotes)\n end",
"def compileSubsplashResponse(response)\n batch = ''\n response[\"_embedded\"][\"media-items\"].each do |r|\n youtube_id = extractYouTubeID(r[\"youtube_url\"])\n batch << youtube_id + ',' unless youtube_id == ''\n video = Video.new.tap do |v|\n v.youtube_id = youtube_id\n v.youtube_url = r[\"youtube_url\"]\n v.title = r[\"title\"]\n v.duration = nil\n v.views = nil\n v.reach = r[\"reach\"]\n v.save\n end\n end \n batch.chop!()\n callYouTubeAPI(batch)\n end",
"def get_player_rendered_videos(gamertag, page = 0)\n gamertag = gamertag.gsub(' ', '%20')\n uri = ENDPOINT + \"file/videos/#{key}/#{gamertag}/#{page}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end",
"def fetchfilm parturl, _file=nil\n return nil unless parturl\n table = \"movie\"\n if parturl.index(\"&\")\n #$log.warn \"Cannot handle ampersand in URL. please correct #{parturl}\"\n $stderr.puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n $stderr.puts \"Cannot handle ampersand in URL. please correct #{parturl}\"\n $stderr.puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n return nil\n end\n # remove HOST and keep last part\n if parturl.index OLDHOST\n parturl = parturl[OLDHOST.length..-1]\n end\n if parturl.index HOST\n parturl = parturl[HOST.length..-1]\n end\n if parturl.index(\"http:\") or parturl.index(\"https:\")\n # added this block 2015-12-30 \n $stderr.puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n $stderr.puts \"Don't know how to handle this host : #{parturl}. Pls use #{HOST} if you must.\"\n $stderr.puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n #$log.error \"Don't know how to handle #{parturl}\"\n #exit(1)\n return nil\n end\n #inserting = false\n return nil if parturl.nil? || parturl.strip == \"\"\n parturl = parturl.chomp\n #nid = counter + starting\n nid = nil\n upperurl = parturl.upcase\n key = converturl parturl\n id = $db.get_first_value %Q[select rowid from #{table} where upper(url) = \"#{upperurl}\";]\n # in some cases the data on wiki has changed a lot, so we are forcing a download\n unless $opt_force\n if id.nil?\n id = $db.get_first_value %Q[select url from #{table} where upper(canonical) = \"#{upperurl}\";]\n if id\n $stderr.puts color(\"ERROR: FOUND another url with similar canonical : #{id} skipping ..\",\"red\");\n return nil\n end\n # NOTE 2016-02-28 - this can prevent me from downloading a movie with same name but different\n # year. I should check title + year at point of updating in db. or key + year.\n id = $db.get_first_value \"select rowid from #{table} where key = '#{key}';\"\n if id\n tmp = $db.get_first_value \"select url from #{table} where key = '#{key}';\"\n $stderr.puts color(\"ERROR: FOUND another row with similar KEY #{key}: #{id} #{tmp} , skipping ..\",\"red\");\n #$log.warn \"XXX: FOUND another row with similar KEY #{key}: #{id} #{tmp} , SKIPPING ..\"\n return nil\n end\n else\n $stderr.puts color(\"ERROR: FOUND another row with #{parturl} ... skipping\",\"red\");\n return nil\n end\n end\n id = nid\n url = HOST + parturl.strip\n #\n # BUG: still fails if ampersand in URL regardless of single or double quote\n # TODO maybe we need to try Shellwords.escape since i am able to do it with wget on commandline\n text = %x[wget -q -O - \"#{url}\"] \n # 2015-12-29 - sometimes the URL is wrong, so we get a blank. The file has zero bytes\n # so we should check here\n if text.nil? or text.chomp == \"\"\n $stderr.puts color(\"ERROR: =========== url is wrong or internet down, no data received #{url}. pls check ...\", \"red\")\n #$my_errors << \"no data fetched for #{parturl} pls check/correct.\"\n sleep(60)\n return nil\n end\n # 2016-03-08 - write to a temp folder and only copy to real name if file passes disambiguation check\n tmpfile = _file.sub(\"wiki\", \"tmp\")\n File.open(tmpfile,\"w\") {|f2| f2.write(text) }\n\n _ff = Shellwords.escape(tmpfile)\n type = `file #{_ff}`\n\n # check if its a zip\n # SOMETime it comes in zip format. how do contreol that ?\n # if file says zipped then add gz extension and do a gunzip\n if type.index \"gzip\"\n $stderr.puts color(\" gzip found, expanding\", \"blue\")\n FileUtils.mv tmpfile, \"#{tmpfile}.gz\"\n system \"gunzip #{_ff}.gz\"\n #text = File.readlines(_file).join(\"\\n\")\n end\n\n # 2016-03-08 - check if disambiguation page\n ret = %x[ ./oldprogs/grepdisambiguation.sh \"#{tmpfile}\" ]\n if ret and ret.size > 3\n $stderr.puts color(\" ERROR: This (#{tmpfile} is a disambiguation page, aborting ...\", \"red\" ) \n return nil\n end\n # all okay, move file to real folder\n FileUtils.mv tmpfile, _file\n #\n # TODO 2016-03-06 - 13:09 extract canonical and compare with parturl\n # If different then change html path removing HOST and calling uri_to_filename \n # Then change parturl and write to file so next program can pick up and adjust url, htmlpath and ymlpath.\n # We check after writing since the string could be in zip format.\n # This could fail, we may need to use _ff instead here and in parsedoc\n canonical = %x[ ./oldprogs/grepcanonical.sh -h \"#{_file}\" ]\n\n # 2016-03-08 - read file and check for canonical. if so return error do not update table.\n if canonical && canonical.size > 2\n canonical = canonical.chomp\n if ( (canonical != parturl) && (URI.decode(canonical) != parturl) )\n suggestedurl = URI.decode(canonical);\n # 2016-03-08 - if canon link contains disambiguation or '#' then return error\n if suggestedurl.index(\"disambiguation\") or suggestedurl.index(\"#\")\n $stderr.puts color(\" ERROR: This (#{suggestedurl} is a disambiguation page, aborting ...\", \"red\", \"reverse\") \n return nil\n end\n $stderr.puts color(\" WARNING: canonical does not match url, should change name #{parturl} != #{canonical}...\",\"red\");\n $stderr.puts color(\" WARNING: we should rename file and url to: #{suggestedurl} and change the parturl in file and caller \",\"red\");\n # if this works out, we can change the name of the file. and write new url and html path to a yml file.\n end\n end\n return _file\nend"
] |
[
"0.5565192",
"0.55613613",
"0.5416615",
"0.53767014",
"0.5350997",
"0.5274317",
"0.52551365",
"0.51702744",
"0.51373285",
"0.5135509",
"0.5084113",
"0.50449467",
"0.5039869",
"0.5034121",
"0.5017879",
"0.50122094",
"0.49931175",
"0.4991815",
"0.49832252",
"0.49827278",
"0.49640715",
"0.49634907",
"0.49525976",
"0.49294975",
"0.49174887",
"0.49128133",
"0.4900145",
"0.48956895",
"0.48909613",
"0.48895326",
"0.48877943",
"0.48858485",
"0.4863315",
"0.48585427",
"0.48440355",
"0.4842393",
"0.48335254",
"0.48246518",
"0.48137853",
"0.48103648",
"0.48061252",
"0.48040405",
"0.48012957",
"0.4797195",
"0.47952524",
"0.47945142",
"0.47945142",
"0.4790416",
"0.4787513",
"0.47852546",
"0.47703508",
"0.47655722",
"0.4756462",
"0.47546414",
"0.47471526",
"0.47360238",
"0.47199857",
"0.4717446",
"0.47157517",
"0.47124285",
"0.47104806",
"0.47094527",
"0.4708268",
"0.47043777",
"0.4703616",
"0.47031584",
"0.47023576",
"0.4697341",
"0.46857548",
"0.46812153",
"0.46786296",
"0.46721032",
"0.46707693",
"0.4668486",
"0.46681333",
"0.46668106",
"0.4663617",
"0.46620005",
"0.46595764",
"0.4654195",
"0.46492353",
"0.46476352",
"0.4647446",
"0.4639881",
"0.46382624",
"0.46332854",
"0.4631181",
"0.46286598",
"0.4622501",
"0.4617865",
"0.46165645",
"0.4613134",
"0.46127266",
"0.4608095",
"0.46043557",
"0.45991033",
"0.45985657",
"0.4595676",
"0.4588523",
"0.4587633",
"0.45863366"
] |
0.0
|
-1
|
required params: comment, receiver, message
|
def came_comment
@user = @receiver
link = "/#{@comment.commentable_type.downcase.pluralize}/#{@comment.commentable.id}"
@notification = @user.notifications.find_by(link: link) || @user.notifications.find_by(link: "#{link}#latest-comment")
mail to: @user.email, subject: "[FBC] #{@message}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_comment(msg)\n end",
"def comment_received(comment)\n# @greeting = \"Hi\"\n @comment = comment\n\n mail :to => \"[email protected]\"\n end",
"def item_comment(comment, recipient)\n @comment = comment\n @recipient = recipient\n @commentable = comment.commentable\n mail(:to => \"#{recipient.name} <#{recipient.email}>\", :subject => \"A User has just left a comment on your #{comment.commentable.class.to_s}\")\n end",
"def on_message(params)\n @jira.comment_on(:issue => @issue, :comment => params[:msg])\n end",
"def message(message) end",
"def came_comment\n @user = @receiver\n path = \"/#{@comment.commentable_type.downcase.pluralize}/#{@comment.commentable.id}\"\n @notification = @user.notifications.find_by(path: path)\n mail to: @user.email, subject: \"[bootcamp] #{@message}\"\n end",
"def notification_of_new_comment_to_followed_listing(comment, recipient, host=nil)\n set_locale recipient.locale\n subject_string = comment.author.name + \" on kommentoinut ilmoitusta jota seuraat\"\n url = host ? \"http://#{host}#{listing_path(comment.listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(recipient.id)}\" : \"test_url\"\n recipients recipient.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :comment => comment, :url => url, :settings_url => settings_url, :listing_title => get_title_with_category(comment.listing)\n end",
"def new_comment_notification(comment)\n\n blog = Post.find comment.post_id\n sender = User.find comment.user_id\n blog_owner = User.find blog.user_id\n #@subscribe = Subscribe.find :all, :conditions => [\"model_id = ? and model_type = ?\",blog.id, \"Post\"],:select => [\"user_id\"]\n #@subscribers = User.find :all, :conditions => [\"id in (?)\",@subscribe], :select => [\"email\"]\n setup_email(blog_owner)\n\n @subject += \"У ваc новый комментарий\"\n\n body[:comment]= comment\n body[:from_who] = sender\n body[:url] = RAILS_URL + \"posts/show/#{comment.post_id}#comments\"\n\n end",
"def redmine_add_comment(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tresulted_task = redmine_check_task(m, params, certificate)\n\t\t\tif ! resulted_task.nil?\n\t\t\t\t# Best way to save text line\n\t\t\t\tmessageEntry = params[:message].to_s.strip\n\t\t\t\t# Ajout d'un commentaire\n\t\t\t\tresulted_task.notes = messageEntry\t\n\t\t\t\t# Save an issue\n\t\t\t\tif ! resulted_task.save\n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\[email protected] m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasnotbeenupdated}\"\n\t\t\t\telse \n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\[email protected] m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasbeenupdated} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{resulted_task.id}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_thetask} ##{params[:task]} #{@redmine_l_doesnotexistsinredmine}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end",
"def comment_recieved(comment)\n @comment = comment\n\n mail :to => comment.email_address, :subject => \"KM CMS comment confirmation\"\n end",
"def message(receiver_uid:, content:)\n new_conversation(receiver_uid) unless conversation_exist?(receiver_uid)\n conversation = Conversation.return(u1_id: @uid, u2_id: receiver_uid)\n conversation.new_message(sender_uid: @uid, content: content)\n end",
"def message( message )\n\tend",
"def comment_params\n params.require(:comment).permit(:from, :message, :item_id)\n end",
"def new_comment_created(recipient,title,from_mail,from_name,comment, link_to_commentable)\n @notify_subject = \"Your entry '#{title}', was commented by #{from_name}\"\n @comment = comment\n @from_name = from_name\n @from_mail = from_mail\n @link_to_commentable = link_to_commentable\n mail( :from => from_mail,\n :to => [ENV['APPLICATION_CONFIG_admin_notification_address'],recipient].uniq,\n :subjcect => @notify_subject\n )\n end",
"def do_comment\n\t\t# 发布评论时要知道这个评论属于哪篇文章,所以要在 Article 模型上调用 find 方法查找文章对象。\n\t\t@message = Message.find(params[:message_id])\n\t\tcommenter = session[:username]\n\t comment_message = params[:comment_message]\n\t if comment_message == ''\n\t \tredirect_to \"/show/messages/#{@message.id}\"\n\t else\n\t \t@comment = @message.comments.new\n\t \[email protected] = commenter\n\t \[email protected]_message = comment_message\n\t \[email protected]\n\t \tredirect_to \"/show/messages/#{@message.id}\"\n\t end\n\tend",
"def new_comment(comment)\n if comment.commentable.instance_of?(User)\n user_email = comment.commentable.email\n @followlink = profile_url\n elsif comment.commentable.instance_of?(Message)\n user_email = comment.commentable.user.email\n @followlink = message_url(comment.commentable)\n end\n\n @username = comment.user.email\n\n mail :to => user_email, :subject => \"New comment\"\n end",
"def process_message(message)\n end",
"def create\n @comment = Comment.new(params[:comment])\n \n message = Message.find(params[:message_id]);\n user = current_user\n \n if user.active? && !current_user\n @message.errors.add_to_base(\"Du musst erst den Link in der E-Mail klicken.\")\n\n respond_to do |format|\n format.html { render :action => \"new\"; return }\n format.widget { render :action => \"new\"; return }\n end\n end\n \n @comment.user = user\n @comment.message = message\n \n respond_to do |format|\n if @comment.save\n format.html { redirect_to(message, :notice => '<span class=\"icon yes\">Kommentar hinzugefügt</span>') }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def comment_update(message)\n @user = message.user\n @message=message\n mail to: @user.email, subject: \"New comment for your Message Board (Socail Trip App)\", from:'[email protected]'\n \n end",
"def comment(id)\n record \"/msg/comment/#{id}\"\n end",
"def replyToChatter(origin,reply)\n Debug.log \"Reply to chatter #{reply} (#{origin})\"\n f=Databasedotcom::Chatter::FeedItem.find(@client,origin);\n f.comment(reply)\n end",
"def comment_params\n params.require(:comment).permit(:user_id, :channel_id, :message)\n end",
"def commented (commentable, comment, email)\n @commentable = commentable\n @comment = comment\n mail :to => email,\n :subject =>\"#{@commentable.class} \\\"#{@commentable.title}\\\" has been commented\"\n end",
"def messaging\n end",
"def congratulate_for_accepted_comment(comment)\n @comment = comment\n @structure = @comment.structure\n @admin = @structure.admin\n @conversation = @comment\n mail to: @comment.commentable.contact_email,\n subject: \"Vous avez reçu un avis de #{@comment.author_name}\",\n reply_to: generate_reply_to('admin', 'comment')\n end",
"def message_params\n params.require(:message).permit(:user_id, :receiver_id, :content)\n end",
"def comment_added(comment)\n @place = comment.place # pulling from db\n @place_owner = @place.user # pulling specific owner of comment from db\n # Would be mail(to: @place_owner.email, ...) if owner of comment to receive msg\n mail(to: '[email protected]',\n subject: \"A comment was added to #{@place.name}\")\n end",
"def notification_of_new_comment(comment, host=nil)\n set_locale comment.listing.author.locale\n subject_string = comment.author.name + \" on kommentoinut ilmoitustasi\"\n url = host ? \"http://#{host}#{listing_path(comment.listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(comment.listing.author.id)}\" : \"test_url\"\n recipients comment.listing.author.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :comment => comment, :url => url, :settings_url => settings_url, :listing_title => get_title_with_category(comment.listing)\n end",
"def recipient; end",
"def message_params\n params.require(:message).permit(:title, :sender_id, :receiver_id, :content)\n end",
"def build_comment(sender, options={})\n self.comments.build(comment_options(sender, options)) if allows_comment?(sender)\n end",
"def message_params\n params.require(:message).permit(:sender_id, :receiver_id, :title, :content)\n end",
"def create\n\t\t@comment = Comment.new\n\t\[email protected] = params[:message] \n\t\[email protected] = current_user\n\t\t\n\t\[email protected]\n\t\trespond_with(@comment)\n end",
"def new_comment(comment, commenter, author, question)\n if author.privacy_setting.notify_on_post_comment \n @comment, @commenter, @author, @post = comment, commenter, author, question\n mail(\n :subject => \"#{@commenter.name.titleize} just commented on your post.\",\n :from => \"[email protected]\",\n :to => author.email,\n :date => Time.now\n )\n end\n end",
"def new_comment(comment)\n @greeting = \"Hi!\"\n @id = comment.workout.id\n @title = comment.workout.title\n @user = comment.user\n mail to: comment.workout.user.email\n end",
"def message\n process_mess\n end",
"def news_comment_added(user, comment)\n news = comment.commented\n redmine_headers 'Project' => news.project.identifier\n @author = comment.author\n message_id comment\n references news\n @news = news\n @comment = comment\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end",
"def message(message)\n subject message.subject\n reply_to message.sender.email\n recipients message.recipient.email\n sent_on Time.now\n body :message => message, :link => my_message_url(message.thread.code)\n end",
"def new_comment(comment, email)\n @comment = comment\n mail(:to => email, :subject => \"El cliente #{@comment.user.fullname} ha dejado un nuevo comentario.\")\n end",
"def test_create_reply_to_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:matt_reply_to__tim_reply_to__andy_to_kevin_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n notified_users = send_message(@kevin, @matt, reply_to, about)\r\n assert !notified_users.include?(@kevin),\r\n \"Owner of the review should not receive their own comments on the review.\"\r\n end",
"def newcomment_mail(comment)\n @comment = comment.contentcom\n @email = User.find(comment.user_id).email\n @fname = User.find(comment.user_id).fname\n @lname = User.find(comment.user_id).lname\n @url = 'http://minervasi.co/login'\n mail(to: [\"[email protected]\"], subject: 'User comment')\n end",
"def message_params\n params.require(:message).permit(:sender_id, :receiver_id, :title, :body)\n end",
"def create\n @comment = Comment.new(comment_params)\n @card = Card.find(params[:comment][:card_id])\n @comment.from_user_id = current_user.id\n to_user_name = \"\"\n respond_to do |format|\n if @comment.save\n if(@comment.to_user_id != nil)\n n = Notification.new(recipient_id: comment_params[:to_user_id], comment_id: @comment.id, card_id: @card.id, read: false, source: \"comment\")\n n.save\n CommentMailer.comment_note(n.recipient, n).deliver\n to_user_name = User.find(@comment.to_user_id).name\n end\n ActionCable.server.broadcast \"team_#{@card.list.board.id}_channel\",\n event: \"create_comment\",\n card_id: @card.id,\n context: @comment.context,\n from_user_id: @comment.from_user_id,\n from_user_name: User.find(@comment.from_user_id).name,\n to_user_id: @comment.to_user_id,\n to_user_name: to_user_name,\n created_at: @comment.created_at\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receive_message(message)\n end",
"def replace_message_for_comments_with_attachments\n if message.blank?\n self.message = \"This comment has an attachment, but due to limitations in Facebook's API we can't \" +\n \"show it to you in the e-mail. Please click 'view on Facebook' to see it.\"\n end\n end",
"def new_comment(comment)\n @comment = comment\n type = @comment.commentable_type.classify\n @commented = type.constantize.find(@comment.commentable_id)\n @recipient = commented.first.user\n\n mail(to: @recipient.email, subject: \"You have a new comment\")\n end",
"def comment_options(sender, options={})\n options.merge({:sender => sender, :receiver => self.person, :commentable => self})\n end",
"def comment_options(sender, options={})\n options.merge({:sender => sender, :receiver => self.person, :commentable => self})\n end",
"def comment_reply_notification(recipient_email, recipient_name, commenter_name, body, url)\n email_with_name = \"#{recipient_name} <#{recipient_email}>\"\n @recipient_name = recipient_name\n @commenter_name = commenter_name\n @body = body\n @url = url\n\n mail to: email_with_name, subject: \"#{commenter_name} replied to your comment on BaseRails\"\n end",
"def comment\n EventMailer.comment\n end",
"def msg(message)\n end",
"def new_comment(commenter_name, body, url)\n @commenter_name = commenter_name\n @body = body\n @url = url\n\n mail to: \"Alex Yang <[email protected]>\",\n from: \"BaseRails <[email protected]>\",\n subject: \"#{commenter_name} posted a new comment on BaseRails\"\n end",
"def comment_params\n params.require(:comment).permit(:message)\n end",
"def comment_params\n params.require(:comment).permit(:message)\n end",
"def comment_params\n params.require(:comment).permit(:message)\n end",
"def message_params\n params.require(:message).permit(:receiver, :message)\n end",
"def trigger_comment(comment) end",
"def message_params\n params.require(:message).permit(:text, :html, :receiver_id)\n end",
"def send_message(message); end",
"def send_message(message); end",
"def enqueue_message(message); end",
"def message_params\n params.require(:message).permit(:sender_id, :receiver_id, :body)\n end",
"def comment_params\n params.require(:comment).permit(:comment, :sender, :ticket)\n end",
"def comment_notification(user, commenter, post, comment)\n @user = user\n @commenter = commenter\n @post = post\n @comment = comment\n\n mail to: user.email, subject: \"#{commenter.username} has commented on your post!\"\n end",
"def write_message\n\t\t# sender will be the current user\n\t\t@user = current_user\n\t\t@message = Message.new\n\t\[email protected] = current_user\n\t\t@unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n\t\t# if reciever has been specified, automatically use his/her name in the \"To:\" box\n\t\tif params[:receiver]\n\t\t\[email protected] = User.find_by_login(params[:receiver])\n\t\tend\n end",
"def send_im(fromnick,tonick,message)\n return ret_fail('can not send IM to yourself') if fromnick==tonick #self-explainatory\n\n usr = User.first(:nickname=>fromnick) #find own record\n return ret_fail('own user not found') if usr == nil #must be error\n\n tousr = User.first(:nickname=>tonick)\n return ret_fail('addressee not found') if tousr == nil #must be error\n\n contact = usr.contacts.first(:userid => tousr.id)\n return ret_fail('not in list') if contact == nil #that nick is not in contact list!\n\n\n if message['type'] != 'auth_request' #Normal message\n return ret_fail('not authorized') if contact.authgiven != 't' #failure: not authorized!\n else #its an authorization request!\n return ret_fail('already given') if contact.authgiven == 't' #already has permission!\n return ret_fail('already sent') if contact.authgiven == 'p' #already sent a request!\n\n #ok... its a valid auth request... so set state to 'p' and update db record\n contact.authgiven = 'p' #awaiting to be answered\n contact.save\n end\n\n #append message to addressees message queue, update database record\n msg = tousr.messages.new\n msg.data = JSON.generate({'from'=>fromnick, 'message'=>message})\n msg.save\n\n return ret_success\nend",
"def comment message\n @instructions << Comment.new(message)\n self\n end",
"def receiver_params\n params.require(:receiver).permit(:name, :contact, :phone, :comment)\n end",
"def handle_message(request, message)\n #\n end",
"def commented(request, comment)\n @request = request\n @comment = comment\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end",
"def create\n usr = User.where(fb_id: params[:user_id]).first\n @comment = Comment.new(\n bet_id: params[:bet_id],\n text: params[:text],\n user: usr\n )\n\n if @comment.save\n # make a list of all possible notification recipients\n list = get_bet_opponents(params[:bet_id])\n list.select! {|uid| uid != params[:user_id]} #filter out the guy who made the notification\n push_notify_users(list, \"#{usr.name} commented on #{User.where(fb_id: @comment.bet.owner).first.name}'s bet!\")\n push_notify_user(@comment.bet.owner, \"#{usr.name} commented on your bet!\") unless params[:user_id] == @comment.bet.owner\n render action: 'show', status: :created, location: @comment\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def comment_delivered(comment)\n @comment = comment\n\n mail :to => comment.email_address, :subject => \"KM CMS comment confirmation\"\n end",
"def answer_comment(comment, text)\n comment.answer(self, text)\n item = comment.correspondent_item\n Activity.log(self, \"comment_item\", item, item.owner)\n end",
"def create\n @comment = Comment.new(comment_params)\n @comment.user_id = current_user.id if current_user\n\n #render :json => {status: 0, user: current_user, content: @comment.content}\n if current_user && @comment.save\n receive_user = Share.find_by(id: comment_params['share_id']).user\n ## TODO\n #if receive_user.username != current_user.username\n Notification.create( kind: \"comment\", receive_user_id: receive_user.id, receive_user: receive_user.username, send_user: current_user.username )\n #end\n comment_size = Share.find(comment_params['share_id']).comments.size\n render :json => {status: 0, user: current_user, content: @comment.content, comment_size: comment_size}\n else\n render :json => {status: 1, user: nil}\n end\n end",
"def deliver_comment_on_message_email_in_model(comment)\n UserMailer.deliver_comment_on_message_email(self.user, comment)\n end",
"def new_comment(rep, c_u, content)\n @current_user = c_u\n @content = content\n @rep = rep\n mail to: rep.user.email, subject: \"Ripetizione per '#{rep.course.name}'\"\n end",
"def build_comment(sender, options={})\n self.comments.build(comment_options(sender, options))\n end",
"def comment_replied_to(options = {})\n send_comment_notification(options, \"reply_notice\")\n end",
"def new_comment(user, post, comment)\n # New Headers\n headers[\"Message-ID\"] = \"<comments/#{comment.id}@aspsa-bloccit.example>\"\n headers[\"In-Reply-To\"] = \"<post/#{post.id}@aspsa-bloccit.example>\"\n headers[\"References\"] = \"<post/#{post.id}@aspsa-bloccit.example\"\n \n # Checkpoint #55 - Favoriting\n #\n # You'll notice that we define three instance variables to equal local variables, but then never use them. What's going on?\n #\n # ActionMailer follows a similar pattern to Rails controllers: You can define instance variables that will be available to your \"view\" - the content sent in the email.\n @user = user\n @post = post\n @comment = comment\n \n # Checkpoint #55 - Favoriting\n #\n # The most important line in this method is the last. The mail method takes a hash of mail-relevant information - the subject, the to address, the from (we're using the default), and any cc or bcc information you want - and prepares the email to be sent.\n mail(to: user.email, subject: \"New comment on #{post.title}\")\n end",
"def congratulate_for_accepted_comment(comment)\n @comment = comment\n @user = comment.user\n @structure = @comment.structure\n mail to: @comment.email, subject: \"Votre avis à propos de : #{@structure.name}\", template_name: 'congratulate_for_comment'\n end",
"def notify_on_mention?; true; end",
"def new\n\n\n @to_user = User.find(:first, :conditions => \"id = '#{params[:to_id]}'\") \n\n if current_user and @to_user and @to_user.id != current_user.id\n\n\n @replying_to_message = Tomessage.find(:first, :conditions => \"id = '#{params[:replying_to_message_id]}'\")\n \n @tomessage = Tomessage.new\n\n\n @rated = false\n @rating = 0\n\n begin\n ############################################################################\n ### if a user is rating a message that was sent to them\n ############################################################################\n # if params[:rating] and if the ORIGINAL message has no rating\n # add that many points to the sender's impact points\n # store the rating, (goal)category and message_type on the ORIGINAL message\n # send a copy of the message to the sender and to support w/ the rating\n # prompt the recipient to message the sender\n if params[:rating] and @replying_to_message and !@replying_to_message.rating\n @rating = params[:rating].to_i\n\n ### add that many points to the sender's impact points\n if @to_user\n if !@to_user.impact_points\n @to_user.impact_points = 0\n end\n @to_user.impact_points += @rating\n @to_user.save\n\n @to_user.impact_leader_update\n\n\n end\n\n\n ### save the rating, category and message_type on the original message\n @replying_to_message.rating = @rating\n if params[:category]\n @replying_to_message.category = params[:category]\n end\n if params[:message_type]\n @replying_to_message.message_type = params[:message_type]\n end\n @replying_to_message.save\n\n @rated = true\n\n @from_user = current_user\n Notifier.deliver_tomessage_rated_notification(@to_user, @from_user, @replying_to_message, @rating) # sends the email\n\n end ### end if params[:rating] and params[:replying_to_message_id]\n ############################################################################\n rescue\n logger.error(\"sgj:tomessages_controller.rb:error while rating message\")\n end\n\n\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tomessage }\n end\n else\n redirect_to(server_root_url + \"/goals\")\n end\n\n end",
"def edited_comment_reply_notification(your_comment_id, edited_comment_id)\n @your_comment = Comment.find(your_comment_id)\n @comment = Comment.find(edited_comment_id)\n mail(\n :to => @your_comment.comment_owner_email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Edited reply to your comment on \" + @comment.ultimate_parent.commentable_name.gsub(\">\", \">\").gsub(\"<\", \"<\")\n )\n end",
"def user_message(recip, from, from_name, message)\n recipients recip\n from from\n subject \"Message from Weefolio User #{from_name}\"\n sent_on Time.now\n body message\n end",
"def message_params\n params.require(:message).permit(:receiver_username, :body, :subject)\n end",
"def process(message)\n end",
"def send_notifications\n send_new_post_to(:sender) if self.sender.notify_on_comment_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_comment_received\n end",
"def test_create_reply_to_reply_to_standalone_message_about_kevins_review_59\r\n reply_to = messages(:tim_reply_to__andy_to_kevin_about_kevins_review_59)\r\n about = Factory :review\r\n about.user = @kevin\r\n send_message(@matt, @tim, reply_to, about)\r\n end",
"def comment comment\n end",
"def comment_params\n params.permit(:message, :user_id, :recipe_id)\n end",
"def update_message(data); end",
"def update_message(data); end",
"def did_receive_notice(stem, sender, recipient, msg)\n end",
"def specified_comment(token, action)\n @comment = @graph.get_connections(@post_id, \"comments\",\n :limit=>1,\n :fields => [\"from{name,id,picture}\",\n \"id\",\n \"message\",\n \"created_time\",\n \"like_count\", \n ],\n action => token,\n )\n end",
"def create\n Rails.logger.info \"CREATING NEW NOTE with params #{params}\"\n receiver = find_by_type_and_id(params[:receiver_type], params[:receiver_id])\n note = Note.new(:message => params[:message], :sender => current_profile, :private => params[:private_note], :receiver => receiver)\n if (reply_to_note_id = params[:reply_to_note_id])\n note.receiver = Note.find(reply_to_note_id).sender\n note.replied_to = reply_to_note_id\n end\n note.save! \n flash[:notice] = \"Your message has ben sent.\" \n render :text => {:message => \"Messsage Sent\" }.to_json\n rescue Exception => e\n flash[:errors] = \"There was an error sending your message, please try again.\"\n render :text => {:message => \"Unable to save message.\", :error => e.message }.to_json\n end",
"def create\n @comment = @commentable.wall_comments.new comment_params\n if @comment.save\n @commentable.create_activity :comment, owner: current_user, recipient: @comment if log_activity?\n end\n end",
"def comment_on_alert(info_request, comment)\n @from = contact_from_name_and_email\n headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken\n 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834\n @recipients = info_request.user.name_and_email\n @subject = \"Somebody added a note to your FOI request - \" + info_request.title\n @body = { :comment => comment, :info_request => info_request, :url => main_url(comment_url(comment)) }\n end",
"def add_comment(message)\n rsp = @flickr.send_request('flickr.photos.comments.addComment', {:photo_id => self.id, :comment_text => message}, :post)\n true\n end",
"def show\n @message = Message.find(params[:id])\n if user_signed_in?\n @new_comment = Comment.build_from(@message, current_user.id, \"\")\n end\n #@user_who_commented = current_chef\n #@comment = Comment.build_from( @message, @user_who_commented.id, \"\" )\n end",
"def comment_params\n params.require(:comment).permit(:id, :post_id, :message, :from, :reactions, :comments)\n end"
] |
[
"0.71924114",
"0.66960216",
"0.66581726",
"0.6657399",
"0.6440642",
"0.6408755",
"0.6408182",
"0.63921463",
"0.6360294",
"0.6352635",
"0.6345036",
"0.63407266",
"0.631793",
"0.6309358",
"0.6280826",
"0.6258344",
"0.6235866",
"0.6221849",
"0.62119275",
"0.6200361",
"0.6176798",
"0.61765975",
"0.6163772",
"0.614976",
"0.614846",
"0.6135094",
"0.6128234",
"0.6091095",
"0.60882014",
"0.6075786",
"0.6069691",
"0.60386294",
"0.6036524",
"0.6027368",
"0.6025132",
"0.6023053",
"0.6012853",
"0.60108757",
"0.60035247",
"0.60024595",
"0.59973824",
"0.59701645",
"0.5966872",
"0.59657574",
"0.5955258",
"0.5952759",
"0.5952737",
"0.5952737",
"0.5933816",
"0.5933651",
"0.59326744",
"0.5920462",
"0.59139025",
"0.59139025",
"0.59139025",
"0.59055126",
"0.58999217",
"0.5896864",
"0.5888663",
"0.5888663",
"0.5881395",
"0.5878967",
"0.58759445",
"0.58703935",
"0.58693606",
"0.5860111",
"0.5853234",
"0.5848765",
"0.5833858",
"0.5833385",
"0.5828676",
"0.5827195",
"0.58213395",
"0.5820107",
"0.58171535",
"0.5816851",
"0.5813311",
"0.5813308",
"0.5811396",
"0.5808886",
"0.57937485",
"0.57911074",
"0.57906085",
"0.5787935",
"0.57865644",
"0.57853085",
"0.57844186",
"0.5784198",
"0.578239",
"0.57803196",
"0.5775332",
"0.5775332",
"0.5772289",
"0.5771334",
"0.57695365",
"0.5768733",
"0.5764817",
"0.57633066",
"0.5760441",
"0.57574505"
] |
0.6423564
|
5
|
required params: mentionable, receiver
|
def mentioned
@user = @receiver
@notification = @user.notifications.find_by(link: @mentionable.path)
subject = "[FBC] #{@mentionable.where_mention}で#{@mentionable.sender.login_name}さんからメンションがありました。"
mail to: @user.email, subject: subject
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notify_on_mention?; true; end",
"def act_as_mentioner\n include Mentioner\n end",
"def act_as_mentionee\n include Mentionee\n end",
"def on_mention(&block)\n on(:message) do |data|\n debug on_message: data, bot_message: bot_message?(data)\n if !bot_message?(data) &&\n (data.text =~ /\\A(#{mention_keywords.join('|')})[\\s\\:](.*)/i ||\n data.text =~ /\\A(<@#{bot_user_id}>)[\\s\\:](.*)/) &&\n user_message?(data)\n message = $2.strip\n @last_received_user_message.merge!(message: message)\n instance_exec(@last_received_user_message, &block)\n end\n end\n end",
"def mentioners(mentionable, klass, opts = {})\n rel = Socialization::RedisCache::Mention.mentioners(mentionable, klass, opts)\n rel = super(mentionable, klass, opts) if rel.blank?\n rel\n end",
"def mentioning_text\n self.text\n end",
"def on_mention(tweet)\n txt = tweet.text.split[1..-1].join(' ')\n response = MODEL.make_response(txt, 100)\n reply(tweet, response)\n end",
"def recipient; end",
"def on_mention(tweet)\n\n #this is a bot we know\n if @botinfo.key?(tweet.user.screen_name)\n bot = @botinfo[tweet.user.screen_name]\n if bot.should_reply_to()\n #reply to the bot\n bot.replies_left -= 1\n sleep(rand(5..30))\n do_reply(tweet)\n else\n log \"not replying to bot\"\n end\n\t \n else\n # Become more inclined to pester a user when they talk to us\n userinfo(tweet.user.screen_name).pesters_left += 1\n delay do\n do_reply(tweet)\n end\n end\n end",
"def mentioners(mentionable, klass, opts = {})\n mentioners_relation(mentionable, klass, opts)\n end",
"def mentionables(mentioner, klass, opts = {})\n rel = Socialization::RedisCache::Mention.mentionables(mentioner, klass, opts)\n rel = super(mentioner, klass, opts) if rel.blank?\n rel\n end",
"def receiver\n self.kase.person if self.kase\n end",
"def mentioned\n @user = @receiver\n @notification = @user.notifications.find_by(path: @mentionable.path)\n subject = \"[bootcamp] #{@mentionable.where_mention}で#{@mentionable.sender.login_name}さんからメンションがありました。\"\n mail to: @user.email, subject: subject\n end",
"def mention\n \"<@#{@id}>\"\n end",
"def mention\r\n return @user.mention\r\n end",
"def on_mention(json)\n event = json[:event]\n authed_users = json[:authed_users]\n text = event[:text].strip\n text = text.gsub(Regexp.union(*authed_users.map {|s| \"<@#{ s }>\" }), \"\").strip\n\n json = command(text) do |progress|\n case progress\n when :start\n post(\"reactions.add\", channel: event[:channel], name: EMOJI, timestamp: event[:ts])\n when :end\n post(\"reactions.remove\", channel: event[:channel], name: EMOJI, timestamp: event[:ts])\n end\n end\n\n if json\n json[:thread_ts] = event[:thread_ts] || event[:ts] if json[:thread_ts]\n post(\"chat.postMessage\", channel: event[:channel], **json)\n end\n end",
"def spam_my_followers(message)\n followers_list.each {|follower|\n dm(follower, message)\n }\n end",
"def mentioners_relation(mentionable, klass, opts = {})\n rel = Socialization::RedisCache::Mention.mentioners_relation(mentionable, klass, opts)\n rel = super(mentionable, klass, opts) if rel.blank?\n rel\n end",
"def like(target)\n # liked_images << image\n like = likes.create(likable: target)\n delay.notify_followers(like, target, \"LikeActivity\")\n\n # followers.each do |follower|\n # follower.activities.create(\n # subject: like, \n # type: \"LikeActivity\")\n # end\n\n end",
"def send_mention(post)\n post.mentioned.each do |mentioned_user|\n Notification.send_to mentioned_user, 'mention', post.topic, post.user, post\n end unless post.mentioned.blank?\n end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end",
"def light_the_way\n HisMastersVoice.instance.tell_me(self)\n end",
"def someone_did_kick(stem, kicker, channel, victim, msg)\n end",
"def messaging\n end",
"def mentioning_text\n self.text\n end",
"def remove_mentioners(mentionable)\n super(mentionable)\n Socialization::RedisCache::Mention.remove_mentioners(mentionable)\n end",
"def mention_params\n params[:mention]\n end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def someone_did_invite(stem, inviter, invitee, channel)\n end",
"def trigger_after_like\n likeable.fire_after_like(self) if likeable.respond_to?(:fire_after_like)\n user.fire_after_like(self) if user.respond_to?(:fire_after_like)\n end",
"def someone_did_join_channel(stem, person, channel)\n end",
"def onmessage(&blk); super; end",
"def mentionables_relation(mentioner, klass, opts = {})\n rel = Socialization::RedisCache::Mention.mentionables_relation(mentioner, klass, opts)\n rel = super(mentioner, klass, opts) if rel.blank?\n rel\n end",
"def respond(m, cl, msg)\n m2 = Message.new(m.from, msg)\n m2.type = m.type\n cl.send(m2)\nend",
"def follow\n\n end",
"def did_receive_private_message(stem, sender, msg)\n end",
"def hook_thyself\n me = self;\n\n # Show blacklist\n register_command(:omeg_blacklist_show, /^[Oo]megleBlacklist$/, /channel/){\n me.report_blacklist(bot, channel)\n }\n \n # Toggle use of blacklist for a user \n register_command(:omeg_blacklist, /^[Tt]oggleMe$/, /channel/){\n me.toggle_blacklist(bot, channel, nick)\n }\n\n # Toggle use of nick template\n register_command(:omeg_toggle, /^[Tt]oggleNick$/, /channel/){\n me.toggle_nick(bot, channel)\n }\n\n # Connect to a single stranger with <nickname> support\n register_command(:omeg_connect, /^[Oo]megle$/, /channel/){|*topics|\n me.ensure_not_blacklisted(channel, nick)\n me.summon_omegleite(bot, channel, topics)\n }\n \n # Connect to a single stranger with <nickname> support\n register_command(:omeg_ask, /^[Aa]skMe$/, /channel/){\n me.ensure_not_blacklisted(channel, nick)\n me.summon_omegleite(bot, channel, nil, true)\n }\n\n # Spy mode, ask a question and watch two people debate.\n register_command(:omeg_spy, /^[Aa]sk$/, /channel/){|*question|\n if(question.length < 0)\n bot.say(\"Please provide a question!\")\n else\n me.spy_mode(bot, channel, question.join(\" \"))\n end\n }\n\n end",
"def on_directed_message(message, speaker, buddy, command_executed)\n #at this stage we do nothing...\n end",
"def listen(m)\n if /#([0-9]*)/.match(m.message)\n ticket = /#([0-9]*)/.match(m.message)[1]\n m.reply \"Did someone mention ticket ##{ticket}? Here's a link: \" + \"https://transmit.codebasehq.com/projects/brand-regard/tickets/\" + ticket\n end\n end",
"def on_message(m)\n end",
"def did_receive_notice(stem, sender, recipient, msg)\n end",
"def friend_request\n\nend",
"def act_as_followee\n include Followee\n end",
"def remove_mentionables(mentioner)\n super(mentionable)\n Socialization::RedisCache::Mention.remove_mentionables(mentioner)\n end",
"def block_friend\n end",
"def execute actor, target=[nil]\n def himher thing\n multiple = thing.count > 1 \n\n if multiple \n return \"them\"\n end\n\n case thing[0]\n when Player then \"him\"\n when ItemFacade then \"it\"\n else \"\"\n end\n end\n room_msg, self_msg, vict_msg = @ofound.dup, @found.dup, @tfound.dup\n\n\n if target.include?(actor) # if they're the same person then it's an auto\n target = [actor]\n room_msg = @oauto.dup\n self_msg = @auto.dup\n vict_msg = nil\n elsif target[0] == nil\n room_msg = @onoarg.dup\n self_msg = @noarg.dup\n vict_msg = nil\n end\n room_msg.gsub!(\"$n\", \"<%=other.peek(actor)%>\")\n room_msg.gsub!(\"$N\", \"<%=other.peek(if arg[0].include?(other) then arg[0]-[other]+['You'] else arg[0] end)%>\")\n room_msg.gsub!(\"$m\", himher([actor]))\n room_msg.gsub!(\"$M\", himher(target))\n\n self_msg.gsub!(\"$M\", himher(target))\n self_msg.gsub!(\"$m\", himher([actor]))\n if target\n self_msg.gsub!(\"$N\", actor.peek(target))\n end\n actor.view(\"#G\"+self_msg+\"#n\" + ENDL)\n \n room_msg.untaint\n if target[0]\n if target.count > 1 \n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor], \"#G\"+room_msg+\"#n\", target)\n else\n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor, *target], \"#G\"+room_msg+\"#n\", target)\n target.each do |one_targ|\n vm = vict_msg.dup\n vm.gsub!(\"$n\", one_targ.peek(actor))\n one_targ.view(\"#G\"+vm+ \"#n\" + ENDL)\n end\n end\n else\n puts room_msg\n actor.in_room.display([:visual, \"other.can_see?(actor)\"], actor, [actor], \"#G\"+room_msg+\"#n\", \"\")\n end\n end",
"def allowTalkToSelf()\n banner(\"Allow Agents to mumble\")\n @mumbleFlag = true\n end",
"def receiver\n users[0].id.eql?(sent_by) ? users[1] : users[0]\n end",
"def mention_notice(user)\n \n @user = user\n mail to: user.email, subject: \"You've been Mentioned in a post!\"\n end",
"def sender_or_receiver(message)\n if params[:action] == \"outbox\"\n to_user_link(message)\n # Used for both inbox and trashbin\n else\n from_user_link(message)\n end\n end",
"def create_post_owner_notification_of_like(like)\n return if like.user.id == self.user.id # don't notify user of his own likes..\n case like.likeable.wallable.class.name\n when 'Recipe'\n url = \"recipes/#{self.wallable_id}\"\n when 'Tip'\n url = \"tips/#{self.wallable_id}\"\n else\n base_url = self.user.poster? ? \"wall_expert\" : \"wall\"\n url = !self.parent_post_id.nil? ? \"#{base_url}/#{self.parent_post_id}?reply=#{self.id}\" : \"#{base_url}/#{self.id}\"\n end\n notify(self.user, \"Your post was liked!\", \"#{like.user.profile.full_name} liked your post!\", :from => like.user, :key => post_like_notification_key(like), :link => url)\n end",
"def receiver\n home.receiver\n end",
"def set_mention\n @mention = Mention.find(params[:id])\n end",
"def mentioned(options={})\n self.class.parse_comments(request(singular(user_id) + \"/mentioned\", options))\n end",
"def rezm_sender_or_receiver(message)\n if params[:action] == \"outbox\"\n rezm_to_user_link(message)\n # Used for both inbox and trashbin\n else\n rezm_from_user_link(message)\n end\n end",
"def addressed_to_me?(message)\n if m = message.body.match(/^\\b#{name}[,:]\\s*(.*)/i) || message.body.match(/^\\s*(.*?)[,]?\\b#{name}[.!?\\s]*$/i)\n message.command = m[1]\n end\n end",
"def react_to *args; end",
"def message_for_twitter(content)\n if content and content.text\n twitter_message_link = polymorphic_url(content.parent || content).gsub(/datalogger=true/, '')\n content.text.truncate(139 - twitter_message_link.length) + ' ' + twitter_message_link\n end\n end",
"def apply_meth(receiver, meth, activity)\n case receiver.method(meth).arity\n when 2\n receiver.__send__(meth, activity, self.timeline_class)\n when 1\n receiver.__send__(meth, activity)\n else\n receiver.__send__(meth)\n end\n end",
"def mentions_member?(name)\n mentions_parameter?(name)\n end",
"def markable_actor\n MarkAsAnything.actor = self\n include MarkAsAnything::MarkableActorMethods::InstanceMethods\n end",
"def mentionables(mentioner, klass, opts = {})\n mentionables_relation(mentioner, klass, opts)\n end",
"def receiver\n nil\n end",
"def with(current_user)\n author == current_user ? receiver : author\n end",
"def act_as_follower\n include Follower\n end",
"def handle_chat(msg, message)\n @user = msg.actor\n #raise \"#{self.class.name} doesn't implement `handle_chat`!\"\n end",
"def did_receive_channel_message(stem, sender, channel, msg)\n end",
"def replyToChatter(origin,reply)\n Debug.log \"Reply to chatter #{reply} (#{origin})\"\n f=Databasedotcom::Chatter::FeedItem.find(@client,origin);\n f.comment(reply)\n end",
"def route_command(message_body)\n route(\"#{robot.mention_name} #{message_body}\")\n end",
"def parse_mention(mention)\n # Mention format: <@id>\n return nil unless /<@!?(?<id>\\d+)>?/ =~ mention\n user(id.to_i)\n end",
"def receiver_by_author\n receiver = project.find_receiver(\n project.team_by_user(user_author.username), 'slack'\n )\n project.find_receiver(user_author.team, 'slack') unless receiver\n\n receiver\n end",
"def mention(conversation_id, user_id, author_id)\n @conversation = Conversation.find(conversation_id)\n @user = User.find(user_id)\n @author = User.find(author_id)\n mail(:to => @user.email, :subject => _('%s mentioned you in %s on %s.') % [\n @author.full_name, @conversation.title, Founden::Config.app_name\n ])\n end",
"def mentioned(user, comment)\n author = comment.author\n url = timeline_url(comment.commentable)\n\n PushNotificationService.new.mentioned(user, comment)\n Notifications.mentioned(user, comment, author, url).deliver_later\n end",
"def receive_likers\n media = instagram_service.media_by_shortcode(event.url)\n media_id = media['data']['id']\n likes = instagram_service.media_likes(media_id)\n event.update(likers: likes['data'].collect { |elem| elem['username'] })\n end",
"def hook_thyself\n me = self\n\n\n\n # Add something to tell someone\n register_command(:tweet_cmd, /^tweet$/, [/channel/, /private/]){|*args| \n me.tweet(bot, nick, args.join(\" \"))\n }\n\n\n \n # Hook for when we have successfully joined\n @config[:channels].each do |chan|\n register_hook(\"twitter_join_#{chan}\".to_sym, lambda{|m| m.channel == chan}, /join/){\n me.join_channel( chan, bot ) if nick == bot_nick # Ensure we only fire if the bot has joined, not other people\n }\n end\n\n end",
"def on_part(connection, channel, user)\n end",
"def on_send(node)\n _receiver, method_name, _args = *node\n return unless method_name == :stub\n\n add_offense(node)\n end",
"def broadcast\n ActionCable.server.broadcast \"#{self.loggable_type}:#{self.loggable_id}\", self\n end",
"def execute(m, receiver, message)\n m.reply 'Done.'\n User(receiver).send(message)\n end",
"def add_mention(user)\n @mentions << user unless user.name == self.name or mentions.include?(user)\n self\n end",
"def NPC_feedback\n\nend",
"def deal_liked(target, like)\n @target = target\n @user = like.user\n @deal = like.deal\n @like = like\n mail :to => target.email, \n :tag => \"like\",\n :subject => \"#{@user.best_name} loved your Qwiqq post!\"\n end",
"def method_missing(name, *args, &block)\n self.receiver.send name, *args, &block\n end",
"def micropost_notification(poster, follower, micropost)\n @greeting = \"Hi\"\n @follower = follower\n @micropost = micropost\n @poster = poster\n\n mail to: follower.email, subject: \"New Tweet!\"\n \n end",
"def aimedAtTarget _obj, _args\n \"_obj aimedAtTarget _args;\" \n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.chatMembersNotificationRecipient\"\n end",
"def link_to_mentioned_user(mention)\n user = User.by_slug(mention).first || User.find_by(id: mention)\n return unless user\n\n result[:mentioned_users] |= [user.id]\n\n url = \"/users/#{user.slug || user.id}\"\n <<-HTML\n <a href=\"#{url}\" class=\"user-mention\">\n @#{user.name}\n </a>\n HTML\n end",
"def reply_mention(reply_to_user, in_reply_to_id)\n log \"replying to mention\"\n post_reply(reply_to_user, in_reply_to_id, random_mention(reply_to_user.id))\n end",
"def ask_for_recipient\n\n end",
"def show_humour_replies(sender_id, quick_replies)\n say(sender_id, IDIOMS[:greetings], quick_replies)\n humour_analysis(sender_id)\nend",
"def respond msg\n say \"Override #{self.class.name}.respond to have your bot do something.\"\n nil\n end",
"def user_response(bot, event)\n event = bot.add_await!(Discordrb::Events::MentionEvent, in: event.channel, from: event.author)\n event.message.text.split[1].to_i\nend",
"def update!(**args)\n @mention = args[:mention] if args.key?(:mention)\n end",
"def __add__(receiver)\n\t\t\t\t@receivers << receiver\n\t\t\tend",
"def set_recipient\n end"
] |
[
"0.7169113",
"0.6805239",
"0.6700532",
"0.62538296",
"0.62462676",
"0.61716443",
"0.61335725",
"0.6038367",
"0.60210955",
"0.6016014",
"0.5931311",
"0.5910494",
"0.5908463",
"0.5868737",
"0.5831521",
"0.5759242",
"0.57286364",
"0.57264876",
"0.57258904",
"0.57204026",
"0.5717905",
"0.5717366",
"0.57154495",
"0.5709639",
"0.570178",
"0.5692614",
"0.5684293",
"0.5651126",
"0.5651126",
"0.5651126",
"0.5651126",
"0.5651126",
"0.5651126",
"0.5646517",
"0.5632069",
"0.5627713",
"0.56225365",
"0.55997974",
"0.55827093",
"0.5561798",
"0.5553348",
"0.55059123",
"0.5500315",
"0.54943454",
"0.54930663",
"0.54922926",
"0.54860604",
"0.54778814",
"0.5475757",
"0.5473217",
"0.5466285",
"0.5465672",
"0.54636705",
"0.54615504",
"0.54557765",
"0.54522043",
"0.54439634",
"0.5425676",
"0.54004526",
"0.53929305",
"0.5374308",
"0.5366258",
"0.53649056",
"0.5360252",
"0.535457",
"0.53538686",
"0.5346483",
"0.5344258",
"0.53375775",
"0.5322176",
"0.53208107",
"0.5308916",
"0.5308073",
"0.53010446",
"0.5295821",
"0.5288755",
"0.5281924",
"0.52793056",
"0.5276983",
"0.52735394",
"0.52610976",
"0.5253606",
"0.52510726",
"0.5250499",
"0.52462375",
"0.5243508",
"0.52428675",
"0.52416533",
"0.5239815",
"0.52384996",
"0.5236185",
"0.5233977",
"0.5233717",
"0.52272683",
"0.52243704",
"0.5218847",
"0.5212598",
"0.52121323",
"0.5208909",
"0.5207957"
] |
0.61298054
|
7
|
required params: sender, receiver
|
def retired
@user = @receiver
@notification = @user.notifications.find_by(link: "/users/#{@sender.id}")
subject = "[FBC] #{@sender.login_name}さんが退会しました。"
mail to: @user.email, subject: subject
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def received\n end",
"def receiver\n nil\n end",
"def real_sender()\n\t\tself.received.last\n\tend",
"def receiver\n home.receiver\n end",
"def sender\r\n SenderController.instance\r\n end",
"def recipient; end",
"def signal_received=(_arg0); end",
"def sender=(value)\n @sender = value\n end",
"def sender=(value)\n @sender = value\n end",
"def broadcast\n end",
"def receiving(data); end",
"def receiving(data); end",
"def signal_received; end",
"def sender?\n !!self.sender\n end",
"def realtime_sender() \n loop {\n @sender_plugin.send_data(@data.pop)\n }\n end",
"def sender?\n !!self.sender\n end",
"def sender\n return @sender\n end",
"def sender\n return @sender\n end",
"def receiver\n self.kase.person if self.kase\n end",
"def notifier; end",
"def notifier; end",
"def method_missing(name, *args, &block)\n self.receiver.send name, *args, &block\n end",
"def isolate_signals; end",
"def onmessage(&blk); super; end",
"def ask_for_recipient\n\n end",
"def isolate_signals=(_arg0); end",
"def receive\n raise NotImplementedError\n end",
"def signal\n end",
"def copy_sender?(subscriber)\n false\n end",
"def _push_receiver(receiver)\n @_receivers.push receiver\n end",
"def did_receive_notice(stem, sender, recipient, msg)\n end",
"def on_sendable(sender)\n # While sender credit is available\n # and number of sent messages is less than count\n while (sender.credit > 0) && (@sent < @count)\n # Create new message\n msg = Qpid::Proton::Message.new\n # If message content is set\n if @msg_content\n # If message content is string and contains formatting part\n if @msg_content.is_a? String and @msg_content =~ /%[0-9]*d/\n # Format message content with number of sent messages\n msg.body = sprintf(@msg_content, @sent)\n else\n # Set message content as it is\n msg.body = @msg_content\n end\n end # if\n # Set message durability\n msg.durable = @msg_durable\n # Set message TTL (ms)\n msg.ttl = @msg_ttl\n # If message correlation ID is set\n if @msg_correlation_id\n msg.correlation_id = @msg_correlation_id\n end # if\n # Set reply to address\n msg.reply_to = @msg_reply_to\n # If message group ID is set\n if @msg_group_id\n msg.group_id = @msg_group_id\n end\n # Send message\n sender.send(msg)\n # Increase number of sent messages\n @sent = @sent + 1\n if @log_msgs == \"body\"\n Formatters::BasicFormatter.new(msg).print\n elsif @log_msgs == \"dict\"\n Formatters::DictFormatter.new(msg).print\n end\n end # while\n end",
"def set_Receiver(value)\n set_input(\"Receiver\", value)\n end",
"def __add__(receiver)\n\t\t\t\t@receivers << receiver\n\t\t\tend",
"def messaging\n end",
"def from_admin?\n if self.sender == self.receiver\n true\n else\n false\n end\n end",
"def start\n\t\tself.sender.start\n\tend",
"def sender( val = nil )\n default :sender, val\n end",
"def event_incoming_broadcast(peer, room, msg)\nend",
"def sender=(sender)\n @sender = ensure_type(Sender, sender)\n end",
"def sender=(sender)\n @sender = ensure_type(Sender, sender)\n end",
"def set_receiver\n @receiver = Receiver.find(params[:id])\n end",
"def set_receiver\n @receiver = Receiver.find(params[:id])\n end",
"def set_receiver\n @receiver = Receiver.find(params[:id])\n end",
"def sender\n sender = User.where(:uid => sender_uid)\n sender.first\n end",
"def owner\n class << receiver; self; end\n end",
"def react_to *args; end",
"def receive(request); end",
"def onCreate(sender, data)\n\t\n\tend",
"def name; @receiver_impl.getName; end",
"def notifier=(_arg0); end",
"def notifier=(_arg0); end",
"def receiver\n ep = received_event_parameters\n ep.user if ep\n end",
"def request_booking_proposed(sender, receiver)\n @url = booking_requests_path\n @sender_name = sender.username.titleize\n mail to: receiver.email,\n subject: \"fitafy Booking Request from #{sender.username}\",\n date: Time.now\n end",
"def from=(address)\n self.sender = address\n end",
"def set_Receiver(value)\n set_input(\"Receiver\", value)\n end",
"def receiver\n receivers.first\n end",
"def handler; end",
"def handler; end",
"def receive_object obj\n # stub\n end",
"def sender\n @sender ||= User.find( @sender_id )\n end",
"def receive(data); end",
"def sent?\n sender_id.present?\n end",
"def set_sender\n @survivor = Survivor.find(params[:survivor_id])\n @sender = Survivor.find(params[:sender_id])\n\n action_errors\n end",
"def __send__(*rest) end",
"def receive_recipient rcpt\n true\n end",
"def receive_recipient rcpt\n true\n end",
"def receive_recipient rcpt\n true\n end",
"def start_cesure(key, receiver)\n end",
"def send_message\n send unless SuppressionList.include?(receiver)\n end",
"def sender\n @payload[:sender]\n end",
"def subscribed; end",
"def signal; end",
"def signal; end",
"def set_recipient\n end",
"def did_receive_private_message(stem, sender, msg)\n end",
"def receive_data(data)\n end",
"def resent_sender( val = nil )\n default :resent_sender, val\n end",
"def event; end",
"def event; end",
"def event; end",
"def on_receive(message)\n end",
"def send_pending; end",
"def send_events=(_arg0); end",
"def called_from; end",
"def called_from; end",
"def on_receive_order(value)\n end",
"def on_receive_order(value)\n end",
"def listener; end",
"def sender? usr\n usr.id == user_id\n end",
"def forward_object_receiver(receiver, method, name, *_args)\n define_method(name) do |*args, &b|\n receiver.__send__(method, *args, &b)\n end\n end",
"def io\n @receiver\n end"
] |
[
"0.7184803",
"0.7184803",
"0.7184803",
"0.7184803",
"0.7184803",
"0.7184803",
"0.71230376",
"0.71230376",
"0.71230376",
"0.6720115",
"0.659095",
"0.65649134",
"0.6417476",
"0.63461334",
"0.63454366",
"0.6289759",
"0.62462395",
"0.62462395",
"0.6230798",
"0.62252563",
"0.62252563",
"0.6190506",
"0.6189653",
"0.61255205",
"0.6107633",
"0.6068279",
"0.6068279",
"0.60680556",
"0.5982506",
"0.5982506",
"0.5981504",
"0.5877839",
"0.5870483",
"0.58680445",
"0.5855474",
"0.58366805",
"0.58168554",
"0.58096266",
"0.5782937",
"0.5780796",
"0.57767254",
"0.5769263",
"0.57614976",
"0.5760645",
"0.576001",
"0.57597286",
"0.574901",
"0.5747386",
"0.57405967",
"0.57405967",
"0.57313603",
"0.57313603",
"0.57313603",
"0.5730168",
"0.57207304",
"0.57198524",
"0.57197",
"0.57193065",
"0.5709857",
"0.57094294",
"0.57094294",
"0.57067233",
"0.57066643",
"0.5701524",
"0.5695139",
"0.5689833",
"0.5676682",
"0.5676682",
"0.5673834",
"0.5667259",
"0.56619525",
"0.5658872",
"0.56487864",
"0.5638845",
"0.56354344",
"0.56354344",
"0.56354344",
"0.5631772",
"0.5629936",
"0.56278676",
"0.5626512",
"0.5610074",
"0.5610074",
"0.56093895",
"0.5600054",
"0.5590607",
"0.5586338",
"0.5584809",
"0.5584809",
"0.5584809",
"0.5584409",
"0.55753595",
"0.55749214",
"0.55670226",
"0.55670226",
"0.556654",
"0.556654",
"0.5563666",
"0.55593646",
"0.55581385",
"0.5547306"
] |
0.0
|
-1
|
required params: report, receiver
|
def trainee_report
@user = @receiver
@notification = @user.notifications.find_by(link: "/reports/#{@report.id}")
subject = "[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!"
mail to: @user.email, subject: subject
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def set_report\n end",
"def report\n\t\tend",
"def report\n \n end",
"def reporters=(_arg0); end",
"def reporters=(_arg0); end",
"def reporters=(_arg0); end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def report_data\n ReportMailer.report_data\n end",
"def report_params\n end",
"def report(handler)\n raise NotImplementedError\n end",
"def deliver_report\n # The base class is just a stub and doesn't need to do anything.\n end",
"def call(delivery_report)\n if delivery_report.error.to_i.positive?\n instrument_error(delivery_report)\n else\n instrument_acknowledged(delivery_report)\n end\n end",
"def report_body; end",
"def report_body; end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def report(option)\n @report_type = option\n self\n end",
"def report\n @report || @schedule\n end",
"def create_new_report!; end",
"def create_new_report!; end",
"def deliver_alarm\n # In the base stub class, just route these to the report method.\n deliver_report\n end",
"def report=(value)\n @report = value\n end",
"def report(information)\n @overlord.receive_report(information)\n end",
"def begin_report_command(command, report)\n @report = report\n end",
"def report(output)\n end",
"def reporting\n # STUB\n end",
"def report\n @logger\n end",
"def reset\n raise \"#{self.class} should implement #report\"\n end",
"def write_report\n\n end",
"def parse_report(result_body)\n # The routin should be provided in the inherited class\n end",
"def report(context, repo, dir)\n raise \"No report(context, repo, dir) function defined by report subclass\"\n end",
"def report!(msg = \"\")\n puts(\"#{caller.first}: #{msg}\")\n end",
"def set_report\n #@report = Report.find(params[:id])\n end",
"def following_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end",
"def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end",
"def set_report\n @report = Report.find(params[:id])\n @reportable = @report.reportable\n end",
"def reports_path; end",
"def reports_path; end",
"def send_report_data\n render_type = RENDER_TYPES[@sb[:render_type].to_s]\n raise \"Render type #{@sb[:render_type]} is not supported\" unless render_type\n\n assert_privileges(\"render_report_#{render_type}\")\n\n return unless @sb[:render_rr_id]\n\n disable_client_cache\n result = MiqReportResult.find(@sb[:render_rr_id])\n\n filename = filename_timestamp(result.report.title, 'export_filename')\n send_data(result.get_generated_result(@sb[:render_type]),\n :filename => \"#{filename}.#{@sb[:render_type]}\",\n :type => \"application/#{@sb[:render_type]}\")\n\n result.destroy\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = BgWorkerReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def report_run(command)\n super do |report|\n @report = report\n yield report\n end\n end",
"def inspector_successfully_received_report(report, _)\n report.issues[0..2].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > 3\n UI.puts \"and #{report.total_results - 3} more at:\"\n UI.puts report.url\n end\n end",
"def get_report\n @FROM_CONNECT_RELATION = report(\"#{@FROM_REPORT}\")\n @TO_CONNECT_RELATION = report(\"#{@TO_REPORT}\")\n end",
"def report_notifier(supplier)\n\t @supplier = supplier\n\t mail(:to => supplier.email,\n\t :subject => \"#{supplier.first_name} you just recieved a report on your local market-place\")\n end",
"def report_params\n params[:report]\n end",
"def create_sale_report\n mail = LogMailer.sale_report(self).deliver\n end",
"def set_report\n @report_type = params[:report_type]\n end",
"def set_report\n @report_type = params[:report_type]\n end",
"def set_received_expense_report\n @expense_report = ExpenseReport.find(params[:id])\n end",
"def create_global_report\n super\n end",
"def invoke(_report)\n prepare_invoke!\n 0\n end",
"def by_mail_tracker\n end",
"def report_account\n @report_account || self\n end",
"def report(information)\n @keeper.report(information)\n end",
"def prepare_report_object_hook\n # Nothing in base method\n end",
"def report\n return @report\n end",
"def first_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n mail to: @user.email,\n subject: \"[bootcamp] #{@report.user.login_name}さんがはじめての日報を書きました!\"\n end",
"def report_learner\n # I'm using the ! here so we can track down errors faster if there is an issue making\n # the report_learner\n super || create_report_learner!\n end",
"def report_request\n @subject = report_request_params[:subject]\n @requester = report_request_params[:requester]\n @message = report_request_params[:message]\n\n SingleCellMailer.admin_notification(@subject, @requestor, @message).deliver_now\n end",
"def compare_action\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end",
"def initialize( email_to=Passwords::MyName )\n \n # Reporting tool\n self.m = MechReporter.new\n \n # Report name\n self.name = File.basename( $0, '.*' )\n \n # File to check for failed reports\n self.checkname = \"#{ documents_path }\\\\#@name.txt\"\n \n # Email content\n self.email_to = email_to\n self.email_bcc = []\n self.files = []\n self.body = 'Automated Email'\n self.subject = nil\n \n # Check automation mode\n case ARGV[0]\n when /check/i\n puts 'Check mode active. Setting Automate mode: true'\n self.automation = true\n if ( File.read( checkname ) == today.to_s rescue false )\n puts 'Report already completed today'\n exit\n end\n when /automate/i\n puts 'Automated'\n self.automation = true\n when /test/i\n self.automation = true\n self.test = true\n self.email_to = Passwords::MyName\n else\n puts 'Not Automated'\n self.automation = false\n end\n \n end",
"def cant_report_myself\n # This line will check if the id that you want report is equal of yours id\n if self.reporter.id == self.reported.id\n # This is a message that show if you want report yourself\n errors.add(:expiration_date, \"can't report myself\")\n # Will render nothing if you dont fit on this\n else\n # do nothing\n end\n end",
"def initialize(report)\n @report = report\n end",
"def set_report\n\t\t@report = Report.find(params[:id])\n\tend",
"def vehicles_report\n email = current_employee.present? ? current_employee.email : COBALT_ADMIN_EMAIL[:figsoutbid]\n employee_id = current_employee.id\n logger.info(\"Will send report to \\\"#{email}\\\"\")\n \n Vehicle.queue_vehicles_report(email, locale, params[:state_as_string], employee_id)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_path }\n end\n end",
"def send_report\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\", subject: \"The report you requested.\"\n end",
"def set_response\n super(FblReportItem)\n end",
"def report_load\n self.report('load_report')\n end",
"def inspector_successfully_received_report(report, inspector)\n report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > NUMBER_OF_ISSUES_INLINE\n puts \"and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}\"\n puts \"\"\n end\n\n print_open_link_hint\n end",
"def getReport(oStatsProxy, iMechanizeAgent, iUserID)\n # Get the report page\n lReportPage = iMechanizeAgent.get(\"http://www.reverbnation.com/artist/artist_report_printable/#{iUserID}\")\n lChartPositionGenre = nil\n lChartPositionGlobal = nil\n lReportPage.root.css('body div#mainwrap div div div.control_room_graph_column').each do |iStatsSectionNode|\n lChildrenNodes = iStatsSectionNode.children\n lChildrenNodes.each_with_index do |iNode, iIdx|\n if (iNode.content == 'Genre:')\n lChartPositionGenre = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n elsif (iNode.content == 'Global:')\n lChartPositionGlobal = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n end\n end\n if ((lChartPositionGenre != nil) and\n (lChartPositionGlobal != nil))\n break\n end\n end\n if (lChartPositionGenre == nil)\n log_err \"Unable to get the chart positions: #{lReportPage.root}\"\n else\n lBandEquityScore = nil\n lNbrFriends = nil\n lReportPage.root.css('body div#mainwrap div div div.printable_pane').each do |iPaneNode|\n lChildrenNodes = iPaneNode.children\n lChildrenNodes.each_with_index do |iNode, iIdx|\n if (iNode.content == 'Band Equity Score: ')\n lBandEquityScore = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n elsif (iNode.content == 'Total Fans: ')\n lNbrFriends = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n end\n end\n if ((lBandEquityScore != nil) and\n (lNbrFriends != nil))\n break\n end\n end\n if (lBandEquityScore == nil)\n log_err \"Unable to get the band equity score: #{lReportPage.root}\"\n elsif (lNbrFriends == nil)\n log_err \"Unable to get the number of friends: #{lReportPage.root}\"\n else\n oStatsProxy.add_stat('Global', 'Chart position genre', lChartPositionGenre)\n oStatsProxy.add_stat('Global', 'Chart position global', lChartPositionGlobal)\n oStatsProxy.add_stat('Global', 'Band equity', lBandEquityScore)\n oStatsProxy.add_stat('Global', 'Friends', lNbrFriends)\n end\n end\n end",
"def deliver_clear\n # In the base stub class, just route these to the report method.\n deliver_report\n end",
"def set_report\n @report = Report.find(params[:id])\n end",
"def set_report\n @report = Report.find(params[:id])\n end",
"def set_report\n @report = Report.find(params[:id])\n end",
"def set_report\n @report = Report.find(params[:id])\n end",
"def report_get id\n call! report_get, id\n end",
"def run_special\n return unless (klass = validate_report_type params[:report_name])\n action = params[:what]\n\n # if we need a true redirect (for Download or Display On Screen),\n # serialize the form and use JS to force the redirect.\n if request.xhr? && action =~ /display|download/i\n render :js => %Q{window.location.replace('#{request.url}')} and return\n end\n\n @report = klass.__send__(:new, params[:output])\n result = @report.generate_and_postprocess(params)\n @customers = result && @report.customers\n\n # result.nil? means @report.errors contains errors from generating report\n render :js => %Q{alert(\"Errors generating report: #{@report.errors}\")} and return unless result\n\n render :js => 'alert(\"No matches.\")' and return if @customers.empty?\n\n\n case action\n when /display/i\n render :template => 'customers/index'\n when /estimate/i\n render :js => \"alert('#{@customers.length} matches')\"\n when /download/i\n @report.create_csv\n download_to_excel(@report.output, @report.filename, false)\n when /add/i\n seg = params[:sublist]\n result = EmailList.add_to_sublist(seg, @customers)\n msg = \"#{result} customers added to list '#{seg}'. #{EmailList.errors}\"\n render :js => %Q{alert(#{msg})}\n when /create/i\n name = params[:sublist_name]\n if (num=EmailList.create_sublist_with_customers(name, @customers))\n msg = ActionController::Base.helpers.escape_javascript %Q{List \"#{name}\" created with #{num} customers. #{EmailList.errors}}\n else\n msg = ActionController::Base.helpers.escape_javascript %Q{Error creating list \"#{name}\": #{EmailList.errors}}\n end\n render :js => %Q{alert('#{msg}')}\n else\n raise \"Unmatched action #{action}\"\n end\n end",
"def report_worker\n @report_worker ||= DataReportWorker.new\n end",
"def report=(report)\n report = report.to_i unless report.class == Fixnum\n unless report == 0 or report == 1\n raise ArgumentError.new('Report only could be 0 or 1')\n end\n @report = report\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = DevFeedbackReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def add_report\n # TODO: should traverse listener queue for conditions and callbacks\n if @rain == :warning or @rain == :imminent\n @site.reports.create\n end\n end",
"def mailer; end",
"def report_params\n params.fetch(:report, {})\n end",
"def report_path(report_path)\n @report_path = report_path\n end",
"def report(report_name, report, _path)\n case report_name\n when \"{#{NS_CALDAV}}calendar-multiget\"\n @server.transaction_type = 'report-calendar-multiget'\n calendar_multi_get_report(report)\n return false\n when \"{#{NS_CALDAV}}calendar-query\"\n @server.transaction_type = 'report-calendar-query'\n calendar_query_report(report)\n return false\n when \"{#{NS_CALDAV}}free-busy-query\"\n @server.transaction_type = 'report-free-busy-query'\n free_busy_query_report(report)\n return false\n end\n end",
"def emp_report\n \n end",
"def report_class()\n raise \"No report_class() function defined by report subclass\"\n end",
"def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end",
"def set_report_subscriber\n @report_subscriber = ReportSubscriber.find(params[:id])\n end",
"def set_report\n @report = Report.friendly.find(params[:id])\n end",
"def report_moab_jobs\n self.report('moab_jobs_report')\n end"
] |
[
"0.70696",
"0.70696",
"0.70696",
"0.70696",
"0.70696",
"0.7007387",
"0.6845081",
"0.6829718",
"0.6791534",
"0.6791534",
"0.6791534",
"0.6751425",
"0.6751425",
"0.6751425",
"0.6751425",
"0.6751425",
"0.6536971",
"0.6527513",
"0.6499747",
"0.6464912",
"0.63922167",
"0.63874775",
"0.63874775",
"0.63377225",
"0.63377225",
"0.6304932",
"0.6210243",
"0.62100494",
"0.62100494",
"0.6206546",
"0.6185004",
"0.6162324",
"0.61432415",
"0.6142875",
"0.6086957",
"0.60789865",
"0.6055225",
"0.604986",
"0.600933",
"0.5991956",
"0.5991064",
"0.5975848",
"0.5974647",
"0.5964178",
"0.59519666",
"0.5931697",
"0.5931697",
"0.59186804",
"0.590688",
"0.59054875",
"0.5904322",
"0.59008497",
"0.58848953",
"0.58181405",
"0.580977",
"0.5798007",
"0.5798007",
"0.5796476",
"0.57902235",
"0.57882345",
"0.5784977",
"0.5784332",
"0.5774316",
"0.5772795",
"0.5770755",
"0.5757099",
"0.57411486",
"0.57256913",
"0.5722041",
"0.5720804",
"0.5720584",
"0.572035",
"0.57192636",
"0.57127553",
"0.57111084",
"0.5708838",
"0.5699801",
"0.56937635",
"0.5679657",
"0.56755525",
"0.5672786",
"0.5672786",
"0.5672786",
"0.5672496",
"0.5672384",
"0.56646574",
"0.5663024",
"0.5658548",
"0.5657619",
"0.5650364",
"0.56414294",
"0.56322",
"0.56303316",
"0.56283605",
"0.5619596",
"0.56176114",
"0.56098837",
"0.5598126",
"0.5593947",
"0.55936533"
] |
0.6133842
|
34
|
required params: page, receiver
|
def create_page
@user = @receiver
@notification = @user.notifications.find_by(link: "/pages/#{@page.id}")
subject = "[FBC] #{@page.user.login_name}さんがDocsに#{@page.title}を投稿しました。"
mail to: @user.email, subject: subject
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page\n\n end",
"def associate_page(page); end",
"def page; self end",
"def call(context, page)\n raise NotImplementedError\n end",
"def page\n get_page\n nil\n end",
"def pages\n end",
"def page\n obj\n end",
"def page_params\n end",
"def pages; end",
"def selected_page\n end",
"def register_page(args)\n # Implement me....\n end",
"def after_fetch response, page\n end",
"def set_page\n end",
"def send_page\n send_message(\"page\")\n end",
"def visit_page(page_class, params={:using_params => {}}, &block)\n on_page page_class, params, true, &block\n end",
"def page(message, url)\n recipients message.recipients\n from ADMIN_EMAIL\n subject message.subject\n body :message => message, :url => url\n end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def post_process(pages)\n end",
"def page\n nil\n end",
"def sub_navigate\n page(FeedDetailsPage).touch_row\n page(MorePage).page_handler(\"Submission\")\n end",
"def pages=(_arg0); end",
"def next_page; end",
"def send_pages\n Msg.resolve(recipient).each do |user|\n next if !user.sms_validated?\n p = Page.new_page_to_user(self, user)\n end\n self\n end",
"def action(page)\n\t\t\traise ArgumentError,'page must be an instance of Consumer::Page' unless page.is_a? Page\n\t\t\t#global\n\t\t\t@task['.'].call(page) if @task['.'] && @task['.'].is_a?(Proc)\n\t\t\t#for specify host\n\t\t\thost=page.uri.ip\n\t\t\tpath=page.uri.path\n\t\t\tif @task[host]\n\t\t\t\t@task[host].each do |key,|\n\t\t\t\t\tif path==key or path.start_with?(key+'/')\n\t\t\t\t\t\t$logger.info(\"[Consumer] Consuming #{page.uri.to_s} (#{page.title[0..15]+'...'})\\n\")\n\t\t\t\t\t\t@task[host][key].call(page) if @task[host][key].is_a?(Proc)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def next_page\n end",
"def pa_request(*args)\n bp_request\n @page_number = convert_expression(@page_number, args, \"page number\") - 1 # Becaue it will be incremented\n end",
"def get_page(page = 1)\n add_actions \"GoToPage(#{page})\"\n end",
"def on(page, &block)\n yield page\n end",
"def on(page, & block)\n yield page\n end",
"def sample_page\n\n end",
"def search_success\n page(SubmissionPage).create_post(\"search query\")\n page(FeedDetailsPage).view_search(\"Microsoft\")\n page(FeedDetailsPage).touch_rec\n page(FeedDetailsPage).view_search(\"Microsoft\")\nend",
"def assign_pages!; end",
"def page_load; end",
"def request_for_page page, pageinfo=nil\n (page.to_i > 1) ? self.class.new(identifier, page) : self\n end",
"def mission(page)\n\tend",
"def selected_page=(page)\n end",
"def page\n if request.post?\n # create full URL from provided details\n @bulletin = @project.bulletins.find_by_name(params[:bulletin_name])\n if (@bulletin)\n forward_url = BcomposerLinkHelper.url_for(:page, :bulletin => @bulletin, :page => params[:page_name])\n email = @project.templets.find_by_name('EMAIL_FORWARD_PAGE')\n Notifier::deliver_message(email, :recipient => @recipient, :forward_url => forward_url, :comment => params[:comment])\n \n render :text => @project.templets.find_by_name('PAGE_FORWARD_PAGE_OK').render( @project, params ), :layout => true\n return\n end\n end\n render :text => @project.templets.find_by_name('PAGE_FORWARD_PAGE').render( @project, params ), :layout => true\n end",
"def page(page)\n params['page'] = page\n end",
"def update_page(page)\n case page\n when 'previous'\n @bundle = previous_bundle\n when 'next'\n @bundle = next_bundle\n end\n end",
"def page(key)\n end",
"def page_revisions\n self.back_to_top\n page_revisions_button\n wait_for_ajax\n \n end",
"def page\n self.class.page\n end",
"def create_page\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/pages/#{@page.id}\")\n subject = \"[bootcamp] #{@page.user.login_name}さんがDocsに#{@page.title}を投稿しました。\"\n mail to: @user.email, subject: subject\n end",
"def parse_page(msg, offset = 0, reset = false, components = nil)\n page = nil\n components.to_a.each{ |row|\n row.each{ |component|\n page = component.label.to_s[/\\d+/i].to_i if component.custom_id.to_s == 'button:nav:page'\n }\n }\n reset ? 1 : (page || msg[/page:?[\\s\\*]*(\\d+)/i, 1] || 1).to_i + offset.to_i\nrescue\n 1\nend",
"def record_page(page)\n\t\t\t\turl = page.uri.to_s\n\t\t\t\trecord(url, content: page.content)\n\t\t\tend",
"def more_navigate\n page(FeedDetailsPage).await\n page(FooterTabBarPage).select_tab(\"More\")\n page(MorePage).seemenu\nend",
"def request_for_page page, info=nil\n req = TwitterSearchRequest.new(obj[:key], page)\n req.url << \"&rpp=#{req.max_items}\"\n req.url << \"&max_id=#{sess_span.min - 1}\" if sess_span.min\n req\n end",
"def add_to_history(page); end",
"def initialize(page)\n @page = page\n end",
"def to_page\n \n u = User.find_by_login(authorid)\n \n UserActionObserver.current_user = u\n \n page = Page.new(\n :title => title,\n :created_at => lastmod,\n :updated_at => lastmod,\n :slug => url_title,\n :status => Status[:published],\n :breadcrumb => title,\n :published_at => posted, \n :enable_comments => annotate.to_s,\n :keywords => keywords,\n :created_by => u,\n :updated_by => u\n )\n \n page.parts << PagePart.new(:name => 'body', :filter_id => \"Textile\", :content => body )\n page.parts << PagePart.new(:name => 'intro', :filter_id => \"Textile\", :content => body.split(/\\r\\n\\s*\\r\\n/).first)\n \n page\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def page!\n save_and_open_page\n end",
"def page!\n save_and_open_page\n end",
"def turnPage\n @playdate.page_num = params[:new_page_num]\n @playdate.save\n Pusher[@playdate.pusher_channel_name].trigger('turn_page', {\n :player => current_user.id,\n :page => params[:new_page_num]\n })\n end",
"def get_page_presenter(action, type=nil)\n\n\n\n\n\n\n\n if action.to_s == \"index\" && type && page_presenters[:index].kind_of?(Hash)\n\n\n\n page_presenters[:index][type.to_sym]\n\n\n\n elsif action.to_s == \"index\" && page_presenters[:index].kind_of?(Hash)\n\n\n\n page_presenters[:index].default\n\n\n\n else\n\n\n\n page_presenters[action.to_sym]\n\n\n\n end\n\n\n\n\n\n\n\n end",
"def receive(action: nil, method: nil, media_type: nil, page_size: nil, store_media: nil, **keyword_args)\n append(Receive.new(action: action, method: method, media_type: media_type, page_size: page_size, store_media: store_media, **keyword_args))\n end",
"def each_page(&block); end",
"def get_page\n case page = params[:page].to_i\n when 0; 1\n when (1..POST_PAGES); page\n else POST_PAGES\n end\n end",
"def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend",
"def page(page_name, &block)\n method_name = page_name.computerize + '_page'\n send method_name, &block\n end",
"def change_page(p)\n self.page = p\n self\n end",
"def page\n Integer(parsed_body['Meta']['Parameters']['page'] || 1)\n end",
"def ajax_get_new_page\n case params[ :type ] \n when \"following\" , \"followers\" \n data = User.fetch_follow( params[ :id ] , current_user , params[ :type ], params[ :page ] ) [ \"data\" ]\n @user_list = data[ \"users\" ] \n @user_agree = data[ \"pending\" ] \n when \"commentlike\" , \"story\"\n query = {\n \"activity_ids[before]\" => params[ :activity ] ,\n \"comment_ids[before]\" => params[ :comment ] ,\n \"like_ids[before]\" => params[ :like ] \n }\n if params[ :type ] == \"story\" \n data = User.fetch_moments( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"moments\" ]\n @user = User.fetch( params[ :id ] , current_user , nil ) [ \"data\" ]\n else \n data = User.fetch_commentlike( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"likes_and_comments\" ]\n end\n @qparams = data[ \"next_query_parameters\" ] \n @qparams[ \"activity_ids\" ] = { \"before\" => params[ :activity ] } if @qparams[ \"activity_ids\" ] .nil?\n @qparams[ \"comment_ids\" ] = { \"before\" => params[ :comment ] } if @qparams[ \"comment_ids\" ] .nil?\n @qparams[ \"like_ids\" ] = { \"before\" => params[ :like ] } if @qparams[ \"like_ids\" ] .nil?\n end\n render :layout => false\n end",
"def page\n @page ||= retrieve_page\n end",
"def page\n @page ||= retrieve_page\n end",
"def find_page_end\n \n end",
"def show\n\n call_back\n \n if params[:path] == \"payments\" # only for payments notification\n \n Payment.create!(:params => params, :cart_id => params[:invoice], :status => params[:payment_status], :transaction_id => params[:txn_id])\n render :nothing => true\n \n elsif # find child page and redirect\n @page = Page.find(\"#{params[:path]}/#{params[:id]}\".split('/').last)\n \n if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?\n redirect_to first_live_child.url and return\n elsif @page.link_url.present?\n redirect_to @page.link_url and return\n end\n else\n error_404\n end\n end\n \n end",
"def set_page\n @page = Page.published.friendly.find(params[:id])\n @sections = @page.sections.published.sorted\n @subpages = @page.subpages.published.sorted\n end",
"def page\n @context.registers[:page]\n end",
"def visited_page(url); end",
"def visited_page(url); end",
"def set_page\n @page = Page.where(:request_id => params[:request_id]).first\n end",
"def scrapePage\n # expects to be passed in a Watir:Browser object\n # gets the header from the current browser page and records it, the page url and the next page's url to the array\n pageDoc = getPage\n nextPageUrl = getFirstLinkUrl(pageDoc)\n pageEntry = getPageRecord(pageDoc, nextPageUrl)\n recordEntry(pageEntry)\n\n LOGGER.debug(\"Information scraped from: #{pageEntry[:url]}\")\n end",
"def get_page\n render_page_sections_json\n end",
"def previous_page; end",
"def page=(page)\n return if @page == page\n @page = page\n @available_renderers = available_renderers.map_value do |key, (value, render_options)|\n new_render = value.class.new(page)\n disconnect(value, SIGNAL('updated()'))\n connect(new_render, SIGNAL('updated()'), self, SIGNAL('updated()'))\n [new_render, render_options]\n end\n end",
"def page\r\n @page || 1\r\n end",
"def do_page_blocks(page)\n @on_every_page_blocks.each do |block| \n instance_eval(block).call(page)\n end\n\n @on_pages_like_blocks.each do |pattern, blocks|\n blocks.each { |block| instance_eval(block).call(page) } if page.url.to_s =~ /#{pattern}/\n end\n end",
"def visit_page\n visit page_path('contact')\n self\n end",
"def after_pagination\n end",
"def page_object\n @page\n end",
"def page_object\n @page\n end",
"def page\r\n return @cache[:page] unless @cache[:page].nil?\r\n\r\n @cache[:page] = @agent.try(:page)\r\n end",
"def expect_page(page_arg)\n p = page\n\n if p\n if p.class.name == page_arg.class.name # Do this if it looks like an instance of a page.\n return p\n elsif p.class == page_arg # Do this if it looks like a page class name.\n return p\n elsif page_arg.is_a?(Symbol) && p.class.name.underscore.to_sym == page_arg\n return p\n else\n raise SiteObject::WrongPageError, \"Expected #{page_arg} page to be displayed but the URL doesn't look right. \\n\\n#{caller.join(\"\\n\")}\"\n end\n else\n raise SiteObject::WrongPageError, \"Expected #{page_arg} page to be displayed but the URL doesn't appear to match the URL template of any known page. \\n\\n#{caller.join(\"\\n\")}\"\n end\n end",
"def to_page\n page\n end",
"def page_param\n if params[:page].is_a? ActionController::Parameters\n params[:page][:number]\n else\n params[:page]\n end\n end"
] |
[
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.6654932",
"0.65445954",
"0.64180005",
"0.6279172",
"0.6262774",
"0.62622637",
"0.61906886",
"0.61666644",
"0.61596036",
"0.6157299",
"0.6099534",
"0.6073334",
"0.60684717",
"0.60614926",
"0.6057998",
"0.6055614",
"0.6042687",
"0.6042687",
"0.6042687",
"0.59735906",
"0.59288234",
"0.5912954",
"0.58676016",
"0.5867264",
"0.5857574",
"0.5844268",
"0.5820936",
"0.5816742",
"0.5790499",
"0.5756233",
"0.57382846",
"0.5734586",
"0.5733727",
"0.57011026",
"0.5700571",
"0.5682142",
"0.5679283",
"0.5657392",
"0.56565106",
"0.56258094",
"0.5623581",
"0.5614556",
"0.56113815",
"0.56029",
"0.55948716",
"0.5586074",
"0.5574197",
"0.5547578",
"0.5541882",
"0.55387825",
"0.5518711",
"0.55134046",
"0.5509991",
"0.5504529",
"0.5504529",
"0.550145",
"0.5497862",
"0.54821146",
"0.54778904",
"0.5474088",
"0.547139",
"0.54647845",
"0.5462912",
"0.5451256",
"0.5448574",
"0.54424405",
"0.54424405",
"0.54375005",
"0.5427824",
"0.5419851",
"0.5415182",
"0.54146475",
"0.54146475",
"0.5408093",
"0.5401491",
"0.5399308",
"0.5399066",
"0.53963155",
"0.5384511",
"0.5383043",
"0.5381572",
"0.5379615",
"0.53668576",
"0.53668576",
"0.5364653",
"0.5353932",
"0.53478074",
"0.5345716"
] |
0.5832806
|
38
|
the array of belongs to objects
|
def allergens_ingredients
Allergen.all.select {|allergen| allergen.ingredient == self}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def associations; end",
"def belongs_to_relations(ar_instance)\n\t\t\tcolumns = ar_instance.class.column_names\n\t\t\tparents = columns.map{ |c| c if c =~ /_id/ }.reject{ |c| c.nil? }\n\t\t\tparents.map!{ |parents| parents.gsub('_id', '') }\n\t\tend",
"def related_objects\n related_objects = Array.new\n\n\t\tself.meta_data_group_assignments.uniq.each do |assignment|\n\t\t\tobject_type = assignment.meta_data_group_assignable_type\n\t\t\tobject_id = assignment.meta_data_group_assignable_id\n\n\t\t\trelated_object = eval(object_type+'.find('+object_id.to_s+')')\n\t\t\trelated_objects.push(related_object)\n\t\tend\n\n\t\tputs related_objects.inspect\n\n return related_objects\n end",
"def associations\r\n [nil, joins]\r\n end",
"def associations_array\n resource.reflect_on_all_associations.map { |association| association.name.to_s }\n end",
"def owners\n self.car.map do |car| car.owner.uniq\nend\n\n\n\nend",
"def instances_relating_to(obj)\n relationships.map {|relationship_defn|\n relationship_defn.who_participates_with(obj)\n }.flatten\n end",
"def relations; enum_relations.to_a end",
"def iteration_associations\n [].freeze\n end",
"def associated_object_keys\n self[:keys]\n end",
"def relations\n _relations\n end",
"def relations\n _relations\n end",
"def associated_acts\n if self.type == \"Person\"\n arr = Array.new\n artist_relations = get_relations(self.relations, \"artist\")\n artist_relations.each do |relation|\n if relation[\"type\"] == \"member of band\"\n arr << relation\n end\n end\n return arr\n else\n return nil\n end\n end",
"def associated_records\n []\n end",
"def associations\n data[:associations]\n end",
"def model_relationships; end",
"def related_models\n via_assay = assays.collect(&:models).flatten.uniq.compact\n via_assay | models\n end",
"def active_record_has_and_belongs_to_many(model, relation)\n return [] unless relation.macro == :has_and_belongs_to_many\n\n dump_proxy_table(model, relation)\n end",
"def __belongs_to__\n\t\treturn_string = []\n\t\tself.class.reflect_on_all_associations(:belongs_to).each do |association| \n\t\t\tmodel = self.send(association.name)\n\t\t\tif model\n\t\t\t\treturn_string.push model.reference_attribute \n\t\t\tend\n\t\tend\n\t\treturn_string.join \" \"\n\tend",
"def relationships\n @relationships ||= {}\n end",
"def getAssociatedObjects\n Item_objects = ObjectSpace.each_object(Item).to_a\n puts Item_objects\n item_ordered = Array.new\n Item_objects.each do |x| \n # if arr[x].order_id == @order_id\n # item_ordered = arr[x]\n # end\n # item_ordered\n puts Item_objects[x]\n end\n end",
"def associations\n association_ids = model.association_field_ids\n data.select{|k,v| association_ids.include?(k.to_s) }\n end",
"def associations\n @associations.dup\n end",
"def related_to(*args)\n@relations = args.map(&:to_s)\nend",
"def associations\n @_associations.dup\n end",
"def related_reviewed_objects arr\n raise NotImplementedError.new('Define method :related_reviewed_objects on your source control.')\n end",
"def relations\n self.class.relations\n end",
"def attributions_objects\n self.parent.attributions.collect { |a| a.other_object }\n end",
"def path_ids\n @objects.map{|e| e.path_id}\n end",
"def targets\n\t\tKassociation.where( :target_id => self.id )\n\tend",
"def associations\n association_reflections.keys\n end",
"def find_belongs_to\n\t\tclasses.reduce([]) { |s,p| s + p[1].find_belongs_to(self) }\n\tend",
"def relationships\n model.relationships(repository.name)\n end",
"def relationships_for(model) # @private :nodoc:\n relationships_mapping[model] or []\n end",
"def associations\n @associations ||= {}\n end",
"def scaf_belongs_tos\n scaf_assocs.select { |a|\n [:belongs_to].include?( a.macro )\n }\n end",
"def hm_associations\n hm = []\n associations = self.reflect_on_all_associations\n associations.map {|x| hm << x.name if x.macro.to_s == \"has_many\"}\n return hm.flatten\n end",
"def owners\n self.cars.map{|car_instance| car_instance.owner}.uniq\n end",
"def owners_of_cars_serviced\n self.personal_mechanic_of.map{|owner_obj| owner_obj.name}\nend",
"def trail_users_id_array\n # trail = Trail.find(:id)\n self.users.map do |x| \n x.id \n end \n end",
"def likers \n self.likes.map {|like| like.user_id}\n end",
"def has_associations\n assocs.each_rel.to_a\n end",
"def relations\n @relations ||= {}\n end",
"def my_clients\n self.client_cars.map do |car|\n car.owner\n end\n end",
"def objects\n @objects ||= population_group_members.collect(&:objects).flatten.uniq\n end",
"def foreign_keys\n vals = []\n foreign_key_fields.each do |field|\n vals << self.send(field)\n end\n vals\n end",
"def containing_relation_members \n return [] \n end",
"def associations\n @associations ||= {}.with_indifferent_access\n end",
"def persons\n Gallerist::Person.where modelId: person_photos.map(&:person_id)\n end",
"def persons\n Gallerist::Person.where modelId: person_photos.map(&:person_id)\n end",
"def child_object_ids(valkyrie: false)\n child_objects(valkyrie: valkyrie).map(&:id)\n end",
"def eager_graph_build_associations(rows)\n objects = super\n\n if eager_data = @opts[:eager_graph_eager]\n eager_data.each do |deps, assocs|\n current = objects\n\n last_class, *deps = deps\n deps.each do |dep, is_multiple|\n current_assocs = current.map(&:associations)\n\n if is_multiple\n current = current_assocs.flat_map{|a| a[dep]}\n else\n current = current_assocs.map{|a| a[dep]}\n current.compact!\n end\n\n current.uniq!(&:object_id)\n end\n\n last_class.dataset.send(:eager_load, current, assocs)\n end\n end\n\n objects\n end",
"def target_objects\n return @target_objects\n end",
"def target_objects\n return @target_objects\n end",
"def arrangers\n find_related_frbr_objects( :is_arranged_by, :which_roles?) \n end",
"def car_owners\n car_owners_arr = Car.all.select do |car_ob|\n #binding.pry\n car_ob.mechanic == self\n end\n car_owners_arr.map do |car_ob|\n car_ob.owner\n end\nend",
"def relationship_data\n data = @objects.try(:map) { |o| o.try(:relationship_data) }\n data.try(:compact!) || data\n end",
"def pseud_associations(pseuds)\n puts \" collecting pseud associations\"\n x = []\n pseuds.each do |p|\n print \".\"; STDOUT.flush\n x << p\n x << p.user\n x << p.user.preference\n end\n x\nend",
"def array\n self.allObjects\n end",
"def users\n @circle.keySet.to_a\n end",
"def sources\n\t\tKassociation.where( :source_id => self.id )\n\tend",
"def self_and_descendants_from_active_record\n [self]\n end",
"def containing_relation_members\n []\n end",
"def self_and_descendants_from_active_record\n [self]\n end",
"def exposed_associations\n []\n end",
"def exposed_associations\n []\n end",
"def exposed_associations\n []\n end",
"def exposed_associations\n []\n end",
"def parent_objects\n return [] if parents.empty?\n return @parent_objects if @parent_objects\n\n first = parent_models[0].find(parent_params[0])\n @parent_objects = [first]\n parent_params.zip(parents)[1..-1].inject(first) do |memo, arr|\n id, name = arr\n @parent_objects << memo.send(name.pluralize).find(id)\n end\n @parent_objects\n end",
"def linked_associations\n associations.values.select(&:linked?)\n end",
"def object_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty?\n return object_taxon_name_id if !object_taxon_name_id.empty?\n return []\n end",
"def authorizable_ransackable_associations\n reflect_on_all_associations.map { |a| a.name.to_s }\n end",
"def associations\n model.relationships.to_a.collect { |name,rel|\n {\n :name => name.to_s,\n :type => association_type_lookup( rel ), # :has_many, :has_one, or :belongs_to\n :parent_model => rel.parent_model,\n :parent_key => rel.parent_key.collect { |p| p.name },\n :child_model => rel.child_model,\n :child_key => rel.child_key.collect { |p| p.name },\n :remote_rel => rel.options[:remote_relationship_name],\n :near_rel => rel.options[:near_relationship_name]\n }\n }\n end",
"def to_ids\n @to_ids ||= [ reference.id ] + to_similarity_ids\n end",
"def to_a\n ret = [self]\n if self.kids\n self.kids.each do |kid|\n kid.to_a.each {|node|\n ret.push node\n }\n end\n end\n ret\n end",
"def references\n @parents.keys\n end",
"def belong_tables(model)\n model.reflect_on_all_associations(:belongs_to).map do |belong|\n belong.name.to_s.pluralize\n end.sort\n end",
"def attr_associations\n @attr_associations\n end",
"def objects\n @object_permission_map.keys\n end",
"def relationships\n return [] if empty?\n\n map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, \"../#{pivot_table.pn}\") }\n end",
"def jsonapi_relationships\n\t\t\t\t\tjsonapi_model_class.reflect_on_all_associations.collect do |association|\n\t\t\t\t\t\t#type = nil\n\n\t\t\t\t\t\ttype = :to_one if [\n\t\t\t\t\t\t\tActiveRecord::Reflection::HasOneReflection, \n\t\t\t\t\t\t\tActiveRecord::Reflection::BelongsToReflection\n\t\t\t\t\t\t].include? association.class\n\n\t\t\t\t\t\ttype = :to_many if [\n\t\t\t\t\t\t\tActiveRecord::Reflection::HasManyReflection, \n\t\t\t\t\t\t\tActiveRecord::Reflection::HasAndBelongsToManyReflection\n\t\t\t\t\t\t].include? association.class\n\n\t\t\t\t\t\tnext unless type\n\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: association.name,\n\t\t\t\t\t\t\ttype: type,\n\t\t\t\t\t\t\treceiver: {\n\t\t\t\t\t\t\t\ttype: association.klass.to_s.underscore.pluralize.to_sym,\n\t\t\t\t\t\t\t\tclass: association.klass.to_s.constantize\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tend.compact\n\t\t\t\tend",
"def data_objects\n self.locations.map{|loc| loc.data_objects}.flatten.uniq.compact\n end",
"def to_ary\n [ self ]\n end",
"def self_and_descendents_from_active_record\n [self]\n end",
"def participant_ids\n self.report_participant_relationships.collect { |r| r.participant_id }.uniq\n end",
"def to_a\n [ self ]\n end",
"def owners\n @obj['owners']\n end",
"def to_a\r\n @objs.dup\r\n end",
"def related_organisms\n organisms = assays.collect(&:organisms).flatten\n organisms |= models.collect(&:organism).flatten\n organisms.uniq.compact\n end",
"def my_followers_mottos \n BloodOath.all.map{|bloodoath|bloodoath.follower.life_motto}\n end",
"def as_selectable_array\n all.inject([]) { |h,t| h << [t.name, t.key] }\n end",
"def parents\n references\n end",
"def objects\n [@player] + @map.objects\n end",
"def to_a\n [self]\n end",
"def _referenced_object_ids\n @data.each.select do |v|\n v&.respond_to?(:is_poxreference?)\n end.map(&:id)\n end",
"def entity_objects\n ProjectMedia.where(id: self.entities).to_a\n end",
"def my_questions\n self.questions.map(&:id)\n end",
"def relationships\n @relationships.each do |k, v|\n if v.respond_to?(:uniq!)\n v.uniq!\n @relationships[k] = v.first if v.length == 1\n end\n end\n @relationships\n end",
"def as_json\n attrs = super\n self.class.associations.each do |name, info|\n attrs[name] = []\n \n arr = send(name)\n next if arr.nil?\n \n arr.each do |object|\n attrs[name].push(object.as_json) unless object.nil?\n end\n end\n attrs\n end",
"def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end",
"def referenced_objects\n return @referenced_objects\n end"
] |
[
"0.68250304",
"0.6669817",
"0.6374036",
"0.62789476",
"0.6277494",
"0.6233238",
"0.62074",
"0.6190507",
"0.61620516",
"0.6148181",
"0.6104842",
"0.6104842",
"0.60979056",
"0.6097364",
"0.6094322",
"0.60826516",
"0.6065605",
"0.6056623",
"0.60421115",
"0.6033996",
"0.60241854",
"0.60048294",
"0.5998336",
"0.59771395",
"0.5963213",
"0.59522575",
"0.5947561",
"0.59435004",
"0.59315354",
"0.59157956",
"0.58858",
"0.58689713",
"0.5849331",
"0.58473366",
"0.5845144",
"0.5844663",
"0.58335835",
"0.5825299",
"0.5815663",
"0.5798141",
"0.5792638",
"0.57868147",
"0.57774097",
"0.5769712",
"0.5766114",
"0.5765322",
"0.57642245",
"0.5760595",
"0.57596576",
"0.57596576",
"0.5750725",
"0.5749458",
"0.57394755",
"0.57394755",
"0.5727418",
"0.57093674",
"0.57070774",
"0.5702244",
"0.5700869",
"0.5699599",
"0.5694477",
"0.56943536",
"0.56888705",
"0.5663956",
"0.5653804",
"0.5653804",
"0.5653804",
"0.5653804",
"0.5651105",
"0.56494427",
"0.5648677",
"0.56443584",
"0.5642265",
"0.56386626",
"0.5625301",
"0.5624689",
"0.5620722",
"0.5620633",
"0.56197274",
"0.561219",
"0.56069005",
"0.5603886",
"0.5585897",
"0.5574137",
"0.5569864",
"0.5568514",
"0.55651194",
"0.55641437",
"0.5561747",
"0.5557674",
"0.5555129",
"0.5549925",
"0.5543324",
"0.5542705",
"0.5542175",
"0.55420434",
"0.5540927",
"0.55401605",
"0.5538153",
"0.5529582",
"0.5528192"
] |
0.0
|
-1
|
Set topic exchange_name and binding_keys this worker is bound to.
|
def pre_initialize(**opts)
@topic_name = opts[:topic_name]
@binding_keys = Array(opts[:binding_keys])
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bind_queue_to_exchange_routing_keys\n binding_keys.each do |key|\n queue.bind(exchange, routing_key: key)\n end\n end",
"def bind(exchange, binding_key, arguments: {})\n @client.exchange_bind(@name, exchange, binding_key, arguments: arguments)\n self\n end",
"def bind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_bind(queue, exchange, binding_key, arguments: arguments)\n end\n end",
"def post_initialize(**opts)\n bind_queue_to_exchange_routing_keys\n super\n end",
"def register_binding(queue_name, options={})\n name = queue_name.to_s\n opts = options.symbolize_keys\n exchange = (opts[:exchange] || name).to_s\n key = (opts[:key] || name).to_s\n (bindings[name] ||= []) << {:exchange => exchange, :key => key}\n register_exchange(exchange) unless exchanges.include?(exchange)\n queues = exchanges[exchange][:queues]\n queues << name unless queues.include?(name)\n end",
"def bind(exchange, opts = {})\n if exchange.respond_to?(:add_route)\n\n # we can do the binding ourselves\n exchange.add_route opts.fetch(:routing_key, @name), self\n else\n\n # we need the channel to look up the exchange\n @channel.xchg_bind self, opts.fetch(:routing_key, @name), exchange\n end\n\n self\n end",
"def bind_queue_to_exchange\n queue.bind(exchange)\n end",
"def bind(exchange, opts = {}, &block)\n @channel.once_open do\n self.once_name_is_available do\n queue_bind(exchange, (opts[:key] || opts[:routing_key] || AMQ::Protocol::EMPTY_STRING), (opts[:nowait] || block.nil?), opts[:arguments], &block)\n end\n end\n\n self\n end",
"def bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n\n # TODO: handle channel & connection-level exceptions\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n self\n end",
"def bind(key,obj,*args)\n\t\t@bindings[key] = [obj,*args]\n\tend",
"def queue_bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(AMQ::Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n # store bindings for automatic recovery, but BE VERY CAREFUL to\n # not cause an infinite rebinding loop here when we recover. MK.\n binding = { :exchange => exchange_name, :routing_key => routing_key, :arguments => arguments }\n @bindings.push(binding) unless @bindings.include?(binding)\n\n self\n end",
"def bind(receiver)\n unbind if bound?\n \n @receiver = receiver\n configs.each_pair do |key, config|\n value = store.has_key?(key) ? store.delete(key) : config.default\n config.set(receiver, value)\n end\n \n self\n end",
"def queue_bind(name, exchange, binding_key, arguments: {})\n write_bytes FrameBytes.queue_bind(@id, name, exchange, binding_key, false, arguments)\n expect :queue_bind_ok\n nil\n end",
"def activate!(keys: [])\n establish_bindings!\n keys.each { |key| add_routing_key(key) }\n end",
"def bind(key, value)\n STDERR.puts \"Assigning #{value} to #{key}\" if ENV['BRINE_LOG_BINDING']\n binding[key] = value\n end",
"def bind(key, value)\n STDERR.puts \"Assigning #{value} to #{key}\" if ENV['BRINE_LOG_BINDING']\n binding[key] = value\n end",
"def bind(key, value = nil)\n if key.kind_of?(Hash)\n @bindings << key\n else\n @bindings[key] = value\n end\n self\n end",
"def binding!\n @binding = true\n end",
"def bind_exchange(exchange_name, async_api_subscribe_operation)\n operation_bindings =\n async_api_subscribe_operation.bindings.amqp.symbolize_keys || {}\n channel_proxy.bind_queue(\n @subject.name,\n exchange_name,\n { routing_key: operation_bindings[:routing_key] }\n )\n logger.info \"Queue #{@subject.name} bound to exchange #{exchange_name}\"\n rescue Bunny::NotFound => e\n raise EventSource::Protocols::Amqp::Error::ExchangeNotFoundError,\n \"exchange #{name} not found. got exception #{e}\"\n end",
"def []=(key, value)\n @binding.send(key.to_s + \"=\", value)\n end",
"def set_bind( bind )\n if Option.bind_ok?( bind )\n @bind = bind\n else\n raise \"invalid bind variable name: #{ bind.to_s }\"\n end\n end",
"def bind=(value)\n conf['api']['bind'] = value\n end",
"def update_broker\n @lock.synchronize do\n tuple_spaces = @tuple_space.values.map {|holder| holder[:tuple_space]}\n @model.update_tuple_spaces(tuple_spaces)\n end\n end",
"def post_initialize(**opts)\n bind_queue_to_exchange\n super\n end",
"def []=(key, val)\n Thread.current[:_alter_binding_local_] = val\n eval(\"#{key} = Thread.current[:_alter_binding_local_]\")\n Thread.current[:_alter_binding_local_] = nil\n end",
"def enable_topics(jndi_names = {})\n configuration.enabled_topics = jndi_names\n end",
"def bind(arg_name, klass)\n @bindings[arg_name] = klass\n end",
"def binding(*args, &block)\n method_missing(:binding, *args, &block)\n end",
"def _binding() binding end",
"def _binding() binding end",
"def get_binding(keyset)\n environment = $environment\n myPublicIp = $myPublicIp\n myRoot = $myRoot\n myAZ = $myAZ\n myRegion = $myRegion\n myAppName = $myAppName\n credentials = @default_credentials ? @default_credentials : \"default\"\n\n# return MU::Config.global_bindings[keyset] if MU::Config.global_bindings[keyset]\n MU::Config.global_bindings[keyset] = binding\n MU::Config.global_bindings[keyset]\n end",
"def setup\n topics.map do |t|\n topic_name = t[:name] || t['name']\n sub_opts = t.reject { |k, _| k.to_sym == :name }\n PubSubClient.upsert_subscription(topic_name, subscription_name(topic_name), sub_opts)\n end\n end",
"def enable_queues(jndi_names = {})\n configuration.enabled_queues = jndi_names\n end",
"def bind\n binding\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def exchange_bind(destination, source, binding_key, arguments: {})\n write_bytes FrameBytes.exchange_bind(@id, destination, source, binding_key, false, arguments)\n expect :exchange_bind_ok\n nil\n end",
"def setup(&block)\n @_topic = self.instance_eval(&block)\n end",
"def bind(*args)\n raise \"Need at least callback_name\" if args.length < 1\n func_name = args[0]\n func_args = args[1..-1] || []\n {\n \"type\" => \"binding\",\n \"callback_name\" => Lang.func_name_to_callback(func_name),\n \"callback_args\" => func_args,\n \"cancel\" => nil,\n }\n end",
"def bind_queue(name, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n\n options = {\n durable: true,\n auto_delete: false,\n }.merge(options)\n\n @channel.queue(name, options)\n .bind(@exchange, routing_key: name)\n end",
"def bind(hash)\n out = binder.new\n hash.each do |k,v|\n out.send \"#{k}=\", v\n end\n out\n end",
"def bind(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"bind \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def bind_exchange_to_exchange(channel, exchange_in_name, queue_name, exchange_out_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_current = channel.queue(queue_name)\n queue_current.bind(exchange_source)\n exchange_output = channel.fanout(exchange_out_name)\n return queue_current, exchange_output\nend",
"def binding\n @binding ||= {}\n end",
"def bind_backend(controller_class, topic)\n backend = Kernel.const_get(\"::Karafka::Backends::#{topic.backend.to_s.capitalize}\")\n controller_class.include backend\n end",
"def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end",
"def set(fields)\n @bindings.first.each { |b| b.set fields }\n end",
"def set_old_binding(binding, append)\n state.old_binding = binding\n state.append = append\n end",
"def assign args={}\n args.each do |_name, value|\n public_send(\"#{_name.underscore}=\", value)\n end\n end",
"def kms_key= new_kms_key_name\n update_grpc = Google::Cloud::PubSub::V1::Topic.new name: name, kms_key_name: new_kms_key_name\n @grpc = service.update_topic update_grpc, :kms_key_name\n @resource_name = nil\n end",
"def bind(task)\n @task = task\n end",
"def bind!(bind)\n @bind = bind\n self\n end",
"def setup_queues_and_policies\n publisher.setup_queues_and_policies\n end",
"def bind\n binding\n end",
"def update!(**args)\n @topic_name = args[:topic_name] if args.key?(:topic_name)\n end",
"def update!(**args)\n @topic_name = args[:topic_name] if args.key?(:topic_name)\n end",
"def []=(name, topic)\n @by_name[name] = topic\n end",
"def bind_responders(controller_class, topic)\n return unless topic.responder\n controller_class.include Responders\n end",
"def bind_exchange_to_queue(channel, exchange_in_name, queue_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_output = channel.queue(queue_name) \n queue_output.bind(exchange_source)\n return queue_output\nend",
"def bind behavior\n actor_send :bind, behavior\n end",
"def binding()\n return Binding.setup(\n VariableScope.of_sender,\n CompiledMethod.of_sender,\n StaticScope.of_sender)\n\n end",
"def binding=(mode)\n Thread.current[:\"[mongoid]:binding-mode\"] = mode\n end",
"def set_topic(target, topic)\n adapter.set_topic(target, topic)\n end",
"def define_exchange(name, options = {})\n options = {\n durable: true,\n }.merge(options)\n @exchange = @channel.topic(name, options)\n end",
"def rl_generic_bind(type, keyseq, data, map)\r\n map[keyseq] = data\r\n 0\r\n end",
"def bind_params(controller_class, topic)\n return if topic.batch_consuming\n controller_class.include SingleParams\n end",
"def binding() end",
"def binding() end",
"def setattr(name, value)\n setattribute_raw \"/subsystem=messaging/hornetq-server=default/jms-queue=#{@resource[:name]}\", name, value\n end",
"def binding\n return Binding.setup(\n Rubinius::VariableScope.of_sender,\n Rubinius::CompiledMethod.of_sender,\n Rubinius::StaticScope.of_sender)\n end",
"def assign_globals\n Server.keys = Server.build_keys(@config.namespace, @config.priorities)\n Server.worker = self\n end",
"def []=(key, value)\n @message_impl.setProperty(key.to_s,\n Qpid::Messaging.stringify(value))\n end",
"def display_template_bind(message_key, template_binding = binding)\n self.local_binding = template_binding\n print_margin message(message_key)\n end",
"def bind(option_key, default_value=:__UNDEFINED__, opts={})\n key, v, ignore = _pair(option_key, default_value, opts, false)\n\n # always look for the option key in the bindings passed by the user.\n # if present, this should override whatever we set\n if found = @bindings[option_key.to_sym] || @bindings[option_key.to_s]\n v = found\n ignore = false\n @bindings.delete option_key.to_sym\n @bindings.delete option_key.to_s\n end\n\n # finally, set the binding value.\n unless ignore\n v = v.include?('(') ? v : prepare_for_javascript(v)\n @_properties[\"#{key.camelize(:lower)}Binding\"] = v\n end\n\n end",
"def unbind\n if bound?\n configs.each_pair do |key, config|\n store[key] = config.get(receiver)\n end\n @receiver = nil\n end\n self\n end",
"def exchange_keys; end",
"def exchange_keys; end",
"def set_broker # :doc:\n\t\t\tif @request.broker_id.present?\n\t\t\t\t@broker = User.where(id: @request.broker_id).first\n\t\t\tend\n\t\tend",
"def unbind(exchange, binding_key, arguments: {})\n @client.exchange_unbind(@name, exchange, binding_key, arguments: arguments)\n self\n end",
"def bindings\n @bindings ||= []\n end",
"def set_portname(switchwwn, portwwns, portname)\n result = @ports.set_portname(switchwwn, portwwns, portname)\n result[1]\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def initialize(config = Beetle.config)\n @config = config\n @exchanges = {}\n @queues = {}\n @messages = {}\n @bindings = {}\n @deduplication_store = DeduplicationStore.new(config)\n @queue_properties = QueueProperties.new(config)\n load_brokers_from_config\n register_exchange(config.beetle_policy_exchange_name)\n # make sure dead lettering is false for the policy update queue\n register_queue(\n config.beetle_policy_updates_queue_name,\n :exchange => config.beetle_policy_exchange_name,\n :key => config.beetle_policy_updates_routing_key,\n :dead_lettering => false,\n :lazy => false,\n )\n end",
"def setup_identity_queue\n # Explicitly create direct exchange and bind queue to it\n # since may be binding this queue to multiple exchanges\n queue = @amq.queue(@identity, :durable => true)\n binding = queue.bind(@amq.direct(@identity, :durable => true, :auto_delete => true))\n\n # A RightScale infrastructure agent must also bind to the advertise exchange so that\n # a mapper that comes up after this agent can learn of its existence. The identity\n # queue binds to both the identity and advertise exchanges, therefore the advertise\n # exchange must be durable to match the identity exchange.\n queue.bind(@amq.fanout('advertise', :durable => true)) if @options[:infrastructure]\n\n binding.subscribe(:ack => true) do |info, msg|\n begin\n info.ack\n receive_any(@serializer.load(msg))\n rescue Exception => e\n RightLinkLog.error(\"RECV #{e.message}\")\n @callbacks[:exception].call(e, msg, self) rescue nil if @callbacks && @callbacks[:exception]\n end\n end\n end",
"def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', waiting for messages...\"\n end",
"def bindings\n MU::Cloud::Google::Habitat.bindings(@cloud_id, credentials: @config['credentials'])\n end",
"def binding_params\n params.require(:binding).permit(:name)\n end",
"def update!(**args)\n @binding_set = args[:binding_set] if args.key?(:binding_set)\n @communication_endpoint = args[:communication_endpoint] if args.key?(:communication_endpoint)\n @contact = args[:contact] if args.key?(:contact)\n @features = args[:features] if args.key?(:features)\n @provider = args[:provider] if args.key?(:provider)\n end",
"def bind(id, repo_id, distributor_id, optional = {})\n required = required_params(binding.send(:local_variables), binding, ['id'])\n call(:post, path(\"#{id}/bindings/\"), :payload => { :required => required, :optional => optional })\n end",
"def setup(*_)\n @http_path = args.fetch(:path, '/')\n @http_method = args.fetch(:method, 'get').to_s.downcase.to_sym\n super\n if(message_queues[queue_key])\n raise ArgumentError.new \"Conflicting HTTP path source provided! path: #{http_path} method: #{http_method}\"\n else\n message_queues[queue_key] = Smash.new(\n :queue => Queue.new\n )\n end\n message_queues[queue_key].merge!(\n Smash.new(:config => args.to_smash)\n )\n end",
"def bind\n \n end",
"def display_template_bind(message_key, template_binding = binding)\n self.local_binding = template_binding\n print_margin message(message_key)\n end",
"def bind; binding() end",
"def []=(key, val)\n key = key.to_sym\n raise EnvironmentError, \"#{key} already binded\" if @map.has_key?(key)\n @map[key] = val\n end",
"def prepare_and_assign_method_binding(method_binding, record, data)\n prepare_data(method_binding, data)\n\n assign(method_binding, record)\n end",
"def exchange_naming\n @exchange_naming ||= if @worker_class\n Hightops::Naming::CommonExchange.new\n else\n Hightops::Naming::SharedExchange.new(tag: @tag)\n end\n end",
"def broker_params\n params.require(:broker).permit(:name, :tel, :email)\n end",
"def notify_binding_problem\n end",
"def broker_params\n params.require(:broker).permit(:name, :secure_port, :insecure_port, :ssh_hostname, :ssh_username, :ssh_key, :postgresql_database, :postgresql_username, :postgresql_password)\n end",
"def update!(**args)\n @pubsub_topic_name = args[:pubsub_topic_name] if args.key?(:pubsub_topic_name)\n end"
] |
[
"0.6957795",
"0.6675856",
"0.5977839",
"0.5796765",
"0.57783437",
"0.5705699",
"0.5680375",
"0.5673776",
"0.55384827",
"0.55266863",
"0.55181956",
"0.53939855",
"0.5347486",
"0.53324175",
"0.52546406",
"0.52546406",
"0.52530736",
"0.51774776",
"0.5147119",
"0.5068702",
"0.5067695",
"0.50612146",
"0.504553",
"0.5039207",
"0.50350744",
"0.50249344",
"0.5017986",
"0.4983437",
"0.49480665",
"0.49480665",
"0.49372286",
"0.48952746",
"0.48798403",
"0.48650065",
"0.48461238",
"0.48461238",
"0.48427555",
"0.48343018",
"0.48265857",
"0.48229995",
"0.4819976",
"0.48190022",
"0.4809711",
"0.47749346",
"0.47680157",
"0.4768006",
"0.47565436",
"0.47537583",
"0.47517893",
"0.47413963",
"0.47406545",
"0.4719034",
"0.4692364",
"0.46748835",
"0.4651185",
"0.4651185",
"0.46423417",
"0.46315238",
"0.46207985",
"0.4620406",
"0.46166426",
"0.46112785",
"0.4605552",
"0.46050227",
"0.46014103",
"0.46004996",
"0.4590779",
"0.4590779",
"0.45846894",
"0.45831522",
"0.45714942",
"0.45698234",
"0.45659024",
"0.45621344",
"0.45620194",
"0.45522794",
"0.45522794",
"0.45452383",
"0.45428324",
"0.45331353",
"0.45331073",
"0.45255715",
"0.45124316",
"0.45084432",
"0.45069423",
"0.45045596",
"0.4503798",
"0.44985682",
"0.44812825",
"0.4478329",
"0.44776696",
"0.4467919",
"0.44628042",
"0.44557202",
"0.44538718",
"0.44520077",
"0.44426754",
"0.4442142",
"0.44349307",
"0.4432222"
] |
0.54743814
|
11
|
Bind this worker's queue to the topic exchange and to the given binding_key patterns
|
def post_initialize(**opts)
bind_queue_to_exchange_routing_keys
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bind_queue_to_exchange_routing_keys\n binding_keys.each do |key|\n queue.bind(exchange, routing_key: key)\n end\n end",
"def bind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_bind(queue, exchange, binding_key, arguments: arguments)\n end\n end",
"def queue_bind(name, exchange, binding_key, arguments: {})\n write_bytes FrameBytes.queue_bind(@id, name, exchange, binding_key, false, arguments)\n expect :queue_bind_ok\n nil\n end",
"def bind_queue_to_exchange\n queue.bind(exchange)\n end",
"def register_binding(queue_name, options={})\n name = queue_name.to_s\n opts = options.symbolize_keys\n exchange = (opts[:exchange] || name).to_s\n key = (opts[:key] || name).to_s\n (bindings[name] ||= []) << {:exchange => exchange, :key => key}\n register_exchange(exchange) unless exchanges.include?(exchange)\n queues = exchanges[exchange][:queues]\n queues << name unless queues.include?(name)\n end",
"def queue_bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(AMQ::Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n # store bindings for automatic recovery, but BE VERY CAREFUL to\n # not cause an infinite rebinding loop here when we recover. MK.\n binding = { :exchange => exchange_name, :routing_key => routing_key, :arguments => arguments }\n @bindings.push(binding) unless @bindings.include?(binding)\n\n self\n end",
"def bind(exchange, opts = {}, &block)\n @channel.once_open do\n self.once_name_is_available do\n queue_bind(exchange, (opts[:key] || opts[:routing_key] || AMQ::Protocol::EMPTY_STRING), (opts[:nowait] || block.nil?), opts[:arguments], &block)\n end\n end\n\n self\n end",
"def bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n\n # TODO: handle channel & connection-level exceptions\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n self\n end",
"def bind(exchange, binding_key, arguments: {})\n @client.exchange_bind(@name, exchange, binding_key, arguments: arguments)\n self\n end",
"def bind_exchange(exchange_name, async_api_subscribe_operation)\n operation_bindings =\n async_api_subscribe_operation.bindings.amqp.symbolize_keys || {}\n channel_proxy.bind_queue(\n @subject.name,\n exchange_name,\n { routing_key: operation_bindings[:routing_key] }\n )\n logger.info \"Queue #{@subject.name} bound to exchange #{exchange_name}\"\n rescue Bunny::NotFound => e\n raise EventSource::Protocols::Amqp::Error::ExchangeNotFoundError,\n \"exchange #{name} not found. got exception #{e}\"\n end",
"def bind_queue(name, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n\n options = {\n durable: true,\n auto_delete: false,\n }.merge(options)\n\n @channel.queue(name, options)\n .bind(@exchange, routing_key: name)\n end",
"def bind_exchange_to_queue(channel, exchange_in_name, queue_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_output = channel.queue(queue_name) \n queue_output.bind(exchange_source)\n return queue_output\nend",
"def bind(key,obj,*args)\n\t\t@bindings[key] = [obj,*args]\n\tend",
"def bind(exchange, opts = {})\n if exchange.respond_to?(:add_route)\n\n # we can do the binding ourselves\n exchange.add_route opts.fetch(:routing_key, @name), self\n else\n\n # we need the channel to look up the exchange\n @channel.xchg_bind self, opts.fetch(:routing_key, @name), exchange\n end\n\n self\n end",
"def bind_exchange_to_exchange(channel, exchange_in_name, queue_name, exchange_out_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_current = channel.queue(queue_name)\n queue_current.bind(exchange_source)\n exchange_output = channel.fanout(exchange_out_name)\n return queue_current, exchange_output\nend",
"def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end",
"def exchange_bind(destination, source, binding_key, arguments: {})\n write_bytes FrameBytes.exchange_bind(@id, destination, source, binding_key, false, arguments)\n expect :exchange_bind_ok\n nil\n end",
"def bind_backend(controller_class, topic)\n backend = Kernel.const_get(\"::Karafka::Backends::#{topic.backend.to_s.capitalize}\")\n controller_class.include backend\n end",
"def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', waiting for messages...\"\n end",
"def bind(key, value = nil)\n if key.kind_of?(Hash)\n @bindings << key\n else\n @bindings[key] = value\n end\n self\n end",
"def activate!(keys: [])\n establish_bindings!\n keys.each { |key| add_routing_key(key) }\n end",
"def bind(key, value)\n STDERR.puts \"Assigning #{value} to #{key}\" if ENV['BRINE_LOG_BINDING']\n binding[key] = value\n end",
"def bind(key, value)\n STDERR.puts \"Assigning #{value} to #{key}\" if ENV['BRINE_LOG_BINDING']\n binding[key] = value\n end",
"def task_retry_queue\n queue = channel.queue(TASK_RETRY_QUEUE, arguments: { 'x-dead-letter-exchange': TASK_EXCHANGE })\n queue.bind(task_retry_exchange) # done this way due to bug on the testing library where bind does not return self.\n queue\n end",
"def unbind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_unbind(queue, exchange, binding_key, arguments: arguments)\n end\n end",
"def declare_and_bind_private_queue\n declare_queue(:exclusive => true, :auto_delete => true)\n bind_queue(\n :exchange => \"amq.direct\",\n :queue => @sess.queue,\n :routing_key => @sess.queue)\n # Get the private queue name from the session\n @sess.queue\n end",
"def resolve_queue(key)\n\t\twaiting = request_queue.select { |req| req.key == key.to_i }\n\t\twaiting.each do |w|\n\t\t\tputs \"resolving queue #{request_queue}\"\n\t\t\tsend_message [\"PUT\", key, resource_table[key][0]], 0, w.host, w.port\n\t\t\trequest_queue - [w]\n\t\tend\n\tend",
"def setup_amqp\n @channel = TomQueue.bunny.create_channel\n @channel.prefetch(0)\n\n @exchange = channel.fanout(\"#{prefix}.work.deferred\",\n :durable => true,\n :auto_delete => false)\n\n @queue = channel.queue(\"#{prefix}.work.deferred\",\n :durable => true,\n :auto_delete => false).bind(exchange.name)\n end",
"def publish(routing_key, payload = {}, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n bind_queue(routing_key) if options[:bind_to_queue]\n @exchange.publish(MultiJson.dump(payload), routing_key: routing_key, persistent: true)\n end",
"def bind_params(controller_class, topic)\n return if topic.batch_consuming\n controller_class.include SingleParams\n end",
"def deliver(payload, opts, key)\n\n # escape periods with backslash for regex\n key = key.gsub('.', '\\.')\n\n # replace single wildcards with regex for a single domain\n key = key.gsub(SINGLE_WILDCARD, '(?:\\w+)')\n\n # replace multi wildcards with regex for many domains separated by '.'\n key = key.gsub(MULTI_WILDCARD, '\\w+\\.?')\n\n # turn key into regex\n key = Regexp.new(key)\n\n @routes.each do |route, destination|\n destination.publish(payload, opts) if route =~ key\n end\n end",
"def bind(source, opts = {}, &block)\n source = source.name if source.respond_to?(:name)\n routing_key = opts[:key] || opts[:routing_key] || AMQ::Protocol::EMPTY_STRING\n arguments = opts[:arguments] || {}\n nowait = opts[:nowait] || block.nil?\n @channel.once_open do\n @connection.send_frame(AMQ::Protocol::Exchange::Bind.encode(@channel.id, @name, source, routing_key, nowait, arguments))\n unless nowait\n self.define_callback(:bind, &block)\n @channel.exchanges_awaiting_bind_ok.push(self)\n end\n end\n self\n end",
"def setup_identity_queue\n # Explicitly create direct exchange and bind queue to it\n # since may be binding this queue to multiple exchanges\n queue = @amq.queue(@identity, :durable => true)\n binding = queue.bind(@amq.direct(@identity, :durable => true, :auto_delete => true))\n\n # A RightScale infrastructure agent must also bind to the advertise exchange so that\n # a mapper that comes up after this agent can learn of its existence. The identity\n # queue binds to both the identity and advertise exchanges, therefore the advertise\n # exchange must be durable to match the identity exchange.\n queue.bind(@amq.fanout('advertise', :durable => true)) if @options[:infrastructure]\n\n binding.subscribe(:ack => true) do |info, msg|\n begin\n info.ack\n receive_any(@serializer.load(msg))\n rescue Exception => e\n RightLinkLog.error(\"RECV #{e.message}\")\n @callbacks[:exception].call(e, msg, self) rescue nil if @callbacks && @callbacks[:exception]\n end\n end\n end",
"def enable_queues(jndi_names = {})\n configuration.enabled_queues = jndi_names\n end",
"def bind(*args)\n raise \"Need at least callback_name\" if args.length < 1\n func_name = args[0]\n func_args = args[1..-1] || []\n {\n \"type\" => \"binding\",\n \"callback_name\" => Lang.func_name_to_callback(func_name),\n \"callback_args\" => func_args,\n \"cancel\" => nil,\n }\n end",
"def queue_ready(queue)\n @queue = queue\n @queue.bind(@exchange, :routing_key => @routing_key) do |binding_ok|\n @queue.subscribe(:ack => true, &method(:message_received))\n self.succeed\n end\n end",
"def publish_to(exname, message, opts={})\n EventMachine.schedule {\n ex = amq.exchanges[exname] || raise(\"Undefined exchange name : #{exname}\")\n case ex.type\n when :topic\n unless opts.has_key? :key\n opts[:key] = '*'\n end\n end\n ex.publish(Serializer.instance.marshal(message), opts)\n }\n end",
"def binding(*args, &block)\n method_missing(:binding, *args, &block)\n end",
"def bind\n binding\n end",
"def create_rabbit_mq_listener(channelName=Visibility_DataStore::Visibility_RabbitMQ::ROOT_LOGGING_CHANNEL, routingKey=Visibility_DataStore::Visibility_RabbitMQ::ROOT_ROUTING_KEY)\n # (:host => \"localhost\", :vhost => \"myapp.production\", :user => \"bunny\", :password => \"t0ps3kret\")\n connection = Bunny.new(:host => Visibility_DataStore::Visibility_RabbitMQ::ADDRESS_LOOPBACK, automatically_recover: false)\n connection.start\n\n channel = connection.create_channel\n exchange = channel.topic(channelName)\n queue = channel.queue('', exclusive: true)\n\n queue.bind(exchange, routing_key: routingKey)\n\n puts ' [*] Waiting for logs on #{channelName}. To exit press CTRL+C'\n\n begin\n queue.subscribe(block: true) do |delivery_info, _properties, body|\n puts \" [x] #{delivery_info.routing_key}:#{body}\"\n bodyJSON = JSON.parse(body)\n store_log(bodyJSON)\n end\n rescue Interrupt => _\n channel.close\n connection.close\n\n exit(0)\n end\nend",
"def bind address\n begin\n @bindings << address\n @raw_socket.bind address.to_s\n true\n rescue ZMQ::ZeroMQError\n @bindings.pop\n false\n end\n end",
"def display_template_bind(message_key, template_binding = binding)\n self.local_binding = template_binding\n print_margin message(message_key)\n end",
"def rl_generic_bind(type, keyseq, data, map)\r\n map[keyseq] = data\r\n 0\r\n end",
"def bind( key )\n\t\tif key.is_a? Fixnum\n\t\t\tif key < 13 and key > 0\n\t\t\t\[email protected]( \"F#{key}\" ){ yield }\n\t\t\telse\n\t\t\t\traise ArgumentError, \"Bind must be 1 to 12!\"\n\t\t\tend\n\t\tend\n\tend",
"def bind(*) end",
"def bind(pattern, &block)\n widget.bind(pattern, &block)\n end",
"def subscribe(worker)\n # If we've already got a bunny object, use it. This allows people to\n # specify all kinds of options we don't need to know about (e.g. for ssl).\n @bunny = @opts[:connection]\n @bunny ||= create_bunny_connection\n @bunny.start\n\n @channel = @bunny.create_channel\n @channel.prefetch(@opts[:prefetch])\n\n exchange_name = @opts[:exchange]\n @exchange = @channel.exchange(exchange_name, **@opts[:exchange_options])\n\n routing_key = @opts[:routing_key] || @name\n routing_keys = [*routing_key]\n\n handler_klass = worker.opts[:handler] || Sneakers::CONFIG.fetch(:handler)\n # Configure options if needed\n if handler_klass.respond_to?(:configure_queue)\n @opts[:queue_options] = handler_klass.configure_queue(@name, @opts)\n end\n\n queue = @channel.queue(@name, **@opts[:queue_options])\n\n if exchange_name.length > 0\n routing_keys.each do |key|\n if @opts[:bind_arguments]\n queue.bind(@exchange, routing_key: key, arguments: @opts[:bind_arguments])\n else\n queue.bind(@exchange, routing_key: key)\n end\n end\n end\n\n # NOTE: we are using the worker's options. This is necessary so the handler\n # has the same configuration as the worker. Also pass along the exchange and\n # queue in case the handler requires access to them (for things like binding\n # retry queues, etc).\n handler = handler_klass.new(@channel, queue, worker.opts)\n\n @consumer = queue.subscribe(block: false, manual_ack: @opts[:ack]) do | delivery_info, metadata, msg |\n worker.do_work(delivery_info, metadata, msg, handler)\n end\n nil\n end",
"def display_template_bind(message_key, template_binding = binding)\n self.local_binding = template_binding\n print_margin message(message_key)\n end",
"def post_initialize(**opts)\n bind_queue_to_exchange\n super\n end",
"def bind\n binding\n end",
"def bind(arg_name, klass)\n @bindings[arg_name] = klass\n end",
"def bind(hash)\n out = binder.new\n hash.each do |k,v|\n out.send \"#{k}=\", v\n end\n out\n end",
"def send_messages_to_dead_letter_address(filter = nil)\n with_queue_control do |control|\n control.send_messages_to_dead_letter_address(filter)\n end\n end",
"def bind(endpoint)\n rc = LibZMQ.zmq_bind @pointer, endpoint\n ZMQ.error_check true if rc==-1\n end",
"def handle(jid)\n iq = InfoQuery.set('id' => 'bind_1')\n iq << bind = Bind.new\n\n unless jid.resource.empty?\n bind << resource = Resource.new\n resource.content = jid.resource\n end\n\n jid.xmpp_handler.send_data(Presence.initial)\n end",
"def bind(desired_resource=nil)\n iq = Iq.new(:set)\n bind = iq.add REXML::Element.new('bind')\n bind.add_namespace @stream_features['bind']\n if desired_resource\n resource = bind.add REXML::Element.new('resource')\n resource.text = desired_resource\n end\n\n jid = nil\n send_with_id(iq) do |reply|\n reply_bind = reply.first_element('bind')\n if reply_bind\n reported_jid = reply_bind.first_element('jid')\n if reported_jid and reported_jid.text\n jid = JID.new(reported_jid.text)\n end\n end\n end\n jid\n end",
"def rmq_exchange\n rabbitmq_conn = Helper.rabbitmq_connect\n rabbitmq_conn.create_channel.direct('amq.topic')\n end",
"def _binding() binding end",
"def _binding() binding end",
"def publish(connection)\n #\t4. Communication session\n channel = connection.create_channel\n # 5 Declare queue\n channel.queue(DELAYED_QUEUE, arguments: { \"x-dead-letter-exchange\" => \"\", \"x-dead-letter-routing-key\" => DESTINATION_QUEUE, \"x-message-ttl\" => 300000})\n\n # 6. Publish a message\n channel.default_exchange.publish \"message content\", routing_key:\n DELAYED_QUEUE\n puts \"#{Time.now}: Published the message\"\n channel.close\nend",
"def bind(namespace)\n # Over-write an empty prefix\n uri = namespace.uri.to_s\n @uri_binding[uri] = namespace unless namespace.prefix.to_s.empty?\n @uri_binding[uri] ||= namespace\n @nsbinding[namespace.prefix.to_s] = namespace\n end",
"def bind(*addresses)\n addresses.each do |address|\n API::invoke :zmq_bind, self, parse_for_binding(address)\n endpoints << last_endpoint\n info do\n if address == last_endpoint\n \"Bound to #{address}\"\n else\n \"Bound to '#{address}' as #{last_endpoint}\"\n end\n end\n end\n endpoints\n end",
"def bind behavior\n actor_send :bind, behavior\n end",
"def activate_buffers_for_matching\n @triggers.keys.each do |pattern|\n debug \"checking #{@key_path} matches #{pattern}\"\n if JsonPath.matches?(@key_path, pattern) && !@active_buffers.keys.include?(pattern)\n debug \">> Activating buffer for #{pattern.inspect}\"\n @active_buffers[pattern] = ''\n end\n end\n end",
"def bind\n \n end",
"def queue_unbind(name, exchange, binding_key, arguments: {})\n write_bytes FrameBytes.queue_unbind(@id, name, exchange, binding_key, arguments)\n expect :queue_unbind_ok\n nil\n end",
"def with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def setup_queue_listener\n service_queue.subscribe(:block => true) do |info, properties, payload|\n log.debug \"Received message: #{payload}...\"\n @return_info = nil\n rpc_wrapper.call { process(info, properties, payload) }\n end\n end",
"def bind_key key, &block\n @session.key_bindings[key.to_s.unpack('c').first] = block\n Notice.new \"Key '#{key}' is bound to an action\" if block\n end",
"def setup_retry_queue(delay, index)\n channel.queue(\"#{queue_name}_delay_#{index}\",\n durable: !Proletariat.test_mode?,\n auto_delete: Proletariat.test_mode?,\n arguments: {\n 'x-dead-letter-exchange' => exchange_name,\n 'x-dead-letter-routing-key' => \"#{queue_name}_requeue\",\n 'x-message-ttl' => delay\n }\n ).bind(exchange, routing_key: \"#{queue_name}_delay_#{index}\")\n end",
"def bind(receiver)\n unbind if bound?\n \n @receiver = receiver\n configs.each_pair do |key, config|\n value = store.has_key?(key) ? store.delete(key) : config.default\n config.set(receiver, value)\n end\n \n self\n end",
"def binding_from_hash(**vars)\n b = clean_binding\n vars.each do |k, v|\n b.local_variable_set k.to_sym, v\n end\n\n return b\n end",
"def register_queue(name, options={})\n name = name.to_s\n raise ConfigurationError.new(\"queue #{name} already configured\") if queues.include?(name)\n opts = {\n :exchange => name, :key => name, :auto_delete => false, :amqp_name => name,\n :lazy => config.lazy_queues_enabled, :dead_lettering => config.dead_lettering_enabled,\n :dead_lettering_msg_ttl => config.dead_lettering_msg_ttl\n }.merge!(options.symbolize_keys)\n opts.merge! :durable => true, :passive => false, :exclusive => false\n exchange = opts.delete(:exchange).to_s\n key = opts.delete(:key)\n queues[name] = opts\n register_binding(name, :exchange => exchange, :key => key)\n end",
"def put_to_dead_letter_q(parms)\n message = parms[:message] ||= Message.new(data: parms[:data])\n dlh = {\n header_type: :dead_letter_header,\n reason: parms.delete(:reason),\n dest_q_name: parms.delete(:q_name),\n dest_q_mgr_name: name\n }\n\n message.headers.unshift(dlh)\n parms[:q_name] = 'SYSTEM.DEAD.LETTER.QUEUE' #TODO Should be obtained from QMGR config\n\n put(parms)\n end",
"def bind_responders(controller_class, topic)\n return unless topic.responder\n controller_class.include Responders\n end",
"def rl_bind_keyseq_in_map(keyseq, function, map)\r\n rl_generic_bind(ISFUNC, keyseq, function, map)\r\n end",
"def bind(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"bind \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def bind\n conf['api']['bind']\n end",
"def subscribe(key)\n @queue = @rabbit.channel.queue(\"\", :exclusive => true)\n @queue.bind(@exchange, :routing_key => key)\n begin\n @queue.subscribe(:block => true) do |delivery_info, metadata, payload|\n message = JSON.parse(payload, symbolize_names: true)\n yield message\n end\n rescue Interrupt => _\n @rabbit.close\n end\n end",
"def bind; binding() end",
"def publish_to_rabbit\n logger.debug \"Publishing #{self.name} (#{self.id}) to Rabbit...\"\n b = Bunny.new RABBIT_MQ\n b.start\n reindex = b.queue 'reindex', :durable => true\n exchange = b.exchange 'publicearth', :type => :direct, :durable => true\n reindex.bind exchange, :key => 'indexer'\n # reindex.publish \"#{self.id} #{self.updated_at.to_i * 1000}\", :persistent => true\n reindex.publish \"#{self.id} abc\", :persistent => true\n end",
"def connect_bunny(queue)\n bunny_logfile = File.expand_path(File.dirname(__FILE__) + '/' + APP_CONFIG['rabbit_mq']['log_file'])\n bunny = Bunny.new(:user => APP_CONFIG['rabbit_mq']['user'],\n :pass => APP_CONFIG['rabbit_mq']['pass'],\n :host => APP_CONFIG['rabbit_mq']['host'],\n :port => APP_CONFIG['rabbit_mq']['port'],\n :vhost => APP_CONFIG['rabbit_mq']['vhost'],\n :logging => APP_CONFIG['rabbit_mq']['logging'],\n :logfile => bunny_logfile)\n bunny.start\n bunny.queue(APP_CONFIG['rabbit_mq'][queue])\nend",
"def bind(id, repo_id, distributor_id, optional = {})\n required = required_params(binding.send(:local_variables), binding, ['id'])\n call(:post, path(\"#{id}/bindings/\"), :payload => { :required => required, :optional => optional })\n end",
"def amqp_listen\n @listener = \"client.#{::Kernel.rand(999_999_999_999)}\"\n Thread.new(self) do \n AMQP.start(:host => @host) do\n _notify = MQ.fanout(@x_notify)\n puts \"[amqp_listen] starting listener on #{Thread.current}\" if $DEBUG\n MQ.queue(@listener, :auto_delete => true).bind(_notify).subscribe{ |msg| yield msg }\n end \n end\n end",
"def get_binding(keyset)\n environment = $environment\n myPublicIp = $myPublicIp\n myRoot = $myRoot\n myAZ = $myAZ\n myRegion = $myRegion\n myAppName = $myAppName\n credentials = @default_credentials ? @default_credentials : \"default\"\n\n# return MU::Config.global_bindings[keyset] if MU::Config.global_bindings[keyset]\n MU::Config.global_bindings[keyset] = binding\n MU::Config.global_bindings[keyset]\n end",
"def bind(&block)\n\t\t\[email protected](&block)\n\t\tend",
"def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def queue_in\n @channel.queue('dns-in', durable: true)\n end",
"def create_amqp_queue( prefetch_count=DEFAULT_PREFETCH )\n\t\texchange = self.class.amqp_exchange\n\t\tchannel = self.class.amqp_channel\n\t\tcreated_queue = false\n\t\tqueue = nil\n\n\t\tbegin\n\t\t\tqueue = channel.queue( self.name, passive: true )\n\t\t\tchannel.prefetch( prefetch_count )\n\t\t\tself.log.info \"Using pre-existing queue: %s\" % [ self.name ]\n\t\trescue Bunny::NotFound => err\n\t\t\tself.log.info \"%s; creating a new queue instead.\" % [ err.message ]\n\t\t\tcreated_queue = true\n\t\t\tchannel = self.class.reset_amqp_channel\n\t\t\tchannel.prefetch( prefetch_count )\n\n\t\t\tqueue = channel.queue( self.name, auto_delete: !self.persistent )\n\t\tend\n\n\t\tif self.always_rebind? || created_queue\n\t\t\tself.routing_keys.each do |key|\n\t\t\t\tself.log.info \" binding queue %s to the %s exchange with topic key: %s\" %\n\t\t\t\t\t[ self.name, exchange.name, key ]\n\t\t\t\tqueue.bind( exchange, routing_key: key )\n\t\t\tend\n\t\tend\n\n\t\treturn queue\n\tend",
"def rl_bind_key(key, function)\r\n @_rl_keymap[rl_translate_keyseq(key)] = function\r\n @rl_binding_keymap = @_rl_keymap\r\n 0\r\n end",
"def subscribe_queue(name, opts = {})\n # TBD: here and analogously; only push in self and dynamically call native_client?(:mq)\n R8QueueMQ.new(self, name, opts)\n end",
"def retrieve(key); @amq.queue(key); end",
"def bind_to_activated_sockets(bind = T.unsafe(nil)); end",
"def binding() end",
"def binding() end",
"def listen\n amqp_listen do |msg|\n do_handle(msg)\n end\n end",
"def setup_queue(consumer)\n logger.info \"setting up queue: #{consumer.get_queue_name}\"\n\n queue = @broker.queue(consumer.get_queue_name, consumer.get_options)\n @broker.bind_queue(queue, consumer.routing_keys)\n\n queue.subscribe(consumer_tag: unique_consumer_tag, manual_ack: true) do |*args|\n delivery_info, properties, payload = Hutch::Adapter.decode_message(*args)\n handle_message(consumer, delivery_info, properties, payload)\n end\n end",
"def bind_key(input, output=nil, resolver=@bind_resolver, &block)\n if input.is_a? Array or input.is_a? Fixnum\n input = KeyEventHandler.parse_code input\n else\n fail ArgumentError, '1st arg expect Array / Fixnum'\n end\n\n if block_given?\n output = block\n elsif output.nil?\n fail ArgumentError, 'expect 1 arg with a block / 2 args'\n elsif output.kind_of? BindResolver\n elsif output.is_a? Array or output.is_a? Fixnum\n output = KeyEventHandler.parse_code output\n elsif output == :through or output == :ignore\n else\n fail ArgumentError, '2nd arg expect Array / Fixnum / BindResolver / ' +\n 'Symbol(:through/:ignore)'\n end\n\n LOG.info \"bind_key #{input.inspect},\\t#{output.inspect}\\t#{resolver}\" if LOG.info?\n\n resolver.bind input, output\n end",
"def binding()\n return Binding.setup(\n VariableScope.of_sender,\n CompiledMethod.of_sender,\n StaticScope.of_sender)\n\n end",
"def bind_key keycode, *args, &blk\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) \n when Array\n # double assignment\n # this means that all these keys have to be pressed in succession for this block, like \"gg\" or \"C-x C-c\"\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n ee = []\n keycode.each do |e| \n e = e.getbyte(0) if e.is_a? String\n ee << e\n end\n bind_composite_mapping ee, args, blk\n return self\n #@_key_map[a0] ||= OrderedHash.new\n #@_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n $log.debug \" assigning #{keycode} to _key_map for #{self.class}, #{@name}\" if $log.debug? \n end\n @_key_map[keycode] = blk\n @_key_args ||= {}\n @_key_args[keycode] = args\n self\n end"
] |
[
"0.7963198",
"0.72307914",
"0.65758204",
"0.65397793",
"0.6513005",
"0.6448646",
"0.63972634",
"0.63922256",
"0.633951",
"0.6093168",
"0.59950817",
"0.58290744",
"0.5794057",
"0.57282114",
"0.56231576",
"0.56067085",
"0.5472938",
"0.5419589",
"0.54102665",
"0.5408475",
"0.5276868",
"0.52075106",
"0.52075106",
"0.51804984",
"0.5088149",
"0.5070319",
"0.5053632",
"0.504359",
"0.5010311",
"0.49984545",
"0.4991595",
"0.49835026",
"0.49785227",
"0.49636123",
"0.4958331",
"0.49467385",
"0.49351215",
"0.49220365",
"0.49210355",
"0.4891972",
"0.488604",
"0.48775038",
"0.48735356",
"0.48647997",
"0.4832307",
"0.48210138",
"0.4780607",
"0.4763415",
"0.47462264",
"0.4745132",
"0.47414696",
"0.4733656",
"0.4730676",
"0.47225612",
"0.47187397",
"0.47117546",
"0.47094807",
"0.46998858",
"0.46998858",
"0.4687461",
"0.46795806",
"0.46698144",
"0.46696094",
"0.46629265",
"0.46494544",
"0.4646828",
"0.46400982",
"0.4636326",
"0.46280563",
"0.4626931",
"0.4624927",
"0.46213418",
"0.46128708",
"0.46005872",
"0.45901632",
"0.45782644",
"0.45703956",
"0.45458528",
"0.45431834",
"0.45412135",
"0.45396554",
"0.4538428",
"0.45288888",
"0.45270196",
"0.45221564",
"0.45162347",
"0.4503646",
"0.45034903",
"0.44948527",
"0.44896382",
"0.4477862",
"0.4477132",
"0.44617686",
"0.44595465",
"0.44595465",
"0.44575676",
"0.44574967",
"0.4457283",
"0.44443315",
"0.44438088"
] |
0.539793
|
20
|
The durable RabbitMQ topic exchange from where messages are received
|
def exchange
@exchange ||= channel.topic(topic_name, durable: true)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exchange\n @exchange ||= channel.topic(Proletariat.exchange_name,\n durable: !Proletariat.test_mode?)\n end",
"def rmq_exchange\n rabbitmq_conn = Helper.rabbitmq_connect\n rabbitmq_conn.create_channel.direct('amq.topic')\n end",
"def durable; @message_impl.getDurable; end",
"def messages_queue\n $messages_queue ||= client.queue(\"messages\", :durable => true, :auto_delete => false)\nend",
"def exchange\n @exchange ||= channel.fanout(exchange_name, durable: true)\n end",
"def exchange\n @exchange ||= channel.fanout(QUEUE_NAME)\n end",
"def exchange\n @exchange ||= channel.direct(exchange_name,\n durable: !Proletariat.test_mode?,\n auto_delete: Proletariat.test_mode?)\n end",
"def exchange\n @exchange ||= Hightops.connection.channel.exchange(exchange_naming.to_s, type: exchange_type, durable: true)\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def request(exchange_name, value)\n exchange_name = \"amq.topic\"\n\n key = value.delete(:routing_key)\n msg = YAML.dump(value)\n exchange = @amq.topic(exchange_name)\n exchange.publish(msg, :routing_key => key)\n end",
"def define_exchange(name, options = {})\n options = {\n durable: true,\n }.merge(options)\n @exchange = @channel.topic(name, options)\n end",
"def exchange\n Delayed::Job.tomqueue_manager.channel.exchange(@name,\n :type => @type,\n :auto_delete => @auto_delete,\n :durable => @durable\n )\n end",
"def exchange\n @exchange ||= Exchange.new(@channel, :direct, AMQ::Protocol::EMPTY_STRING, :key => name)\n end",
"def publish(connection)\n #\t4. Communication session\n channel = connection.create_channel\n # 5 Declare queue\n channel.queue(DELAYED_QUEUE, arguments: { \"x-dead-letter-exchange\" => \"\", \"x-dead-letter-routing-key\" => DESTINATION_QUEUE, \"x-message-ttl\" => 300000})\n\n # 6. Publish a message\n channel.default_exchange.publish \"message content\", routing_key:\n DELAYED_QUEUE\n puts \"#{Time.now}: Published the message\"\n channel.close\nend",
"def rabbitmq_id\n name\n end",
"def queue_in\n @channel.queue('dns-in', durable: true)\n end",
"def on_exchange(&block)\n return unless @channel\n @channel.topic('untied', :auto_delete => true, &block)\n end",
"def queue\n @queue ||= channel.queue(queue_name)\n end",
"def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end",
"def publish_to(exname, message, opts={})\n EventMachine.schedule {\n ex = amq.exchanges[exname] || raise(\"Undefined exchange name : #{exname}\")\n case ex.type\n when :topic\n unless opts.has_key? :key\n opts[:key] = '*'\n end\n end\n ex.publish(Serializer.instance.marshal(message), opts)\n }\n end",
"def topic\n @topic ||= client.topic config.topic\n end",
"def exchange\n @exchange ||= produce_exchange\n end",
"def push_destroy_to_amqp\n AMQP.start(APP_CONFIG['amqp']) do |connection|\n channel = AMQP::Channel.new(connection)\n exchange = channel.fanout(APP_CONFIG['amqp_channel'], :durable => true)\n \n payload = {\n :action => 'delete',\n :server_name => server_name\n }\n \n exchange.publish(payload.to_json, :persistent => true) do\n connection.close { EventMachine.stop }\n end\n end\n \n return true\n end",
"def send_tls_amqp\n queue_name = 'testqueue'\n amqps_target = 'amqps://localhost:5001'\n msg_to_send = 'A test message'\n cert = 'certs/cert.pem'\n key = 'certs/key.pem'\n queue_options = {:auto_delete => true, :durable => false}\n uri = URI(amqp_target)\n\n connection = Bunny.new(\n {\n :host => uri.host,\n :port => uri.port,\n :ssl => uri.scheme.eql?('amqps'),\n :verify_ssl => false,\n }\n )\n connection.start\n\n channel = connection.create_channel\n q = channel.queue(queue_name, queue_options)\n x = channel.default_exchange\n \n x.publish(\"Test message\", :routing_key => q.name)\n\n msg_info, msg_metadata, msg_content = q.pop\n puts \"\n Meta: #{msg_metadata}\n Message: #{msg_content}\n ---\n Info: #{msg_info}\n \"\nend",
"def create_rabbit_mq_listener(channelName=Visibility_DataStore::Visibility_RabbitMQ::ROOT_LOGGING_CHANNEL, routingKey=Visibility_DataStore::Visibility_RabbitMQ::ROOT_ROUTING_KEY)\n # (:host => \"localhost\", :vhost => \"myapp.production\", :user => \"bunny\", :password => \"t0ps3kret\")\n connection = Bunny.new(:host => Visibility_DataStore::Visibility_RabbitMQ::ADDRESS_LOOPBACK, automatically_recover: false)\n connection.start\n\n channel = connection.create_channel\n exchange = channel.topic(channelName)\n queue = channel.queue('', exclusive: true)\n\n queue.bind(exchange, routing_key: routingKey)\n\n puts ' [*] Waiting for logs on #{channelName}. To exit press CTRL+C'\n\n begin\n queue.subscribe(block: true) do |delivery_info, _properties, body|\n puts \" [x] #{delivery_info.routing_key}:#{body}\"\n bodyJSON = JSON.parse(body)\n store_log(bodyJSON)\n end\n rescue Interrupt => _\n channel.close\n connection.close\n\n exit(0)\n end\nend",
"def exchange_type\n @exchange_type ||= @worker_class ? :direct : :topic\n end",
"def queue_out\n @channel.queue('out', durable: true)\n end",
"def queue_out\n @channel.queue('out', durable: true)\n end",
"def with_exchange(&block)\n setup_to_publish do | client | \n block.call( create_topic(client) ) \n sleep 0.1 if puberror.empty?\n end\n end",
"def subscribed\n stream_from channel_name\n end",
"def publish(msg, exchange_name, routing={})\n ch = @connection.create_channel\n exchange = MarchHare::Exchange.new(ch, exchange_name, symbolize(@opts[:exchanges][exchange_name])) \n exchange.publish(msg, routing_key: routing[:routing_key], properties: { persistent: @opts[:message_persistent] }) if @connection.open?\n ch.close\n end",
"def channel\n\n Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel\n end",
"def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def topic\n if @topic\n @topic\n else\n connected do\n fiber = Fiber.current\n callbacks = {}\n [331, 332, 403, 442].each do |numeric|\n callbacks[numeric] = @thaum.on(numeric) do |event_data|\n topic = event_data[:params].match(':(.*)').captures.first\n fiber.resume topic\n end\n end\n\n raw \"TOPIC #{@name}\"\n @topic = Fiber.yield\n callbacks.each do |type, callback|\n @thaum.callbacks[type].delete(callback)\n end\n\n @topic\n end\n end\n end",
"def get_topic\n\t\treturn Topic.find(Debate.find(self.debate_id).topic_id)\n\tend",
"def publish_channel\n @publish_channel ||= ::AMQP::Channel.new(connection)\n end",
"def vayacondios_topic\n \"listeners.#{name}\"\n end",
"def bind_exchange_to_queue(channel, exchange_in_name, queue_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_output = channel.queue(queue_name) \n queue_output.bind(exchange_source)\n return queue_output\nend",
"def setup_identity_queue\n # Explicitly create direct exchange and bind queue to it\n # since may be binding this queue to multiple exchanges\n queue = @amq.queue(@identity, :durable => true)\n binding = queue.bind(@amq.direct(@identity, :durable => true, :auto_delete => true))\n\n # A RightScale infrastructure agent must also bind to the advertise exchange so that\n # a mapper that comes up after this agent can learn of its existence. The identity\n # queue binds to both the identity and advertise exchanges, therefore the advertise\n # exchange must be durable to match the identity exchange.\n queue.bind(@amq.fanout('advertise', :durable => true)) if @options[:infrastructure]\n\n binding.subscribe(:ack => true) do |info, msg|\n begin\n info.ack\n receive_any(@serializer.load(msg))\n rescue Exception => e\n RightLinkLog.error(\"RECV #{e.message}\")\n @callbacks[:exception].call(e, msg, self) rescue nil if @callbacks && @callbacks[:exception]\n end\n end\n end",
"def queue_out\n @channel.queue('dns-out', durable: true)\n end",
"def start(queue_name,severities)\n #connect to queue_name\n @queue = @channel.queue(queue_name)\n #create exchange\n @exchange = @channel.direct(\"factorial_exchange\")\n \n #call function to subcribe to queue\n subcribe_to_queue(severities)\n end",
"def queue\n # Probably should be a UUID in the real world\n @queue ||= channel.queue(self.object_id.to_s)\n end",
"def get(topic_name, &onMessage) # string, block => Topic;\n end",
"def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', waiting for messages...\"\n end",
"def topic\n return @topic\n end",
"def topic( name )\n Qup::Adapter::Kestrel::Topic.new( @addr, name )\n end",
"def durable=(durable); @message_impl.setDurable durable; end",
"def pubsub_adapter; end",
"def setup_amqp\n @channel = TomQueue.bunny.create_channel\n @channel.prefetch(0)\n\n @exchange = channel.fanout(\"#{prefix}.work.deferred\",\n :durable => true,\n :auto_delete => false)\n\n @queue = channel.queue(\"#{prefix}.work.deferred\",\n :durable => true,\n :auto_delete => false).bind(exchange.name)\n end",
"def publish(message, name)\n logger.debug \"AMQP publishing `#{message}` to exchange `#{name}`\"\n publish_channel.fanout(name, :auto_delete => true).publish(message)\n end",
"def topic\n return @topic\n end",
"def topic\n return @topic\n end",
"def topic\n @topic.to_s\n end",
"def topic\n if @topic\n @topic\n else\n fiber = Fiber.current\n callbacks = {}\n [331, 332, 403, 442].each do |numeric|\n callbacks[numeric] = @thaum.on(numeric) do |event_data|\n topic = event_data[:params].match(':(.*)').captures.first\n fiber.resume topic\n end\n end\n\n raw \"TOPIC #{@name}\"\n @topic = Fiber.yield\n callbacks.each do |type, callback|\n @thaum.callbacks[type].delete(callback)\n end\n\n @topic\n end\n end",
"def direct_exchange_channel\n $direct_exchange ||= client.create_channel.direct('nixonpi.channel')\n end",
"def connect_topic\n # scott old ack auot\n # see http://activemq.apache.org/stomp.html for activemq.dispathAsync settig\n self.conn.subscribe( self.topic, { :ack =>\"client\" , 'activemq.dispatchAsync' => 'false'}) { |msg| \n \n self.msg_count+=1\n \t begin\t\n \t self.conn.acknowledge(msg,msg.headers) \n \t self.queue << msg \n \t \n rescue Exception => e\n self.exception_count+=1\n puts \" Thread: :exception found #{e.backtrace}\" \n puts \"Thread: :exception messag #{e.message}\"\n end\n \n }\n end",
"def publish(message)\n # TODO: queue name and configuration should be in a config file\n @out_exchange.publish(message, :persistent => true, :key => \"esperfooin\", :mandatory => true)\n end",
"def publish(message)\n envelope = @transport.create_message(message, @serializer)\n data = @serializer.serialize(envelope)\n #queue = type, but messageType needs env.messageType = \"urn:message:\" + env.messageType\n q_name = (message.messageType || data.class.name.gsub(\"::\",\".\"))\n @transport.publish(q_name,data,:headers=> {\"Content-Type\"=>\"application/vnd.masstransit+json\"}) #exchange?\n #@transport.publish(q_name,data) #exchange?\n end",
"def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend",
"def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end",
"def publish_to_rabbit\n logger.debug \"Publishing #{self.name} (#{self.id}) to Rabbit...\"\n b = Bunny.new RABBIT_MQ\n b.start\n reindex = b.queue 'reindex', :durable => true\n exchange = b.exchange 'publicearth', :type => :direct, :durable => true\n reindex.bind exchange, :key => 'indexer'\n # reindex.publish \"#{self.id} #{self.updated_at.to_i * 1000}\", :persistent => true\n reindex.publish \"#{self.id} abc\", :persistent => true\n end",
"def publish(payload, opts = {})\n @channel.default_exchange.publish(payload, opts.merge(:routing_key => @name))\n\n self\n end",
"def ontopic(topic, msg)\n \n a = topic.split('/')\n sender = a.pop\n\n puts \"%s: %s\" % [sender, msg] if @debug\n @received << msg \n\n end",
"def subscribe \n @subscription = MQ.new\n @subscription.queue(@uuid).bind(@subscription.fanout('global_history')).subscribe do |result|\n x = Mash.new(JSON::parse(result))\n puts \"received: #{x[:uuid]} #{x[:user]}@#{x[:host]}$ #{x[:message]}\"\n if x[:uuid] != @uuid\n @pause = true\n File.open(path, \"a\") {|f| f.puts(x[:message])}\n skip_ahead\n @pause = false\n schedule_next_read\n end\n end\n end",
"def topic\n @topic.join('/')\n end",
"def push_to_amqp\n\n AMQP.start(APP_CONFIG['amqp']) do |connection|\n\n channel = AMQP::Channel.new(connection)\n\n channel.on_connection_interruption do |ch|\n puts \"--> Channel #{ch.id} detected connection interruption\"\n EventMachine.stop\n end\n\n exchange = channel.fanout(APP_CONFIG['amqp_channel'], :durable => true)\n exchange.on_connection_interruption do |ex|\n puts \"--> Exchange #{ex.name} detected connection interruption\"\n EventMachine.stop\n end \n\n exchange.publish(attributes.to_json.gsub('\\r\\n', '\\n'), :persistent => true) do\n connection.close { EventMachine.stop }\n end\n end\n\n return true\n end",
"def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def durable\n trace 'durable'\n Puppet.debug \"Durable given: #{@resource[:durable].inspect}\"\n # normalization\n ToBooleanConverter.new(@data['durable']).to_bool.to_s\n end",
"def channel(name)\n arn = self.fetch(name)\n region = arn.split(':')[3]\n notifier_builder.new(region: region).topics[arn]\n end",
"def topic(message)\n puts \"-----> #{message}\"\nend",
"def queues\n @channel.queues\n end",
"def sns_topic\n data.sns_topic\n end",
"def domain\n return 'ADS-QUEUE'\n end",
"def href\n \"#{PATH_BASE}/#{@queue.name}/messages/#{@id}\"\n end",
"def durable\n trace 'durable'\n Puppet.debug \"Durable given: #{@resource[:durable].inspect}\"\n # normalization\n ToBooleanConverter.new($data['durable']).to_bool.to_s\n end",
"def retrieve(key); @amq.queue(key); end",
"def url\n @@url ||= (ENV[\"AMQP_URL\"] || \"amqp://guest:guest@localhost/\")\n end",
"def order_taxi(type, exchange)\n payload = \"example-message\"\n message_id = exchange.publish(payload,\n routing_key: type,\n content_type: \"application/json\",\n content_encoding: \"UTF-8\",\n persistent: true,\n message_id: message_id)\nend",
"def send_topic_acknowledge(msg, headers, timeout=60)\n #m=StompMessage::Message.new('stomp_BILLING', msg)\n open_connection\n s=rand*30 # scott - used to be 1000 but seem to create connections on activemq\n # open new topic to listen to reply...\n # was this but jms seems to blow up receipt_topic=\"/topic/receipt/client#{s.to_i}\"\n receipt_topic=\"/topic/rcpt_client#{s.to_i}\"\n receipt_flag = false\n # internal_conn = Stomp::Connection.open '', '', self.host, self.port, false \n self.conn.subscribe( receipt_topic, { :ack =>\"client\" }) {|msg|\n begin\n Timeout::timeout(timeout) {\n self.conn.acknowledge(msg,msg.headers)\n \t msg2= msg.body\n \t yield msg2\n }\n rescue Exception => e\n puts \"exception #{e.message}\"\n # raise \"timeout\" \n ensure\n receipt_flag=true\n self.conn.unsubscribe receipt_topic \n end \n }\n \n \n more_headers= {'persistent'=>'false', 'reply-to' => \"#{receipt_topic}\" }\n more_headers.merge headers\n self.conn.send(self.topic, msg.to_xml, more_headers ) \n Thread.new { sleep(timeout+1)\n puts \"calling unsubscribe on #{receipt_topic}\" if !receipt_flag\n self.conn.unsubscribe receipt_topic if !receipt_flag\n } \n end",
"def receive_topic name\n @topic = sanitize_location_name name\n end",
"def read_topic(chan)\n sep = $config['plugins/topic/separator', '|']\n (topic = chan.topic) ? topic.split(\" #{sep} \") : []\n end",
"def topic(channel, str)\n sendmsg \"TOPIC #{channel} :#{str}\"\n end",
"def initialize\n @connection = Bunny.new(ENV['CLOUDAMQP_URL'] || ENV['AMQP_HOST'])\n @connection.start\n @channel = connection.create_channel\n @exchange = channel.topic(ENV['AMQP_EXCHANGE'] || ENV['SERVICE_NAME'])\n end",
"def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end",
"def next_message_from(queue)\n delivery_info, properties, body = queue.pop\n return nil if body.nil?\n Bunny::Message.new(delivery_info, properties, body)\n end",
"def subscribed\n \t#stream_from 'demo_chan'\n end",
"def action(queue_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n -f #{[Conn[:host_api], 'queues', Conn[:vhost], queue_name].join('/')} | jq '.messages_ready'`\n end",
"def subscription_channel\n @subscription_channel ||= ::AMQP::Channel.new(connection).prefetch(1)\n end",
"def sns_topic\n @sns_topic ||= if sns_topic_arn.present?\n Aws::SNS::Resource.new(region: 'eu-west-2').topic(sns_topic_arn)\n end\n end",
"def create_queues\n queue\n exchange\n end",
"def topic(name)\n pubsub.topic(name) || create_topic(name)\n end",
"def subscribe(key)\n @queue = @rabbit.channel.queue(\"\", :exclusive => true)\n @queue.bind(@exchange, :routing_key => key)\n begin\n @queue.subscribe(:block => true) do |delivery_info, metadata, payload|\n message = JSON.parse(payload, symbolize_names: true)\n yield message\n end\n rescue Interrupt => _\n @rabbit.close\n end\n end",
"def bind_exchange_to_exchange(channel, exchange_in_name, queue_name, exchange_out_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_current = channel.queue(queue_name)\n queue_current.bind(exchange_source)\n exchange_output = channel.fanout(exchange_out_name)\n return queue_current, exchange_output\nend",
"def create_channel\n AMQP::Channel.new(@amqp_client)\n end",
"def before_publish(message)\n # do any business logic\n # this calls the adapter.publish(message) afterware\n message\n end",
"def exchange(name, type, durable: true, auto_delete: false, internal: false, arguments: {})\n @exchanges.fetch(name) do\n with_connection do |conn|\n conn.channel(1).exchange_declare(name, type, durable: durable, auto_delete: auto_delete,\n internal: internal, arguments: arguments)\n end\n @exchanges[name] = Exchange.new(self, name)\n end\n end",
"def publish(message, name)\n logger.debug \"Bunny publishing `#{message}` to exchange `#{name}`\"\n connection.exchange(name, :auto_delete => true, :type => :fanout).publish(message)\n end",
"def resource_topic\n if @topics.empty?\n raise TopicNotSubscribedError, \"Resource '#{@uid}' has not subscribed to any topics\"\n end\n @topics[0]\n end",
"def broker_name\r\n self[:broker]\r\n end",
"def publish(routing_key, payload = {}, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n bind_queue(routing_key) if options[:bind_to_queue]\n @exchange.publish(MultiJson.dump(payload), routing_key: routing_key, persistent: true)\n end"
] |
[
"0.7827947",
"0.7541374",
"0.734184",
"0.71635157",
"0.7152248",
"0.7138307",
"0.7026258",
"0.69942135",
"0.66804373",
"0.6465344",
"0.6464688",
"0.6461403",
"0.6444267",
"0.63305336",
"0.6254032",
"0.6200513",
"0.6107448",
"0.60538304",
"0.59833544",
"0.5960152",
"0.5959861",
"0.59275323",
"0.592686",
"0.5901384",
"0.58975154",
"0.58963156",
"0.5893436",
"0.5893436",
"0.5889709",
"0.5841089",
"0.5840095",
"0.583048",
"0.5815908",
"0.580601",
"0.5805659",
"0.5801382",
"0.58001655",
"0.5788083",
"0.5787368",
"0.5779487",
"0.5770988",
"0.57652694",
"0.5744138",
"0.5720902",
"0.5714133",
"0.5699288",
"0.56959695",
"0.56879175",
"0.56724226",
"0.5660774",
"0.56251615",
"0.56251615",
"0.5597263",
"0.55962485",
"0.55885184",
"0.55878097",
"0.55701774",
"0.5565024",
"0.55630463",
"0.5562741",
"0.5547243",
"0.5540847",
"0.5532245",
"0.54999167",
"0.54939467",
"0.54913807",
"0.5480389",
"0.5457185",
"0.54491127",
"0.5424251",
"0.54188085",
"0.5417602",
"0.5409327",
"0.540826",
"0.54075354",
"0.5388909",
"0.537618",
"0.5362078",
"0.5352414",
"0.5350103",
"0.53478295",
"0.53475",
"0.53451586",
"0.5344178",
"0.53433627",
"0.533715",
"0.5336232",
"0.5327491",
"0.53238255",
"0.5322611",
"0.53225416",
"0.5317753",
"0.5313353",
"0.53009415",
"0.529682",
"0.5292238",
"0.5279681",
"0.5275653",
"0.52729684",
"0.5272176"
] |
0.83424234
|
0
|
Bind this worker's listening queue to the topic exchange and receive only messages with routing key matching the patterns in binding_keys.
|
def bind_queue_to_exchange_routing_keys
binding_keys.each do |key|
queue.bind(exchange, routing_key: key)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', waiting for messages...\"\n end",
"def bind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_bind(queue, exchange, binding_key, arguments: arguments)\n end\n end",
"def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end",
"def queue_bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(AMQ::Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n # store bindings for automatic recovery, but BE VERY CAREFUL to\n # not cause an infinite rebinding loop here when we recover. MK.\n binding = { :exchange => exchange_name, :routing_key => routing_key, :arguments => arguments }\n @bindings.push(binding) unless @bindings.include?(binding)\n\n self\n end",
"def bind_queue_to_exchange\n queue.bind(exchange)\n end",
"def listen\n amqp_listen do |msg|\n do_handle(msg)\n end\n end",
"def queue_bind(name, exchange, binding_key, arguments: {})\n write_bytes FrameBytes.queue_bind(@id, name, exchange, binding_key, false, arguments)\n expect :queue_bind_ok\n nil\n end",
"def bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n\n # TODO: handle channel & connection-level exceptions\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n self\n end",
"def bind(exchange, opts = {}, &block)\n @channel.once_open do\n self.once_name_is_available do\n queue_bind(exchange, (opts[:key] || opts[:routing_key] || AMQ::Protocol::EMPTY_STRING), (opts[:nowait] || block.nil?), opts[:arguments], &block)\n end\n end\n\n self\n end",
"def declare_and_bind_private_queue\n declare_queue(:exclusive => true, :auto_delete => true)\n bind_queue(\n :exchange => \"amq.direct\",\n :queue => @sess.queue,\n :routing_key => @sess.queue)\n # Get the private queue name from the session\n @sess.queue\n end",
"def queue_ready(queue)\n @queue = queue\n @queue.bind(@exchange, :routing_key => @routing_key) do |binding_ok|\n @queue.subscribe(:ack => true, &method(:message_received))\n self.succeed\n end\n end",
"def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def create_rabbit_mq_listener(channelName=Visibility_DataStore::Visibility_RabbitMQ::ROOT_LOGGING_CHANNEL, routingKey=Visibility_DataStore::Visibility_RabbitMQ::ROOT_ROUTING_KEY)\n # (:host => \"localhost\", :vhost => \"myapp.production\", :user => \"bunny\", :password => \"t0ps3kret\")\n connection = Bunny.new(:host => Visibility_DataStore::Visibility_RabbitMQ::ADDRESS_LOOPBACK, automatically_recover: false)\n connection.start\n\n channel = connection.create_channel\n exchange = channel.topic(channelName)\n queue = channel.queue('', exclusive: true)\n\n queue.bind(exchange, routing_key: routingKey)\n\n puts ' [*] Waiting for logs on #{channelName}. To exit press CTRL+C'\n\n begin\n queue.subscribe(block: true) do |delivery_info, _properties, body|\n puts \" [x] #{delivery_info.routing_key}:#{body}\"\n bodyJSON = JSON.parse(body)\n store_log(bodyJSON)\n end\n rescue Interrupt => _\n channel.close\n connection.close\n\n exit(0)\n end\nend",
"def setup_queue_listener\n service_queue.subscribe(:block => true) do |info, properties, payload|\n log.debug \"Received message: #{payload}...\"\n @return_info = nil\n rpc_wrapper.call { process(info, properties, payload) }\n end\n end",
"def bind_queue(name, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n\n options = {\n durable: true,\n auto_delete: false,\n }.merge(options)\n\n @channel.queue(name, options)\n .bind(@exchange, routing_key: name)\n end",
"def register_binding(queue_name, options={})\n name = queue_name.to_s\n opts = options.symbolize_keys\n exchange = (opts[:exchange] || name).to_s\n key = (opts[:key] || name).to_s\n (bindings[name] ||= []) << {:exchange => exchange, :key => key}\n register_exchange(exchange) unless exchanges.include?(exchange)\n queues = exchanges[exchange][:queues]\n queues << name unless queues.include?(name)\n end",
"def listen\n @queue.subscribe(block: true) do |delivery_info, properties, body|\n puts(body)\n end\n end",
"def listen\n connect do\n routes.each do |queue|\n @client.subscribe(queue) do |args|\n run(queue, args)\n end\n end\n end\n while (!Thread.current[:shutdown]) do\n sleep(self.class.sleep_time)\n end\n end",
"def amqp_listen\n @listener = \"client.#{::Kernel.rand(999_999_999_999)}\"\n Thread.new(self) do \n AMQP.start(:host => @host) do\n _notify = MQ.fanout(@x_notify)\n puts \"[amqp_listen] starting listener on #{Thread.current}\" if $DEBUG\n MQ.queue(@listener, :auto_delete => true).bind(_notify).subscribe{ |msg| yield msg }\n end \n end\n end",
"def monitor()\n listener = QueueListener.new(monitor_queue)\n sub_processor = SubscriptionProcessor.new\n avail_processor = AvailabilityProcessor.new(true)\n\n listener.add_processor(sub_processor)\n listener.add_processor(avail_processor)\n\n # add a post-processor to let the subscriber know\n # of all the available services it is interested in, \n # that we currently know about.\n sub_processor.post_process = Proc.new do |msg|\n begin\n if msg.subscribe\n info { \"received subscription from #{msg.response_queue} for #{msg.services.inspect}\" }\n debug { \"got subscription #{msg.inspect}\" }\n queue = sqs.queue(msg.response_queue)\n\n # determine which services that this subscriber is interested in,\n # and organize them by ipv4 address (so we can send a minimal amount of messages)\n ipv4_services = {}\n\n msg.services.each do |service|\n # send an availability message for each service\n addrs = avail_processor.available(service)\n addrs.each do |addr|\n ipv4_services[addr.ipv4] ||= []\n ipv4_services[addr.ipv4] |= [\"#{service}#{addr.port}\"]\n end\n end\n\n ipv4_services.each do |ipv4, services|\n avail_msg = AvailabilityMessage.new(services, ipv4, true)\n debug { \"sending availability msg #{avail_msg.inspect}\" }\n send_message(queue, avail_msg)\n end\n end\n rescue Exception => ex\n error \"Error during post-process for message #{msg.inspect}\", ex\n end\n end\n\n # add a post-processor to let any subscribers know of\n # updates to availability, even keep-alives.\n avail_processor.post_process = Proc.new do |msg|\n debug { \"received availability message #{msg.inspect}\" }\n begin\n msg.services.each do |service|\n # service may have included a port, so strip that off when we\n # search for subscribers\n service_minus_port = service.gsub(/:.*$/, '')\n\n sub_processor.response_queues(service_minus_port).each do |response_queue|\n # original message may have included more services \n # other than what the subscriber is interested in\n avail_msg = AvailabilityMessage.new([service], msg.ipv4addr, msg.available, msg.ttl)\n debug { \"sending availability message #{avail_msg.inspect}\" }\n send_message(sqs.queue(response_queue), avail_msg)\n end\n end\n rescue Exception => ex\n error \"Error during post-process for message #{msg.inspect}\", ex\n end\n end\n\n # TODO: allow control over this thread\n unavail_thread = Thread.new do\n while true\n begin\n avail_processor.expired.each do |service, addr_list|\n info { \"#{service} on #{addr_list.inspect} expired\" }\n sub_processor.response_queues(service).each do |response_queue|\n addr_list.each do |addr|\n msg = AvailabilityMessage.new([\"#{service}#{addr.port}\"], addr.ipv4, false, -1)\n debug { \"sending unavailable message #{msg.inspect} to #{response_queue}\" }\n begin\n send_message(sqs.queue(response_queue), msg)\n rescue Exception => ex\n error \"Error sending unavailable message #{msg.inspect} to #{response_queue}\", ex\n end\n end\n end\n end\n rescue Exception => ex\n error \"Unexpected exception in expiration thread!\", ex\n end\n sleep 1\n end\n end\n \n\n return listener.listen\n end",
"def bind_exchange_to_queue(channel, exchange_in_name, queue_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_output = channel.queue(queue_name) \n queue_output.bind(exchange_source)\n return queue_output\nend",
"def process\n river = Pebblebed::River.new\n queue_options = {\n :name => \"#{@app_name}.security_listener\",\n :path => '**',\n :klass => 'access_group|access_group_membership|access_group_subtree',\n :event => '**',\n :interval => 1\n }\n queue = river.queue queue_options\n queue.subscribe(block: true) do |delivery_info, metadata, payload|\n consider({:payload => payload})\n end\n end",
"def send_messages_to_dead_letter_address(filter = nil)\n with_queue_control do |control|\n control.send_messages_to_dead_letter_address(filter)\n end\n end",
"def listen(topic_name, options = {}, &message_processor)\n QueueListener.listen(aws_client, config, topic_name, options, &message_processor)\n end",
"def start_listener!\n memoize(\"#{args[:bind]}-#{args[:port]}\", :global) do\n build_listener do |req|\n begin\n msg = build_message(req)\n # Start with static path lookup since it's the\n # cheapest, then fallback to iterative globbing\n msg_queue = nil\n unless(msg_queue = message_queues[\"#{req.path}-#{req.method.to_s.downcase}\"])\n message_queues.each do |k,v|\n path_glob, http_method = k.split('-')\n if(req.method.to_s.downcase == http_method && File.fnmatch(path_glob, req.path))\n msg_queue = v\n end\n end\n end\n if(msg_queue)\n if(authorized?(msg))\n msg_queue[:queue] << msg\n if(msg_queue[:config][:auto_respond])\n code = msg_queue[:config].fetch(:response, :code, 'ok').to_sym\n response = msg_queue[:config].fetch(:response, :message, 'So long and thanks for all the fish!')\n req.respond(code, response)\n end\n else\n req.respond(:unauthorized, 'You are not authorized to perform requested action!')\n end\n else\n req.respond(:not_found, 'Requested path not found!')\n end\n rescue Zoidberg::DeadException\n raise\n rescue => e\n req.respond(:bad_request, \"Failed to process request -> #{e}\")\n puts \"#{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end",
"def bind_exchange(exchange_name, async_api_subscribe_operation)\n operation_bindings =\n async_api_subscribe_operation.bindings.amqp.symbolize_keys || {}\n channel_proxy.bind_queue(\n @subject.name,\n exchange_name,\n { routing_key: operation_bindings[:routing_key] }\n )\n logger.info \"Queue #{@subject.name} bound to exchange #{exchange_name}\"\n rescue Bunny::NotFound => e\n raise EventSource::Protocols::Amqp::Error::ExchangeNotFoundError,\n \"exchange #{name} not found. got exception #{e}\"\n end",
"def bind(exchange, binding_key, arguments: {})\n @client.exchange_bind(@name, exchange, binding_key, arguments: arguments)\n self\n end",
"def subscribe(key)\n @queue = @rabbit.channel.queue(\"\", :exclusive => true)\n @queue.bind(@exchange, :routing_key => key)\n begin\n @queue.subscribe(:block => true) do |delivery_info, metadata, payload|\n message = JSON.parse(payload, symbolize_names: true)\n yield message\n end\n rescue Interrupt => _\n @rabbit.close\n end\n end",
"def listen(&block)\n queue.bind(exchange).subscribe do |delivery_info, metadata, event|\n block.call(event)\n end\n nil\n end",
"def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:poll_interval]) if (@current_queue == start)\n q = @queues[@queue_names[@current_queue]]\n unless q.nil?\n message = retrieve_message(q)\n return message unless message.nil?\n end\n end\n end",
"def listen(_deprecated_messages=nil, &block)\n raise Error.new(\"Beetle::Client#listen no longer works with arguments. Please use #listen_queues(['queue1', 'queue2']) instead\") if _deprecated_messages\n listen_queues(&block)\n end",
"def setup_shared_queue\n @amq.queue(@shared_queue).subscribe(:ack => true) do |info, msg|\n begin\n info.ack\n receive_request(@serializer.load(msg))\n rescue Exception => e\n RightLinkLog.error(\"RECV #{e.message}\")\n @callbacks[:exception].call(e, msg, self) rescue nil if @callbacks && @callbacks[:exception]\n end\n end\n true\n end",
"def with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def post_initialize(**opts)\n bind_queue_to_exchange_routing_keys\n super\n end",
"def bind_params(controller_class, topic)\n return if topic.batch_consuming\n controller_class.include SingleParams\n end",
"def bind_responders(controller_class, topic)\n return unless topic.responder\n controller_class.include Responders\n end",
"def bind_exchange_to_exchange(channel, exchange_in_name, queue_name, exchange_out_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_current = channel.queue(queue_name)\n queue_current.bind(exchange_source)\n exchange_output = channel.fanout(exchange_out_name)\n return queue_current, exchange_output\nend",
"def bind_backend(controller_class, topic)\n backend = Kernel.const_get(\"::Karafka::Backends::#{topic.backend.to_s.capitalize}\")\n controller_class.include backend\n end",
"def receive\n @subscriber.recv_strings( parts = [] )\n #log.debug \"a queue item [%s]\\n\", parts.join(' ')\n parts\n end",
"def task_retry_queue\n queue = channel.queue(TASK_RETRY_QUEUE, arguments: { 'x-dead-letter-exchange': TASK_EXCHANGE })\n queue.bind(task_retry_exchange) # done this way due to bug on the testing library where bind does not return self.\n queue\n end",
"def subscribe(worker)\n # If we've already got a bunny object, use it. This allows people to\n # specify all kinds of options we don't need to know about (e.g. for ssl).\n @bunny = @opts[:connection]\n @bunny ||= create_bunny_connection\n @bunny.start\n\n @channel = @bunny.create_channel\n @channel.prefetch(@opts[:prefetch])\n\n exchange_name = @opts[:exchange]\n @exchange = @channel.exchange(exchange_name, **@opts[:exchange_options])\n\n routing_key = @opts[:routing_key] || @name\n routing_keys = [*routing_key]\n\n handler_klass = worker.opts[:handler] || Sneakers::CONFIG.fetch(:handler)\n # Configure options if needed\n if handler_klass.respond_to?(:configure_queue)\n @opts[:queue_options] = handler_klass.configure_queue(@name, @opts)\n end\n\n queue = @channel.queue(@name, **@opts[:queue_options])\n\n if exchange_name.length > 0\n routing_keys.each do |key|\n if @opts[:bind_arguments]\n queue.bind(@exchange, routing_key: key, arguments: @opts[:bind_arguments])\n else\n queue.bind(@exchange, routing_key: key)\n end\n end\n end\n\n # NOTE: we are using the worker's options. This is necessary so the handler\n # has the same configuration as the worker. Also pass along the exchange and\n # queue in case the handler requires access to them (for things like binding\n # retry queues, etc).\n handler = handler_klass.new(@channel, queue, worker.opts)\n\n @consumer = queue.subscribe(block: false, manual_ack: @opts[:ack]) do | delivery_info, metadata, msg |\n worker.do_work(delivery_info, metadata, msg, handler)\n end\n nil\n end",
"def enable_queues(jndi_names = {})\n configuration.enabled_queues = jndi_names\n end",
"def setup_identity_queue\n # Explicitly create direct exchange and bind queue to it\n # since may be binding this queue to multiple exchanges\n queue = @amq.queue(@identity, :durable => true)\n binding = queue.bind(@amq.direct(@identity, :durable => true, :auto_delete => true))\n\n # A RightScale infrastructure agent must also bind to the advertise exchange so that\n # a mapper that comes up after this agent can learn of its existence. The identity\n # queue binds to both the identity and advertise exchanges, therefore the advertise\n # exchange must be durable to match the identity exchange.\n queue.bind(@amq.fanout('advertise', :durable => true)) if @options[:infrastructure]\n\n binding.subscribe(:ack => true) do |info, msg|\n begin\n info.ack\n receive_any(@serializer.load(msg))\n rescue Exception => e\n RightLinkLog.error(\"RECV #{e.message}\")\n @callbacks[:exception].call(e, msg, self) rescue nil if @callbacks && @callbacks[:exception]\n end\n end\n end",
"def unbind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_unbind(queue, exchange, binding_key, arguments: arguments)\n end\n end",
"def listen(&block)\n AMQP.start(:host => @host) do\n exchange = MQ.direct(@x_request)\n reply = MQ.direct(@x_response)\n queue = MQ.queue(@server_q)\n notify = MQ.fanout(@x_notify)\n \n puts \"request xchange =#{@x_request}\"\n puts \"reply xchange =#{@x_response}\"\n puts \"server queue =#{@server_q}\"\n \n @do_notify = proc do |msg|\n notify.publish(Blix.to_binary_data(msg))\n puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n end\n \n queue.bind( exchange).subscribe do |header,body|\n \n # extract the headers and create a transport for this\n # client. the reply_to field may be in the application\n # headers field so check for it there also.\n \n reply_to = header.reply_to || ( header.headers && header.headers[:reply_to])\n message_id = header.message_id || ( header.headers && header.headers[:message_id])\n \n if reply_to && message_id\n # process the call\n response = block && block.call(body)\n \n # publish the reply only if there is a response\n \n if response\n options = {}\n options[:key] = reply_to\n options[:message_id] = message_id\n data = Blix.to_binary_data(response)\n \n puts \"[AmqpServer] response: data=#{data}, options=#{options}\" if $DEBUG\n \n reply.publish(data, options )\n end\n else\n puts \"missing reply-to /message_id field .....#{header.inspect}\"\n end\n end\n \n# # send any notifications that are waiting.\n# while !@notify_queue.empty?\n# message = @notify_queue.pop\n# channel.fanout(@x_notify).publish(Blix.to_binary_data(message))\n# puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n# end\n end\n \n end",
"def listen\n consumers = input.map do |queue|\n consume queue\n end\n close_after consumers\n end",
"def activate!(keys: [])\n establish_bindings!\n keys.each { |key| add_routing_key(key) }\n end",
"def listen_queues(queues) #:nodoc:\n EM.run do\n exchanges = exchanges_for_queues(queues)\n create_exchanges(exchanges)\n bind_queues(queues)\n subscribe_queues(queues)\n yield if block_given?\n end\n end",
"def listen\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n run(route, args)\n end\n end\n \n loop do\n sleep 1\n end\n end\n end",
"def start\n # subscribe is like a callback\n @server_queue.subscribe(block: @block) do |delivery_info, properties, payload|\n consume(delivery_info, properties, payload)\n end\n end",
"def subscribe(name, config = {})\n return if subscriptions.has_key? name\n\n queue = @channel.queue(ns(name), {:auto_delete => true}.merge!(config))\n queue.bind(@exchange, :routing_key => ns(name)) \n\n queue.subscribe do |headers, payload|\n decoded = MP.unpack(payload)\n subscriptions[name].handlers.each do |h|\n h.receive(decoded[\"uuid\"], headers.type, decoded[\"msg\"])\n end\n end\n\n subscriptions[name] = HandlerCollection.new(queue, [])\n end",
"def start\n @provider_queue = AMQP::Channel.new(@connection, :auto_recovery => true).fanout(@room)\n @channel = AMQP::Channel.new(@connection, :auto_recovery => true)\n @channel.on_error(&method(:handle_channel_exception))\n @queue = @channel.queue(\"\", :auto_delete => true).bind(@room)\n @queue.subscribe(&method(:handle_message))\n end",
"def bind(exchange, opts = {})\n if exchange.respond_to?(:add_route)\n\n # we can do the binding ourselves\n exchange.add_route opts.fetch(:routing_key, @name), self\n else\n\n # we need the channel to look up the exchange\n @channel.xchg_bind self, opts.fetch(:routing_key, @name), exchange\n end\n\n self\n end",
"def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end",
"def on_receive_message(\n subscriber_klass,\n delivery_info,\n metadata,\n payload\n )\n logger.debug '**************************'\n logger.debug subscriber_klass.inspect\n logger.debug delivery_info.inspect\n logger.debug metadata.inspect\n logger.debug payload.inspect\n\n if delivery_info.routing_key\n routing_key = [app_name, delivery_info.routing_key].join(delimiter)\n executable = subscriber_klass.executable_for(routing_key)\n end\n\n unless executable\n routing_key = [app_name, exchange_name].join(delimiter)\n executable = subscriber_klass.executable_for(routing_key)\n end\n\n logger.debug \"routing_key: #{routing_key}\"\n return unless executable\n\n subscriber = subscriber_klass.new\n subscriber.channel = @subject.channel\n\n subscription_handler =\n EventSource::Protocols::Amqp::BunnyConsumerHandler.new(\n subscriber,\n delivery_info,\n metadata,\n payload,\n &executable\n )\n\n subscription_handler.run\n rescue Bunny::Exception => e\n logger.error \"Bunny Consumer Error \\n message: #{e.message} \\n backtrace: #{e.backtrace.join(\"\\n\")}\"\n ensure\n subscriber = nil\n end",
"def listen\n setup = lambda {\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n run(route, args)\n end\n end\n end\n }\n if EM.reactor_running?\n setup.call\n if EM.respond_to?(:reactor_thread)\n # EM 0.12.9+\n EM.reactor_thread.join\n else\n # EM 0.12.8\n EM.instance_variable_get(:@reactor_thread).join\n end\n else\n EM.run &setup\n end\n end",
"def activate_buffers_for_matching\n @triggers.keys.each do |pattern|\n debug \"checking #{@key_path} matches #{pattern}\"\n if JsonPath.matches?(@key_path, pattern) && !@active_buffers.keys.include?(pattern)\n debug \">> Activating buffer for #{pattern.inspect}\"\n @active_buffers[pattern] = ''\n end\n end\n end",
"def retrieve(key); @amq.queue(key); end",
"def bind\n EventMachine.run do\n Signal.trap(\"INT\") {\n WORLD.players.each {|p|\n WORLD.unregister(p)\n }\n \n while WORLD.work_thread.waiting > 0\n sleep(0.01)\n end\n \n EventMachine.stop if EventMachine.reactor_running?\n exit\n }\n \n Signal.trap(\"TERM\") {\n EventMachine.stop\n }\n \n EventMachine.start_server(\"0.0.0.0\", @config.port + 1, Calyx::Net::JaggrabConnection) if $cache\n EventMachine.start_server(\"0.0.0.0\", @config.port, Calyx::Net::Connection)\n @log.info \"Ready on port #{@config.port}\"\n end\n end",
"def queue_in\n @channel.queue('dns-in', durable: true)\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |header, body|\n value = YAML.load(body)\n yield value\n end\n end",
"def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n key, raw_msg = @redis_client.blpop(@redis_in_key, 0)\n json_msg = Crack::JSON.parse(raw_msg)\n # Send back a random quote\n random_quote = @quotes[rand(@quotes.size)]\n out_msg = {:from => json_msg['from'], :body => random_quote}.to_json\n # Pusing onto the \"out\" list queues up something for the listener to process\n @redis_client.lpush(@redis_out_key, out_msg)\n end\n end \n end",
"def handle(jid)\n iq = InfoQuery.set('id' => 'bind_1')\n iq << bind = Bind.new\n\n unless jid.resource.empty?\n bind << resource = Resource.new\n resource.content = jid.resource\n end\n\n jid.xmpp_handler.send_data(Presence.initial)\n end",
"def subscribe(message_name, &block)\n @subscriptions = {} if @subscriptions.nil?\n consumers = @subscriptions[message_name]\n consumers = [] if consumers.nil?\n consumers << block\n @subscriptions[message_name] = consumers\n @transport.bind message_name\n end",
"def listen2\n \n EM.run do\n AMQP.connect(:host => @host) do |connection |\n puts \"Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem...\"\n channel = AMQP::Channel.new(connection)\n exchange = channel.direct(@x_request)\n reply = channel.direct(@x_response)\n queue = channel.queue(@server_q)\n notify = channel.fanout(@x_notify)\n \n puts \"request xchange =#{@x_request}\"\n puts \"reply xchange =#{@x_response}\"\n puts \"server queue =#{@server_q}\"\n \n # listen for rpc requests on the server queue\n #\n queue.bind( exchange).subscribe do |header,body|\n \n # extract the headers and create a transport for this\n # client. the reply_to field may be in the application\n # headers field so check for it there also.\n \n reply_to = header.reply_to || ( header.headers && header.headers[:reply_to])\n message_id = header.message_id || ( header.headers && header.headers[:message_id])\n \n if reply_to && message_id\n # process the call\n response = do_handle(body)\n \n # publish the reply only if there is a response\n \n if response\n options = {}\n options[:key] = reply_to\n options[:message_id] = message_id\n data = Blix.to_binary_data(response)\n \n puts \"[AmqpServer] response: data=#{data}, options=#{options}\" if $DEBUG\n \n reply.publish(data, options )\n end\n else\n puts \"missing reply-to /message_id field .....\"\n pp header\n end\n end #subscribe\n \n # send any notifications that are waiting.\n while !@notify_queue.empty?\n message = @notify_queue.pop\n channel.fanout(@x_notify).publish(Blix.to_binary_data(message))\n puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n end\n end #connection\n end # EM\n \n end",
"def deliver(payload, opts, key)\n\n # escape periods with backslash for regex\n key = key.gsub('.', '\\.')\n\n # replace single wildcards with regex for a single domain\n key = key.gsub(SINGLE_WILDCARD, '(?:\\w+)')\n\n # replace multi wildcards with regex for many domains separated by '.'\n key = key.gsub(MULTI_WILDCARD, '\\w+\\.?')\n\n # turn key into regex\n key = Regexp.new(key)\n\n @routes.each do |route, destination|\n destination.publish(payload, opts) if route =~ key\n end\n end",
"def publish(routing_key, payload = {}, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n bind_queue(routing_key) if options[:bind_to_queue]\n @exchange.publish(MultiJson.dump(payload), routing_key: routing_key, persistent: true)\n end",
"def broadcast message\n @clients.keys.each do |key|\n notify key, message\n end\n end",
"def bind address\n begin\n @bindings << address\n @raw_socket.bind address.to_s\n true\n rescue ZMQ::ZeroMQError\n @bindings.pop\n false\n end\n end",
"def exchange_bind(destination, source, binding_key, arguments: {})\n write_bytes FrameBytes.exchange_bind(@id, destination, source, binding_key, false, arguments)\n expect :exchange_bind_ok\n nil\n end",
"def resolve_queue(key)\n\t\twaiting = request_queue.select { |req| req.key == key.to_i }\n\t\twaiting.each do |w|\n\t\t\tputs \"resolving queue #{request_queue}\"\n\t\t\tsend_message [\"PUT\", key, resource_table[key][0]], 0, w.host, w.port\n\t\t\trequest_queue - [w]\n\t\tend\n\tend",
"def subscribe(routing_key, options = {}, &block)\n q = bind_queue(routing_key)\n options = options.merge(manual_ack: true)\n\n q.subscribe(options) do |delivery_info, metadata, payload|\n block.call(delivery_info, metadata, payload)\n @channel.ack(delivery_info.delivery_tag)\n end\n end",
"def setup_queue(consumer)\n logger.info \"setting up queue: #{consumer.get_queue_name}\"\n\n queue = @broker.queue(consumer.get_queue_name, consumer.get_options)\n @broker.bind_queue(queue, consumer.routing_keys)\n\n queue.subscribe(consumer_tag: unique_consumer_tag, manual_ack: true) do |*args|\n delivery_info, properties, payload = Hutch::Adapter.decode_message(*args)\n handle_message(consumer, delivery_info, properties, payload)\n end\n end",
"def listen\n EM.run do\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n begin\n run(route, args)\n rescue\n logger.error(\"EventmachineSubscriber listen error on #{route}: #{$!}\")\n end\n end\n end\n end\n end\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |value|\n yield value\n end\n end",
"def listen_queues(*queues, &block)\n queues = determine_queue_names(queues)\n subscriber.listen_queues(queues, &block)\n end",
"def receive_message(params={}, *attrs)\n self.class.receive_message(queue_url, params, *attrs).map do |val|\n Message.new self, val\n end\n end",
"def queue_unbind(name, exchange, binding_key, arguments: {})\n write_bytes FrameBytes.queue_unbind(@id, name, exchange, binding_key, arguments)\n expect :queue_unbind_ok\n nil\n end",
"def receives_messages\n Messenger.resolve(@@default_messenger).add_message_handler do |message|\n new.received(message)\n end\n end",
"def subscribe\n @conn.subscribe(@queue_name, @headers)\n @@log.debug(\"subscribe to: #{@queue_name}\")\n @@log.debug(\"headers: #{@headers.inspect}\")\n end",
"def broadcasting_to_configured_subscribers\n subscribers = Renalware.config.broadcast_subscription_map[self.class.name]\n Array(subscribers).each{ |listener|\n subscribe(listener.to_s.constantize.new)\n }\n self\n end",
"def subscribe \n @subscription = MQ.new\n @subscription.queue(@uuid).bind(@subscription.fanout('global_history')).subscribe do |result|\n x = Mash.new(JSON::parse(result))\n puts \"received: #{x[:uuid]} #{x[:user]}@#{x[:host]}$ #{x[:message]}\"\n if x[:uuid] != @uuid\n @pause = true\n File.open(path, \"a\") {|f| f.puts(x[:message])}\n skip_ahead\n @pause = false\n schedule_next_read\n end\n end\n end",
"def trigger_block_for_matching\n active_patterns = @active_buffers.keys\n active_patterns.each do |pattern|\n if JsonPath.matches?(@key_path, pattern)\n debug \"<< Calling trigger for '#{pattern}' when at #{@key_path}\"\n @triggers[pattern].call @active_buffers[pattern]\n if pattern[-3..3] == '[*]'\n @active_buffers[pattern] = ''\n debug \"Clearing buffer for '#{pattern}'\"\n else\n @active_buffers.delete(pattern)\n debug \"Stopping buffer for '#{pattern}'\"\n end\n end\n end\n end",
"def listen(p0) end",
"def listen(p0) end",
"def listen(p0) end",
"def receive_messages\n begin\n resp = @sqs.receive_message(\n message_attribute_names: PIPE_ARR,\n queue_url: @settings[:consuming_sqs_queue_url],\n wait_time_seconds: @settings[:wait_time_seconds],\n max_number_of_messages: @settings[:max_number_of_messages],\n )\n resp.messages.select do |msg|\n # switching whether to transform the message based on the existance of message_attributes\n # if this is a raw SNS message, it exists in the root of the message and no conversion is needed\n # if it doesn't, it is an encapsulated messsage (meaning the SNS message is a stringified JSON in the body of the SQS message)\n begin\n if !msg.key? 'message_attributes'\n # extracting original SNS message\n tmp_body = JSON.parse msg.body\n # if there is no Message, this isn't a SNS message and something has gone terribly wrong\n next if tmp_body.key? 'Message'\n # replacing the body with the SNS message (as it would be in a raw delivered SNS-SQS message)\n msg.body = tmp_body['Message']\n msg.message_attributes = {}\n # discarding messages without attributes, since this would lead to an exception in subscribe\n next if tmp_body.key? 'MessageAttributes'\n # parsing the message_attributes\n tmp_body['MessageAttributes'].each do |name, value|\n msg.message_attributes[name] = Aws::SQS::Types::MessageAttributeValue.new\n msg.message_attributes[name].string_value = value['Value']\n msg.message_attributes[name].data_type = 'String'\n end\n end\n msg\n rescue JSON::JSONError => e\n self.logger.info(e)\n end\n end\n rescue Aws::SQS::Errors::ServiceError => e\n self.logger.info(e)\n end\n end",
"def bind\n binding\n end",
"def enable_topics(jndi_names = {})\n configuration.enabled_topics = jndi_names\n end",
"def retrieve(key)\n @amq.queue(key)\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def release(wait = false)\n return unless bindings.any?\n\n log(:debug) { \"Release all bindings#{wait ? ' after queues are empty': ''}...\" }\n\n if wait\n binds = bindings.dup\n while binds.any?\n binds.reject! { |b| b.release_if_empty }\n sleep 1\n end\n else\n bindings.each &:release\n end\n\n log(:debug) { 'All bindings released.' }\n end",
"def subscribe(subscribes = [], queue_name = nil, subscribe_interval=10)\n return nil if subscribes.empty?\n\n # start listening on our queue\n queue = sqs.queue(queue_name)\n listener = QueueListener.new(queue)\n avail_proc = AvailabilityProcessor.new\n avail_proc.availability_changed = Proc.new do |availability_processor|\n info { \"Availability Changed! New list is:\\n #{availability_processor.all_available(false, true).inspect}\" }\n debug { \"received availability message #{availability_processor}\" }\n actions.each do |action|\n begin\n action.invoke(availability_processor)\n rescue Exception => ex\n error \"Error calling action #{action.inspect} with #{availability_processor.inspect}\", ex\n end\n end\n end\n listener.add_processor(avail_proc)\n listener_thread = listener.listen\n \n subscribe_thread = Thread.new do\n while true \n # subscribe to all the services we're interested in\n begin\n sub_msg = SubscriptionMessage.new(subscribes, queue_name, true)\n debug{ \"sending subscription message #{sub_msg.inspect}\" }\n send_message(monitor_queue, sub_msg)\n debug{ \"sleeping for #{subscribe_interval}s\" }\n sleep subscribe_interval\n rescue Exception => ex\n error \"Error sending subscription message: #{sub_msg.inspect}\", ex\n end\n end\n end\n \n return subscribe_thread\n end",
"def connect\n @filters.each do |filter|\n @sub_sock.setsockopt ZMQ::SUBSCRIBE, filter\n end\n @sub_sock.connect @sub_addr\n @dealer_sock.connect @dealer_addr\n end",
"def messages_queue\n $messages_queue ||= client.queue(\"messages\", :durable => true, :auto_delete => false)\nend",
"def subscribe_queue(name, opts = {})\n # TBD: here and analogously; only push in self and dynamically call native_client?(:mq)\n R8QueueMQ.new(self, name, opts)\n end",
"def handler_bind?\n payload_instance && payload_instance.connection_type == 'bind'\n end",
"def handler\r\n\t loop do \r\n\t socket = @rqueue.pop\r\n\t req = Request.new socket \r\n\t if req.broadcast == true\r\n\t handle_broadcast req \r\n\t else\r\n\t handle_listen req\r\n\t end\r\n\t \r\n\t end\r\n \tend",
"def setup\n EM.kqueue\n #AMQP.logging = true\n @mq = MQ.new\n @requests = @mq.queue('jesus_nut',:auto_delete => true)\n @setup = true\n @mq.queue(@reply_to).subscribe { |info, response|\n resp = Marshal.load response\n callback = @pending.delete info.message_id\n callback.call resp\n }\n @id = 1\n end"
] |
[
"0.6100264",
"0.6064155",
"0.585651",
"0.57221574",
"0.57204074",
"0.5716468",
"0.56840163",
"0.5672507",
"0.56591094",
"0.56452554",
"0.55498654",
"0.54506236",
"0.5443892",
"0.54202586",
"0.53896064",
"0.53474516",
"0.5308581",
"0.5288042",
"0.5280886",
"0.5279132",
"0.52065396",
"0.5196274",
"0.5163999",
"0.5160959",
"0.51309276",
"0.512427",
"0.51016474",
"0.50983953",
"0.50856024",
"0.5085042",
"0.5059288",
"0.5052139",
"0.5019255",
"0.49755523",
"0.49480495",
"0.48830837",
"0.48509392",
"0.48403937",
"0.48202854",
"0.48080707",
"0.4795425",
"0.4792814",
"0.47869998",
"0.47721446",
"0.47704756",
"0.47591156",
"0.47589803",
"0.4757817",
"0.475089",
"0.47473097",
"0.46912232",
"0.46824268",
"0.4679786",
"0.4659524",
"0.46467954",
"0.46327618",
"0.46251118",
"0.45924672",
"0.4587933",
"0.45632732",
"0.45594084",
"0.45545748",
"0.45507982",
"0.45457622",
"0.45428854",
"0.45364267",
"0.45306268",
"0.4514142",
"0.45124522",
"0.44953442",
"0.44924107",
"0.44897822",
"0.44870493",
"0.44780126",
"0.44703284",
"0.4463998",
"0.4461631",
"0.44536215",
"0.44514006",
"0.44262296",
"0.44241866",
"0.44209987",
"0.44165963",
"0.4413669",
"0.43961185",
"0.43961185",
"0.43961185",
"0.43900955",
"0.43851236",
"0.43780836",
"0.43757746",
"0.43653506",
"0.43649492",
"0.43595025",
"0.43557188",
"0.43440953",
"0.4333016",
"0.4327752",
"0.43188417",
"0.43151042"
] |
0.7205004
|
0
|
Export Initializer Use any of the public class methods to create objects of this type.
|
def initialize(export_id)
@export_id = export_id
@status = nil
@export_uri = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\r\n init_public_members\r\n init_private_members\r\n end",
"def init\n raise NotImplementedError\n end",
"def initialize() end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\n \n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize\n puts \"constructor is automatically called when we create object\"\n end",
"def initialize\n init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def constructor; end",
"def init\n\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def instantiate!; end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize\r\n\r\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n @awesome_methods = {}\n \n # Check if we're bootstraping. During this process\n # the runtime is not fully initialized and core classes\n # do not yet exists, so we defer setting the object class\n # once this is all done.\n # This solves the chiken and egg problem with the Class class.\n # We can initialize Class then set Class.class = Class.\n if defined?(Runtime)\n awesome_class = Runtime[\"Class\"]\n else\n awesome_class = nil\n end\n \n super(awesome_class)\n end",
"def Init()\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize(obj); end",
"def initialize()\r\n\r\n end",
"def initialize\n\t\t\n\tend",
"def initialize\n @canadian_methods = {}\n\n if defined?(Runtime)\n can_class = Runtime[\"Class\"]\n else\n can_class = nil\n end\n\n super(can_class)\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def init; end",
"def initialize(type, *args, &block)\n super(type, *args)\n @init = block\n end",
"def initialize\n end",
"def initialize(*_)\n super\n end",
"def initialize()\n\t\tend",
"def initialize(*args) #:nodoc:\n end",
"def initialize\n end",
"def initialize()\n end",
"def initialize()\n end",
"def init\n self\n end",
"def initialize(*)\n end",
"def initialize(*)\n end",
"def initialize(*args); end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize(*args)\n end",
"def initialize()\n\tend",
"def initialize()\n\tend",
"def initialize( * )\n super\n end",
"def initialize()\n\n end",
"def initialize(_config)\n raise NotImplementedError, \"must implement ##{__method__}\"\n end",
"def initialize(owner_class, *args, &block); end",
"def initialize(exporter)\n @exp = exporter\n end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def initialize\n # nothing here for now\n end",
"def initialize\n\n\n\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(options = {})\n init(options)\n end"
] |
[
"0.720919",
"0.6896945",
"0.6868468",
"0.6826983",
"0.6826983",
"0.6826983",
"0.67676944",
"0.67565286",
"0.67565286",
"0.67565286",
"0.67565286",
"0.6733173",
"0.6733173",
"0.6733173",
"0.6733173",
"0.6733173",
"0.67271936",
"0.6721972",
"0.66665405",
"0.6632977",
"0.6632977",
"0.66212493",
"0.6594507",
"0.65746325",
"0.6541081",
"0.6541081",
"0.6541081",
"0.6541081",
"0.6541081",
"0.6541081",
"0.6541081",
"0.6541081",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.65110403",
"0.6504664",
"0.6476778",
"0.6476778",
"0.64752924",
"0.64644265",
"0.64644265",
"0.64644265",
"0.64644265",
"0.64644265",
"0.64644265",
"0.64404434",
"0.6437487",
"0.641998",
"0.641998",
"0.641998",
"0.641998",
"0.641998",
"0.641998",
"0.641998",
"0.641998",
"0.641998",
"0.64183986",
"0.64174664",
"0.6417392",
"0.6399793",
"0.63784045",
"0.63784045",
"0.63783693",
"0.6359737",
"0.6353093",
"0.6349213",
"0.6348033",
"0.6347958",
"0.6335209",
"0.6298427",
"0.6298427",
"0.6297771",
"0.62773037",
"0.62773037",
"0.6256763",
"0.6253675",
"0.6253551",
"0.6249492",
"0.6249492",
"0.62472105",
"0.62429196",
"0.62378395",
"0.6234277",
"0.62185574",
"0.62177217",
"0.62177217",
"0.6199068",
"0.6192865",
"0.6184783",
"0.618263",
"0.618263",
"0.618263",
"0.6178378"
] |
0.0
|
-1
|
Instance implementation of the Sa::Export.status method that also sets the export_uri if the status is :complete
|
def status
unless @status == :complete || @status == :error || @status == :failure
status_response = self.class.status(@export_id)
@status = convert_status(status_response['Status'])
update_export_uri(status_response) if @status == :complete
end
@status
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_export_status\n update_status(:export)\n end",
"def set_status\n @completed = @progress == @number\n end",
"def completed\n @status = 'complete'\n end",
"def complete!(status)\n fail(AlreadyCompleteError) if complete?\n\n update!(\n completed_at: Time.now.utc,\n completion_status: status\n )\n end",
"def status=(status)\n @_status = status\n end",
"def status=(status)\n @_status = status\n end",
"def export_job\n return nil if completed?\n export_sie = Services::ExportSie.new(self)\n if export_sie.create_file(sie_type)\n logger.info \"** sie_export #{id} create_file returned ok, marking complete\"\n complete\n else\n logger.info \"** sie_export #{id} create_file did NOT return ok, not marking complete\"\n end\n end",
"def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end",
"def status=(status); end",
"def status\n complete? ? 'Completed' : 'Failed'\n end",
"def export_job\n return nil if completed?\n export_bank_file = Services::ExportBankFileCreator.new(self)\n if export_bank_file.read_and_create_file\n logger.info \"** ExportBankFile #{id} read_and_create returned ok, marking complete\"\n complete\n else\n logger.info \"** ImportBankFile #{id} parse/import did NOT return ok, not marking complete\"\n end\n end",
"def export_status(scan_id, file_id)\n request.get({ path: \"/scans/#{scan_id}/export/#{file_id}/status\", headers: headers })\n end",
"def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"def initialize(export_id)\n @export_id = export_id\n @status = nil\n @export_uri = nil\n end",
"def update_job_status(status)\n @csv_report_job.status = status\n @csv_report_job.save!\n end",
"def complete?\n status == \"Completed\"\n end",
"def complete?\n\tstatus == \"Completed\"\n end",
"def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def mark_complete\n if self.completed\n self.progress = \"COMP\"\n self.progress_percentage = \"100\"\n elsif self.progress and !self.progress.eql?('COMP') and self.progress_percentage\n self.progress = self.progress\n self.progress_percentage = self.progress_percentage\n else\n self.progress = \"INPR\"\n self.progress_percentage = \"0\"\n end\n end",
"def set_export_status\n pass_query_params\n id = params[:id].to_s\n type = params[:type].to_s\n value = params[:value].to_s\n model_class = type.camelize.safe_constantize\n if !reviewer?\n flash_error(:runtime_admin_only.t)\n redirect_back_or_default(\"/\")\n elsif !model_class ||\n !model_class.respond_to?(:column_names) ||\n !model_class.column_names.include?(\"ok_for_export\")\n flash_error(:runtime_invalid.t(type: '\"type\"', value: type))\n redirect_back_or_default(\"/\")\n elsif !value.match(/^[01]$/)\n flash_error(:runtime_invalid.t(type: '\"value\"', value: value))\n redirect_back_or_default(\"/\")\n elsif (obj = find_or_goto_index(model_class, id))\n obj.ok_for_export = (value == \"1\")\n obj.save_without_our_callbacks\n if params[:return]\n redirect_back_or_default(\"/\")\n else\n controller = params[:return_controller] || obj.show_controller\n action = params[:return_action] || obj.show_action\n redirect_with_query(controller: controller,\n action: action, id: id)\n end\n end\n end",
"def status\n return nil if digital_object_imports.empty?\n\n if digital_object_imports.all?(&:successful?)\n COMPLETED\n elsif imports_finished_with_failures?\n COMPLETED_WITH_ERRORS\n elsif digital_object_imports.all?(&:queued?)\n QUEUED\n else\n IN_PROGRESS\n end\n end",
"def complete!\n self.status = 'completed'\n self.save\n end",
"def complete!\n status \"Success\"\n self\n end",
"def done\n @status = true\n end",
"def complete\n @status = :ok\n do_stop\n log_complete\n end",
"def complete!\n return if completed?\n self.status = \"complete\"\n self.stop = Time.now.to_s\n end",
"def complete?\n self.status == STATUS[:complete] \n #self.status == 1\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def set_status(val)\n self.status = val\n self\n end",
"def update_status\n save_csv\n end",
"def finished(status)\n @end_time = Time.now\n if status.success?\n @dfr.succeed(self)\n else\n @dfr.fail(self)\n end\n end",
"def done!(status = 0)\n @completed_at = Time.now\n @exitstatus = status\n save\n end",
"def setStatus( status )\n\t\t\tif @options.status.include?( status )\n\t\t\t\[email protected] = status\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tfalse\n\t\tend",
"def status(*args)\n @status = args.first unless args.empty?\n @status || 200\n end",
"def on_complete(status, _params)\n puts \"#{status.total} was processed\"\n end",
"def set_status(status_code, fetch = false)\n case status_code\n when /1../\n @status = :running\n when \"200\"\n @status = :completed\n fetch_result if fetch\n when /4../\n @status = :error\n end\n end",
"def extend_status(_status)\n end",
"def update_done\n self.done = true if COMPLETE_STATUSES.include? self.detailed_status\n end",
"def status=(status)\n @content[0] = status\n end",
"def export\n url = \"#{self.url}/export?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['export_count'], response['error_count']\n end\n return status, 0, 0\n end",
"def complete?\n %w[success failure exception].include?(status)\n end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status; end",
"def status\n fetch(@config[:finance_path], 'Finance.getStatus')\n end",
"def status\n ::HubEdos::Common::Reference::Descriptor.new(@data['status']) if @data['status']\n end",
"def status\n unless source.nil? or source.empty?\n refresh_status\n else\n self.description = \"Status is currently unavailable\"\n end\n self.description.first\n end",
"def status\n return :completed if completed?\n return :failed if failed?\n :pending\n end",
"def project_status_setter(status)\n if ['Proposed', 'Suspended', 'Postponed',\n 'Cancelled', 'In progress'].include? status\n self.status = status\n save\n else\n false\n end\n end",
"def set_status\n self.status = 1\n end",
"def handle_download_result success\n self.downloading = false\n self.pid = nil\n \n if success\n self.failed = false\n self.downloaded = true\n self.downloaded_at = DateTime.now\n else\n self.failed = true\n end \n \n self.save!\n return success\n end",
"def status\n @status ||= if File.readable?(@status_path)\n Status.from(JSON(File.read(@status_path)))\n else\n Status.stopped\n end\n @status.error = @error\n @status\n end",
"def complete?\n status_code == 'OK'\n end",
"def status\n @transfer[:status]\n end",
"def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end",
"def set_export_status # :norobots:\n pass_query_params\n id = params[:id].to_s\n type = params[:type].to_s\n value = params[:value].to_s\n model = type.camelize.safe_constantize\n if !is_reviewer?\n flash_error(:runtime_admin_only.t)\n redirect_back_or_default(\"/\")\n elsif !model ||\n !model.respond_to?(:column_names) ||\n !model.column_names.include?(\"ok_for_export\")\n flash_error(:runtime_invalid.t(type: '\"type\"', value: type))\n redirect_back_or_default(\"/\")\n elsif !value.match(/^[01]$/)\n flash_error(:runtime_invalid.t(type: '\"value\"', value: value))\n redirect_back_or_default(\"/\")\n elsif (obj = find_or_goto_index(model, id))\n obj.ok_for_export = (value == \"1\")\n obj.save_without_our_callbacks\n if params[:return]\n redirect_back_or_default(\"/\")\n else\n controller = params[:return_controller] || obj.show_controller\n action = params[:return_action] || obj.show_action\n redirect_with_query(controller: controller,\n action: action, id: id)\n end\n end\n end",
"def downloading?\n attributes['status'] == 4\n end",
"def status_enum=(status)\n write_attribute(:status, status)\n end",
"def status=(status)\n check_exists\n oldstatus = SideJob.redis.getset(\"#{redis_key}:status\", status)\n if oldstatus != status && worker_config['status_publish'] != false\n SideJob::Port.group(log: false) do\n publish({status: status})\n end\n end\n end",
"def status(*) end",
"def status st=nil\n @status = st if st\n @status ||= 200 #TODO: replace with constants or Kiwi.status[:OK]\n end",
"def completion_status\n @attributes['status']\n end",
"def setup_redirection(status, uri)\n case status\n when Fixnum\n if status < 300 || 400 <= status\n raise ArgumentError, \"unexpected status: #{status.inspect}\"\n end\n status = \"#{status} #{StatusMessage[status]}\"\n when String\n unless /\\A3\\d\\d(\\z| )/ =~ status\n raise ArgumentError, \"unexpected status: #{status.inspect}\"\n end\n if status.length == 3\n status = \"#{status} #{StatusMessage[status.to_i]}\"\n end\n else\n raise ArgumentError, \"unexpected status: #{status.inspect}\"\n end\n case uri\n when URI\n uri = @urigen.base_uri + uri if uri.relative?\n when String\n uri = URI.parse(uri)\n uri = @urigen.base_uri + uri if uri.relative?\n when Hash\n uri = make_absolute_uri(uri)\n else\n raise ArgumentError, \"unexpected uri: #{uri.inspect}\"\n end\n @response.status_line = status\n @response_header.set 'Location', uri.to_s\n end",
"def exportURL=(value)\n\t\t\t@exportURL = value\n\t\tend",
"def get_completion_status()\n return @status\n end",
"def completed?\n self.status_sym == :completed\n end",
"def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end",
"def status\n raise @invalid_uri_error if invalid_uri_error?\n raise @fetch_error if fetch_error\n @status || String.new\n end",
"def mark_as_done!\n @status = :finished\n end"
] |
[
"0.73684883",
"0.6537465",
"0.6429914",
"0.6271995",
"0.6219826",
"0.6219826",
"0.620508",
"0.6158405",
"0.6135277",
"0.6109822",
"0.59734446",
"0.59588677",
"0.5956634",
"0.59516364",
"0.5937469",
"0.59373575",
"0.59341425",
"0.5894204",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5858118",
"0.5856753",
"0.58156174",
"0.5803165",
"0.5785723",
"0.5773901",
"0.57673293",
"0.573206",
"0.5727354",
"0.57238686",
"0.56985265",
"0.568868",
"0.568868",
"0.5681103",
"0.5667364",
"0.56461984",
"0.5639705",
"0.56353605",
"0.56314576",
"0.5630344",
"0.5613554",
"0.560249",
"0.55990535",
"0.559285",
"0.556563",
"0.5559496",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55467623",
"0.55190116",
"0.55179405",
"0.5509666",
"0.5505936",
"0.5502857",
"0.54940695",
"0.54819477",
"0.54804826",
"0.5476164",
"0.54759806",
"0.54672164",
"0.5467161",
"0.5458551",
"0.54493773",
"0.54475003",
"0.54452276",
"0.5444503",
"0.54383534",
"0.54198617",
"0.5419235",
"0.541246",
"0.5411102",
"0.5405853",
"0.53906256",
"0.53871423"
] |
0.834727
|
0
|
Convert YourMembership API codes to readable symbols
|
def convert_status(status)
case status
when '-1'
return :failure
when '0'
return :unknown
when '1'
return :working
when '2'
return :complete
else
return :error
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\r\n @code.to_s.upcase\r\n end",
"def to_s\n \"#{codepoint} (#{name})\"\n end",
"def lookup_code_string\r\n \"@lookup_codes = #{lookup_codes.to_s}\"\r\n end",
"def to_s\n \"#{@name} \\[#{@unlocode}]\"\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def yy_unicode_s(char_code)\n \"U+#{\"%04X\" % char_code}\"\n end",
"def printed_sales_return_code\n self.code.gsub('/','-')\n end",
"def to_s\n code.to_s\n end",
"def user_name_with_api\n \"#{user_name} #{apiname_with_brackets}\"\n end",
"def user_name_with_api\n \"#{user_name} #{apiname_with_brackets}\"\n end",
"def to_s\n \"#{symbol}\"\n end",
"def to_s\r\n code \r\n end",
"def printed_code\n self.code.gsub('/','-')\n end",
"def printed_code\n self.code.gsub('/','-')\n end",
"def to_s\n \"#{p1} \\u{2192} #{p2}\"\n end",
"def locode\n \"#{country_code.to_s} #{city_code.to_s}\".strip\n end",
"def short_code\n id.to_s 36\n end",
"def to_s\n '<Twilio.Oauth.V1.DeviceCodePage>'\n end",
"def string=(code); end",
"def name\n return \"#{@code}\"\n end",
"def to_s\n @code.to_s\n end",
"def code\n '202'\n end",
"def sic_code; end",
"def to_label \n \"#{code}\"\n end",
"def format\n spacify(postcode.upcase)\n end",
"def card_verification\n card[:verification].to_s\n end",
"def to_s\n return \"<P:#{self.given_name}_#{@code.to_s(36)}_#{@position}>\"\n end",
"def to_s\n\t\t\"#{@api_hash}\"\n\tend",
"def human_code(code)\n case code\n when 'ADM1' then :region\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end",
"def human_code(code)\n case code\n when 'ADM1' then :province\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end",
"def tuc(arg)\n h = Hash.[](\".\"=>\"་\", \"/\"=>\"།\", \";\"=>\"༔\", \"\"=>\"\",\n \"ka\"=>\"ཀ\", \"kha\"=>\"ཁ\", \"ga\"=>\"ག\", \"nga\"=>\"ང\",\n \"ca\"=>\"ཅ\", \"cha\"=>\"ཆ\", \"ja\"=>\"ཇ\", \"nya\"=>\"ཉ\",\n \"ta\"=>\"ཏ\", \"tha\"=>\"ཐ\", \"da\"=>\"ད\", \"na\"=>\"ན\",\n \"pa\"=>\"པ\", \"pha\"=>\"ཕ\", \"ba\"=>\"བ\", \"ma\"=>\"མ\",\n \"tsa\"=>\"ཙ\", \"tsha\"=>\"ཚ\", \"dza\"=>\"ཛ\", \"wa\"=>\"ཝ\",\n \"zha\"=>\"ཞ\", \"za\"=>\"ཟ\", \"'a\"=>\"འ\", \"ya\"=>\"ཡ\",\n \"ra\"=>\"ར\", \"la\"=>\"ལ\", \"sha\"=>\"ཤ\", \"sa\"=>\"ས\",\n \"ha\"=>\"ཧ\", \"a\"=>\"ཨ\",\n # numbers !!! better include number_generator\n \"0\"=>\"༠\", \"1\"=>\"༡\", \"2\"=>\"༢\", \"3\"=>\"༣\",\n \"4\"=>\"༤\", \"5\"=>\"༥\", \"6\"=>\"༦\", \"7\"=>\"༧\",\n \"8\"=>\"༨\", \"9\"=>\"༩\",\n # vowel signs\n \".e\"=>\"ེ\", \".i\"=>\"ི\", \".o\"=>\"ོ\", \".u\"=>\"ུ\",\n # double vowel signs\n \"E\" => \"ཻ\", \"O\" => \"ཽ\",\n # subscribed characters\n \"x_ka\"=>\"ྐ\", \"x_kha\"=>\"ྑ\", \"x_ga\"=>\"ྒ\", \"x_nga\"=>\"ྔ\",\n \"x_ca\"=>\"ྕ\", \"x_cha\"=>\"ྖ\", \"x_ja\"=>\"ྗ\", \"x_nya\"=>\"ྙ\",\n \"x_ta\"=>\"ྟ\", \"x_tha\"=>\"ྐ\", \"x_da\"=>\"ྡ\", \"x_na\"=>\"ྣ\",\n \"x_pa\"=>\"ྤ\", \"x_pha\"=>\"ྥ\", \"x_ba\"=>\"ྦ\", \"x_ma\"=>\"ྨ\",\n \"x_tsa\"=>\"ྩ\", \"x_tsha\"=>\"ྪ\", \"x_dza\"=>\"ྫ\", \"x_wa\"=>\"ྭ\",\n \"x_zha\"=>\"ྮ\", \"x_za\"=>\"ྯ\", \"x_'a\"=>\"ཱ\", \"x_ya\"=>\"ྱ\",\n \"x_ra\"=>\"ྲ\", \"x_la\"=>\"ླ\", \"x_sha\"=>\"ྴ\", \"x_sa\"=>\"ྶ\",\n \"x_ha\"=>\"ྷ\", \"x_a\"=>\"ྸ\",\n # superscribed character\n \"ra_x\"=>\"ར\",\n # revered letters\n \"Ta\"=>\"ཊ\", \"Tha\" => \"ཋ\", \"Da\" => \"ཌ\", \"Na\" => \"ཎ\",\n \"Sha\" => \"ཥ\")\n\n result = h[arg]\n if result != nil\n erg = result\n else\n erg = \"\"\n end\n return erg\n end",
"def to_s\n if SUIT_UNICODE_OK \n return self.unicode\n else\n return self.symbol\n end \n end",
"def name_with_code\n \"#{self.name}, #{self.code}\"\n end",
"def unichr(code_point)\n [code_point].pack(\"U\")\n end",
"def iban_country_code; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def country_codes; end",
"def auth_code\n unescape params['x_auth_code']\n end",
"def iso_code; end",
"def iso_code; end",
"def code_name(code)\n Codes.code_symbol(code)\n end",
"def to_s \n self.symbol\n end",
"def api_name\n to_s.split('::').last.gsub(/[^\\A]([A-Z])/, '_\\\\1').downcase\n end",
"def kramdown_conversion_method_name\n :to_kramdown_repositext\n end",
"def to_s\n if message && !message.empty? && message.downcase != MAP[code]\n \"#{message} (#{MAP[code]}, #{code})\"\n else\n \"#{MAP[code]} (#{code})\"\n end\n end",
"def unicode_names; end",
"def std_fips_code\n fips_code.to_s.rjust(2, '0')\n end",
"def qualified_code\n team_id = team.code unless team.instance_of? Center\n \"%04d\" % center.code + \"-\" + \"%04d\" % team_id # team.code.to_s.rjust(3, \"0\")\n end",
"def symbol\n codepoints.pack(\"U*\")\n end",
"def to_human\n fields.map { |m| '%02x' % self[m] }.join(':')\n end",
"def id_to_code(id)\n (id.to_i * factor + pad).to_s(26).tr('0-9a-p', 'a-z')\n end",
"def apdata\n \"#{name_rus}, #{iata_code}, г.#{city_rus} (#{city_eng})\"\n end",
"def update_code\n elements = [flexeme_type.tag.to_s]\n elements << gender.tag.to_s if gender\n elements += suffixes\n self.code = (Digest::SHA2.new << elements.join(\":\")).hexdigest[0...6]\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 api_key\n api_key_div.text.gsub(/API Key:/,'').gsub(/\\(create\\)/,'').gsub(/\\(delete\\)/,'').strip\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 description_and_code\n \"#{self.description} (#{self.code})\"\n end",
"def phonetic_code\n self.to_s.phonetic_code\n end",
"def force_twilio_ucs2_encoding(message)\n punctuation_space = \"\\u{2008}\"\n \"#{message}#{punctuation_space}\"\n end",
"def to_s\n\t\t\"#{@name} <email: #{@email}> acct: #{hidden_digits(@deposit_account)}\"\n\tend",
"def to_s\n if @code.count < 13\n @code.join + @check_digit.to_s\n else\n @code.join\n end\n end",
"def inspect\n inspected = super\n\n # mask password\n inspected = inspected.gsub! @password, \"*******\" if @password\n # Only show last 4 of token, secret\n if @access_token\n inspected = inspected.gsub! @access_token, \"#{'*'*36}#{@access_token[36..-1]}\"\n end\n if @client_secret\n inspected = inspected.gsub! @client_secret, \"#{'*'*36}#{@client_secret[36..-1]}\"\n end\n\n inspected\n end",
"def inspect\n inspected = super\n\n # mask password\n inspected = inspected.gsub! @password, \"*******\" if @password\n # Only show last 4 of token, secret\n if @access_token\n inspected = inspected.gsub! @access_token, \"#{'*'*36}#{@access_token[36..-1]}\"\n end\n if @client_secret\n inspected = inspected.gsub! @client_secret, \"#{'*'*36}#{@client_secret[36..-1]}\"\n end\n\n inspected\n end",
"def to_s\n return self.symbol\n end",
"def code_person_key(code)\n \"offers:code:person:#{code}\"\n end",
"def to_s\n @identifier.to_s.upcase\n end",
"def convertCodeToString(code, codeTable)\n string = \"\"\n code.split(\" \").each do |i|\n string += codeTable.key(i).to_s #This will return the key corresponding to the value split out of the code which represents one character\n end\n return string\nend",
"def layover_codes\n %w[ATL ORD DFW DEN]\n end",
"def code\n @company_codes = CompanyCode.all\n @company_codes.each do |c|\n c.search_text = c.code.gsub(/[-]/, \"\").downcase + ChineseConverter.simplized(c.locate+c.name+c.memo.to_s)\n end\n end",
"def inspect\n inspected = super\n\n # Only show last 4 of token, secret\n if @access_token\n inspected = inspected.gsub! @access_token, \"#{'*'*8}#{@access_token[8..-1]}\"\n end\n if @consumer_secret\n inspected = inspected.gsub! @consumer_secret, \"#{'*'*8}#{@consumer_secret[8..-1]}\"\n end\n\n inspected\n end",
"def fiat_account_description\n \"BANK OF AMERICA, N.A. ****4655\"\n end",
"def to_s\n parts = []\n parts << city if city\n parts << state_province_code if state_province_code\n parts << country_code if country_code\n parts.join(', ')\n end",
"def reason_code\n if reason_code_object.present?\n rcc_log.debug \"Obtaining Reason Code having ID : #{reason_code_object.id} \"\n reason_code = reason_code_object.reason_code\n rcc_log.debug \"Reason Code : #{reason_code}\"\n end\n reason_code.to_s.upcase\n end",
"def country_code; end",
"def country_code; end",
"def country_code\n @country_code.to_s\n end",
"def es_code\n id.to_s\n end",
"def javaize_key(key)\n key = key.to_s\n case key\n when 'acquirer_transaction_request'\n 'AcquirerTrxReq'\n when 'acquirer_status_request'\n 'AcquirerStatusReq'\n when 'directory_request'\n 'DirectoryReq'\n when 'issuer', 'merchant', 'transaction'\n key.capitalize\n when 'created_at'\n 'createDateTimeStamp'\n when 'merchant_return_url'\n 'merchantReturnURL'\n when 'token_code', 'expiration_period', 'entrance_code'\n key[0,1] + key.camelize[1..-1]\n when /^(\\w+)_id$/\n \"#{$1}ID\"\n else\n key\n end\n end",
"def to_s\r\n\t\t\t\r\n\t\t\t\"#{@name} <email: #{@email}> acct: #{hidden_digits(@deposit_account)}\"\r\n\t\tend",
"def name\n [cc_type, last_digits].join(' - ')\n end",
"def mozart_italian; end",
"def currency_denoted\n '$'\n end",
"def gluck_italian; end",
"def to_s\r\n\t\t\t`#{BITS::BITSADMIN} /info {#{@id}}`\r\n\t\tend",
"def cash_pcodes \n cash_services.map{|pc| pc[:pcode]}.join',' rescue ''\n end",
"def replace_country_code( value )\n $COUNTRIES.each do |record|\n # Replace country code with emoji using gsub\n # Use interpolation with regex then compare the variable with i option to ignore case sensitivity \n value = value.gsub(/#{record[:code]}/i, record[:code].flag_emoji+\" \") # I chose not to use gsub with ! because it was modifying the reference variable\n end\n return value\nend",
"def inspect\n \"#<#{self.class.name}: {\" + map { |b|\n case b\n when (0x07..0x0d), (0x20..0x7e)\n b.chr.dump\n when 0x00\n # sly hack to make char-sets more friendly\n # to us C programmers\n '\"\\0\"'\n else\n \"0x%02x\" % b\n end\n }.join(', ') + \"}>\"\n end",
"def crowd_chant(chant)\n p chant.upcase\n end",
"def to_php\n name.to_s\n end",
"def to_s\n RANK_STRINGS[rank].to_s + suit.symbol\n end",
"def snakecase_symbol_to_plain_text(snakecase)\n snakecase.to_s.gsub(/_/, \" \")\n end",
"def award_code_category\n \"#{award.name} #{code}: #{name}\"\n end",
"def hex_for_non_alphanumeric_code(input)\n if input < LOW_HEX_CODE_LIMIT\n HEX_CODES[input]\n else\n input.to_s(HEX_BASE)\n end\n end",
"def to_s\n to_sym.to_s\n end",
"def display_code \n p @result.code \n end",
"def codes; end"
] |
[
"0.62835354",
"0.61267334",
"0.6023451",
"0.5978955",
"0.59210956",
"0.59210956",
"0.5921033",
"0.5811775",
"0.576919",
"0.5742508",
"0.5742508",
"0.57218236",
"0.5655772",
"0.564331",
"0.564331",
"0.5598753",
"0.55952793",
"0.5557914",
"0.55421656",
"0.5528011",
"0.5524988",
"0.5494422",
"0.54751414",
"0.5475131",
"0.54698277",
"0.5465151",
"0.5438956",
"0.5433966",
"0.54276025",
"0.5413364",
"0.54083854",
"0.5406425",
"0.5402163",
"0.54017013",
"0.53950936",
"0.5385933",
"0.53834116",
"0.53834116",
"0.53834116",
"0.53834116",
"0.53834116",
"0.53834116",
"0.5382855",
"0.53813887",
"0.53813887",
"0.5376327",
"0.53499645",
"0.53305936",
"0.5329282",
"0.5323284",
"0.53223413",
"0.5322113",
"0.5321912",
"0.5313994",
"0.53130716",
"0.5311342",
"0.5307295",
"0.5304712",
"0.53010446",
"0.53006285",
"0.5298315",
"0.5287175",
"0.5281178",
"0.52741355",
"0.5265377",
"0.52626723",
"0.52620924",
"0.52620924",
"0.5257336",
"0.52340204",
"0.5230416",
"0.52232605",
"0.5219064",
"0.52092236",
"0.52032095",
"0.5200609",
"0.5198728",
"0.51985073",
"0.5184328",
"0.5184328",
"0.51789474",
"0.5173802",
"0.5172148",
"0.51702994",
"0.51667607",
"0.5165554",
"0.516519",
"0.51610804",
"0.5160731",
"0.51599604",
"0.5156703",
"0.5150036",
"0.5148189",
"0.5144174",
"0.5133081",
"0.51311845",
"0.512533",
"0.5124907",
"0.51246005",
"0.51232874",
"0.51187366"
] |
0.0
|
-1
|
Answers a tree of messages. The nodes of the tree are decorated to act like a linked list, providing pointers to _next_ and _previous_ in the tree.
|
def tree
return nil if messages.size == 0
build_tree unless @tree
@tree
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def thread(messages)\n # create id_table\n @id_table = create_id_table(messages)\n\n # create root hierachy siblings out of containers with zero children\n # TODO: would probably be nicer to use a list instead of empty root node\n root = Container.new()\n @id_table.each_pair { |message_id, container| root.add_child(container) if container.parent.nil? }\n \n # discard id_table\n @id_table = nil\n\n # prune dummy containers\n prune_empty_containers(root)\n\n # group again this time use Subject only\n #subject_table = group_root_set_by_subject(root)\n\n root\n end",
"def comments_recursive(all_messages, comments, users, depth, max_depth)\n\n # Add messages to array\n users.each do |user|\n messages = user_messages comments, user\n # Initialise if nil\n all_messages[user] ||= []\n all_messages[user].concat(messages) unless messages.nil? \n end\n\n # There's no further pages, so return a message array.\n if depth >= max_depth || !comments.methods.include?(:next_page)\n return all_messages\n end\n\n # There's a next page. Look for it recursively\n next_page = comments.next_page\n if next_page && !next_page.empty?\n comments_recursive all_messages, next_page, users, depth + 1, max_depth\n else\n # There's no next page, so return the message array.\n all_messages\n end\n end",
"def messages\n @zk.children(full_queue_path)\n end",
"def message_list\n list = []\n each do |k, v|\n list.concat(v.message_list)\n end\n list\n end",
"def build\n\t\t\tfifo_q = Array.new\n\t\n\t\t\t# Set the failures for the nodes coming out of the root node.\n\t\t\[email protected]_pair do |item, node|\n\t\t\t\tnode.failure = @root\n\t\t\t\tfifo_q.push node\n\t\t\tend\n\n\t\t\t# Set the failures in breadth-first search order\n\t\t\t# using a FIFO queue. A failure identifies the deepest node\n\t\t\t# that is a proper suffix of the current node. \n\t\t\twhile !fifo_q.empty?\n\t\t\t\tp_node = fifo_q.shift\n\t\t\t\tif p_node.get\n\t\t\t\t\tp_node.get.each_pair do |item, node|\n\t\t\t\t\t\t# Push the current node onto the queue, so any child\n\t\t\t\t\t\t# nodes can be processed later.\n\t\t\t\t\t\tfifo_q.push node \n\t\t\t\t\t\n\t\t\t\t\t\tf_node = p_node.failure\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Follow the failures until we find a goto transition\n\t\t\t\t\t\t# or arrive back at the root node\n\t\t\t\t\t\twhile f_node.goto(item) == nil and !f_node.eql? @root\n\t\t\t\t\t\t\tf_node = f_node.failure\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif f_node.eql? @root and f_node.goto(item) == nil\n\t\t\t\t\t\t\tnode.failure = @root\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnode.failure = f_node.goto(item)\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\tnode.output = yield node.output, (node.failure).output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif node.output && (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = node.output + (node.failure).output\n\t\t\t\t\t\t\t\telsif (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = (node.failure).output\n\t\t\t\t\t\t\t\tend\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\n\t\t\tbuild_dfa if @type == :DFA\n\n\t\tend",
"def get_messages_link_and_content()\n dputs __method__.to_s\n urls = {:public => []}\n # public messages\n message_req = setup_http_request($messages, @cookie)\n res = @http.request(message_req)\n urls[:public] = messages_parsing(res.body.force_encoding('utf-8'))\n msgs = {:public => []}\n until urls.empty?\n k, uu = urls.shift\n next if uu == nil\n uu.map{|u|\n get_conversations(u, k.to_s).map do |m|\n next if not m\n msgs[k] << m\n end\n }\n end\n # ex: {:public => [{:msg=>[\"[Aujourd'hui à 09h48] Miguel L : \\\"BONJOUR GREG vous arrive jusque a la gare pardieu\\\"\", \"...\"], :url=>\"/messages/respond/kAxP4rA...\", :token => \"XazeAFsdf...\"}], :private => [{:msg => ...}]\n return msgs\n end",
"def messages_html\n messages = redis.lrange(MESSAGE_LIST_KEY, 0, 100)\n puts \"messages = #{messages}\"\n\n list_html = messages.map do |message|\n message = JSON.parse(message)\n \"<p><b>#{message['client_id']}:</b> #{message['body']}</p>\"\n end.join\n\n last_message = JSON.parse(messages[0])['id']\n\n hide_previous_messages =\n if messages.count >= 2\n previous_last_message_id = JSON.parse(messages[1])['id']\n previous_last_message_class = \"messages_#{previous_last_message_id}\"\n \"<style>.#{previous_last_message_class} { display: none; }</style>\"\n end\n\n \"<div class='messages messages_#{last_message}'>#{list_html}#{hide_previous_messages}</div>\"\n end",
"def build_move_tree\n queue = [@root_node]\n until queue.empty?\n current_node = queue.shift\n possible_positions = new_move_positions(current_node.value) #[]\n possible_positions.each do |position| #[1,2]\n child_node = PolyTreeNode.new(position) #node object(value = 1,2)\n child_node.parent = current_node\n current_node.add_child(child_node)\n queue << child_node\n end\n end\n end",
"def tree(dir='.')\n output = []\n visit_tree(output, '.', '', '', '', dir)\n output.join(\"\\n\")\n end",
"def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end",
"def messages\n Enumerator.new do |y|\n loop do\n y << @redis.blpop(@name).last\n end\n end\n end",
"def messages\n @messages ||= @message_list.map.with_index do |payload, index|\n Message.new(payload, @starting_channel_sequence + index)\n end\n end",
"def new_tree(group, options = {}, &block)\n options[:root_ol] = true if options[:root_ol].nil?\n options[:vehicles] = true if options[:vehicles].nil?\n options[:users] = false if options[:users].nil?\n options[:close_level] ||= 99\n options[:stop_level] ||= 99\n \n html = [[]]\n if options[:root_ol]\n pending = [:ol, :li, group, :nli, :nol]\n level = -1\n else\n pending = [:li, group, :nli]\n level = 0\n end\n \n while node = pending.shift\n case node\n when :ol\n html << []\n level += 1\n when :li\n html << []\n when :nli\n content = content_tag(:li, html.pop.join)\n html.last << content\n when :nol\n content = content_tag(:ol, html.pop.join)\n html.last << content\n level -= 1\n else\n html.last << capture(node, level, &block)\n end\n \n if !node.is_a?(Symbol) && !(node.is_a?(Device) || node.is_a?(User))\n if options[:vehicles]\n children = [:ol, (node.children + node.devices).map {|c| [:li, c, :nli]}, :nol]\n elsif options[:users]\n children = [:ol, (node.children + node.users).map {|c| [:li, c, :nli]}, :nol]\n else\n children = [:ol, node.children.map {|c| [:li, c, :nli]}, :nol]\n end\n \n pending.unshift *(children.flatten)\n end\n end\n \n concat(html.to_s)\n end",
"def parse_tree(records)\n\n # build tree, should return a file_header node\n first, *records = *records\n unless first.code == :file_header\n raise ParseError.new('Expecting file header record (01).')\n end\n root = ParseNode.new(first)\n stack = [root]\n\n records.each do |record|\n raise ParseError.new('Unexpected record.') if stack.empty?\n\n case record.code\n\n # handling headers\n when :group_header, :account_identifier\n\n parent = {group_header: :file_header,\n account_identifier: :group_header}[record.code]\n unless stack.last.code == parent\n raise ParseError.new(\"Parsing #{record.code}, expecting #{parent} parent.\")\n end\n\n n = ParseNode.new(record)\n stack.last.children << n\n stack << n\n\n # handling trailers\n when :account_trailer, :group_trailer, :file_trailer\n\n parent = {account_trailer: :account_identifier,\n group_trailer: :group_header,\n file_trailer: :file_header}[record.code]\n unless stack.last.code == parent\n raise ParseError.new(\"Parsing #{record.code}, expecting #{parent} parent.\")\n end\n\n stack.last.records << record\n stack.pop\n\n # handling continuations\n when :continuation\n\n n = (stack.last.children.last || stack.last)\n n.records << record\n\n # handling transactions\n when :transaction_detail\n\n unless stack.last.code == :account_identifier\n raise ParseError.new(\"Parsing #{record.code}, expecting account_identifier parent.\")\n end\n\n stack.last.children << ParseNode.new(record)\n\n # handling special known errors\n else # nil\n raise ParseError.new('Unknown or unexpected record code.')\n end\n end\n\n unless stack == []\n raise ParseError.new('Reached unexpected end of input (EOF).')\n end\n\n # root now contains our parsed tree\n root\n end",
"def messages(older_than = nil, newer_than = nil)\n oauth_response = access_token.get \"/api/v1/messages.json\"\n JSON.parse(oauth_response.body)\n end\n\n # Return a list of the 20 most recent direct messages sent by the\n # authenticated user\n def sent_messages\n oauth_response = access_token.get \"/api/v1/messages/sent.json\"\n JSON.parse(oauth_response)\n end\n\n # Return messages received by the logged-in user. Corresponds to the\n # \"Received\" tab on the website.\n def received_messages\n oauth_response = access_token.get \"/api/v1/messages/received.json\"\n JSON.parse(oauth_response)\n end\n\n # Return messages in the group with the given ID. Corresponds to the\n # messages you'd see on a group's profile page.\n def group_messages(group_id)\n oauth_response = access_token.get \"/api/v1/messages/in_group/#{group_id}.json\"\n JSON.parse(oauth_response)\n end\n\n # Update the current user's status\n def update(message, group_id = nil)\n if group_id.nil?\n oauth_response = access_token.post(\"/api/v1/messages\", :body => message)\n else\n oauth_response = access_token.post(\"/api/v1/messages\", :body => message, :group_id => group_id)\n end\n JSON.parse(oauth_response)\n end\n\n # Delete a message owned by the current user\n def delete(message_id)\n oauth_response = access_token.delete(\"/api/v1/messages/#{message_id}\")\n JSON.parse(oauth_response)\n end\n\n # Reply to a message\n def reply_to(message, message_id)\n oauth_response = access_token.post(\"/api/v1/messages\", :body => message, :replied_to_id => message_id)\n JSON.parse(oauth_response)\n end\n\n # Sends a private message direct to the user indicated\n def direct_to(message, user_id)\n oauth_response = access_token.post(\"/api/v1/messages\", :body => message, :direct_to_id => user_id)\n JSON.parse(oauth_response)\n end\n end\nend",
"def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end",
"def messages\n proxy_exceptions do\n @page.conversations.map do |conversation|\n conversation.messages.map do |data|\n Services::Facebook::Message.new do |message|\n message.id = data.identifier\n message.message = data.message\n message.created_at = data.created_time\n message.author = Services::Facebook::User.new do |user|\n user.id = data.from.identifier\n user.name = data.from.name\n end\n end\n end\n end.flatten\n end\n end",
"def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)",
"def tree\n while token = @tokens.next\n case token.type\n when :operator\n token.build(@nodes.pop, tree).tap do |node|\n @nodes.push(node)\n end\n when :value\n token.build.tap do |leaf|\n @nodes.push(leaf)\n end\n end\n end\n rescue StopIteration\n @nodes.last || Lexeme::Null.new\n end",
"def message_list(filters = {})\n params = { limit: 10, offset: 0 }.merge(filters).compact\n query = \"messages?#{URI.encode_www_form(params)}\"\n\n List.new(Message, request(:get, query))\n end",
"def parse_text(text)\n\t\tNode.destroy_all(work_id: self.id)\n\t\tLink.destroy_all(work_id: self.id)\n\t\tLinkCollection.destroy_all(work_id: self.id)\n\n\t\tstack = Array.new\n\t\tnew_ordering= []\n\t\tlink_colls_queue = []\n\t\ttext.each_line do |line|\n\t\t\t#parser rules: any amount of whitespace followed immediately by < means new node. Otherwise, new note.\n\t\t\t#<TYPE.CATEGORY>TITLE\n\t\t\t#if the occurence of <*> is before the first occurence of \" then it's a new\n\t\t\t#@angleBracketLocation = line.index(/[ ,\\t]*<.*>/)\n\t\t\n\t\t\tfirst_char = get_text_from_regexp(line, /[ ,\\t]*(.)/)\n\t\t\n\t\t\t#if a new node should be made\n\t\t\tif first_char == '.'\n\t\t\t\tnew_node = Node.new\n\t\t\t\tbuild_node(new_node, line)\n\t\t\t\tnew_node.save\n\n\t\t\t\t#get the parent.\n\t\t\t\tdepth = new_node.depth\n\n\t\t\t\tnewNodeDepth = NodeDepth.new(new_node.id, depth)\n\t\t\t\t\n\t\t\t\tif depth == 0 #if it's a base element\n\t\t\t\t\tstack.push(newNodeDepth)\n\t\t\t\telse\n\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\twhile depth <= currNodeDepth.depth do #while you're less deep, therefore it aint yo momma \n\t\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\tend #at this point, @currNodeDepth is the nearest element that's not as deep as the new one, it's parent\n\t\t\t\t\tparentNode = Node.find(currNodeDepth.node_idnum)\n\t\t\t\t\tif parentNode.id == new_node.id #if it didn't find any parent\n\t\t\t\t\t\tparent_id = nil\n\t\t\t\t\telse\n\t\t\t\t\t\tparent_id = parentNode.id\n\t\t\t\t\tend\n\n\t\t\t\t\t#creates the link, and the sets the parent and child relation\n\t\t\t\t\trelation = Link.new(child_id: new_node.id, parent_id: parent_id, work_id: self.id)\n\t\t\t\t\trelation.save\n\t\t\t\t\tnew_node.parent_relationships << relation\n\t\t\t\t\tparentNode.child_relationships << relation\n\n\t\t\t\t\tstack.push(currNodeDepth)#push the parent back in, in case it has siblings\n\t\t\t\t\tstack.push(newNodeDepth)#push self in, in case it has children\n\n\t\t\t\t\t#@new_node.parent_relationships.build(child_id: @new_node.id, parent_id:@parentNode.id)\n\t\t\t\t\t#@new_node.parents << @parentNode\n\t\t\t\t\t#@parent_node.child=\n\t\t\t\t\t#make this nodes id into the parents child.\n\t\t\t\t\t#make the child's parent the parentNode's id.\n\t\t\t\tend\n\t\t\t\tnew_node.save\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"Node\", new_node.id))\n\n\t\t\t#if it's a note\n\t\t\telsif first_char == '-'\n\t\t\t\tnew_note = Note.new()\n\t\t\t\tbuild_note(new_note, line)\n\n\t\t\t\t#this is a bug. it just gets attached to the previous node without regard for depth\n\t\t\t\t#binding.pry\n\t\t\t\tif (new_note.depth != 0 && !stack.empty?) #if it could have a parent and there are possibilities\n\n\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\twhile new_note.depth <= currNodeDepth.depth do #while you're less deep, therefore it aint yo momma \n\t\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\tend #at this point, @currNodeDepth is the nearest element that's not as deep as the new one, it's parent\n\t\t\t\t\tparentNode = Node.find(currNodeDepth.node_idnum)\n\t\t\t\t\tstack.push(currNodeDepth)\n\t\t\t\t\n\t\t\t\t\tnew_note.node_id = parentNode.id\n\t\t\t\t\t#parentNode.add_note_to_combined(new_note)\n\t\t\t\tend\n\t\t\t\tnew_note.save\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"Note\", new_note.id))\t\t\t\t\n\t\t\t#for special chars\n\t\t\telsif first_char == ':'\n\n\t\t\t\t#ordering.insert(line_number, ObjectPlace.new(\"LinkCollection\", nil))\n\t\t\t\t#set_order(ordering)\n\t\t\t\t#parent_node = find_element_parent(link_coll_depth, line_number, ordering)\n\n\t\t\t\twhitespace = get_text_from_regexp(text, /(.*):/)\n\t\t\t\tlink_coll_depth = (whitespace.length)/3 #+2?\n\t\t\t\tparentNode = nil\n\t\t\t\tif (link_coll_depth != 0 && !stack.empty?) #if it could have a parent and there are possibilities\n\n\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\twhile link_coll_depth <= currNodeDepth.depth do #while you're less deep, therefore it aint yo momma \n\t\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\tend #at this point, @currNodeDepth is the nearest element that's not as deep as the new one, it's parent\n\t\t\t\t\tparentNode = Node.find(currNodeDepth.node_idnum)\n\t\t\t\t\tstack.push(currNodeDepth)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tlink_coll = self.link_collections.build\n\t\t\t\tbuild_link_collection(link_coll, line, parentNode)\t\n\t\t\t\tlink_colls_queue.append({link_coll: link_coll, text: get_text_from_regexp(line, /:(.*)/)})\n\t\t\t\t#binding.pry\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"LinkCollection\", link_coll.id))\n\t\t\telse\n\t\t\t\tplace_holder = work.place_holders.create(text:line_content)\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"PlaceHolder\", place_holder.id))\n\t\t\tend\n\t\tend\n\n\t\tset_order(new_ordering)\n\t\t#at the end, build those links (appending the newly made nodes if needed.) This way, all nodes are mode before it thinks\n\t\t#it needs to be doing this shit\n\t\tlink_colls_queue.each do |link_coll_pair|\n\t\t\t#build its child links\n\t\t\tlink_coll_pair[:link_coll].set_links(link_coll_pair[:text])\n\t\tend\n\n\t\t#should fix this so I can get rid of populate_ordering, only works here because things are produced in order, can do it as I go\n\t\t#o = populate_ordering\n\tend",
"def printf(children=nil)\n list = \"\"\n queue = MyQueue.new()\n queue.enqueue(@root)\n while queue.empty? != true\n list << \"#{queue.head.title}: #{queue.head.rating}\\n\"\n queue.enqueue(queue.head&.left) if queue.head.left\n queue.enqueue(queue.head&.right) if queue.head.right\n queue.dequeue\n end\n p list\n end",
"def messages\n @previous.select { |event, _data| event == :message }.map(&:last).join\n end",
"def printf(children=nil) #like a queue\n #param represents default value if value is not specified by client\n array = [@root] #begin array with @root as 1st item\n output = []\n while array.length > 0\n node = array.shift #returns 1st element of self + returns it\n if node.left != nil #if left leaf of child has content\n array.push(node.left) #push that leaf to the array\n end\n if node.right != nil\n array.push(node.right)\n end\n output.push(\"#{node.title}: #{node.rating}\") #push title/rating for each child to output array\n end\n output.each {|movie| puts movie} #print each item in output array\n end",
"def tokens_to_tree\n\n tag_stack = [ ] # stack for element tags\n children_stack = [ ] # stack for lists of children\n children = [ ] # current list of children\n err_count = 0\n\n # Note: the text token pattern test assumes that all text tokens\n # are non-empty. This should be true, because REX doesn't create\n # empty tokens.\n\n @tokens.each_index do |i|\n token = @tokens[i]\n line_num = @line_num[i]\n tok_err = \"Error near line #{line_num}, token #{i+1} (#{token})\"\n case token\n when /\\A[^<]/ # text\n children << text_node(token)\n when /\\A<!--/ # comment\n children << comment_node(token)\n when /\\A<\\?/ # processing instruction\n children << pi_node(token)\n when /\\A<!DOCTYPE/ # DOCTYPE\n children << doctype_node(token)\n when /\\A<!\\[/ # CDATA\n children << cdata_node(token)\n when /\\A<\\// # element close tag\n if tag_stack.empty?\n warn \"#{tok_err}: Close tag w/o preceding open tag; malformed document?\\n\"\n err_count += 1\n next\n end\n if children_stack.empty?\n warn \"#{tok_err}: Empty children stack; malformed document?\\n\"\n err_count += 1\n next\n end\n tag = tag_stack.pop\n open_tag_name = extract_tag_name(tag)\n close_tag_name = extract_tag_name(token)\n if open_tag_name != close_tag_name\n warn \"#{tok_err}: Tag mismatch; malformed document?\\n\"\n warn \" open tag: #{tag}\\n\"\n warn \" close tag: #{token}\\n\"\n print_tag_stack(\"enclosing tags\", tag_stack)\n err_count += 1\n next\n end\n elt = element_node(tag, token, children)\n children = children_stack.pop\n children << elt\n else # element open tag\n # If we reach here, we're seeing the open tag for an element:\n # - If the tag is also the close tag (e.g., <abc/>), close the\n # element immediately, giving it an empty child list.\n # - Otherwise, push tag and child list on stacks, begin new child\n # list for element body.\n case token\n when /\\/>\\Z/ # tag is of form <abc/>\n children << element_node(token, \"\", [ ])\n else # tag is of form <abc>\n tag_stack << token\n children_stack << children\n children = [ ]\n end\n end\n end\n\n # At this point, the stacks should be empty if the document is\n # well-formed.\n\n if !tag_stack.empty?\n warn \"Error at EOF: Unclosed tags; malformed document?\\n\"\n print_tag_stack(\"unclosed tags\", tag_stack)\n err_count += 1\n end\n if !children_stack.empty?\n warn \"Error at EOF: Unprocessed child elements; malformed document?\\n\"\n# TODO: print out info about them\n err_count += 1\n end\n\n @tree = children\n return err_count\n end",
"def messages(ordered_by_received = false)\n messages = Array.new\n request(:get, \"messages\")['items'].each do |message|\n messages.push Message.new(message)\n end\n ordered_by_received ? messages.reverse! : messages\n end",
"def build_move_tree\n move_q = [@root]\n while move_q.length > 0\n children = new_move_positions(move_q[0].value)\n children.each do |kid|\n move_q[0].add_child(PolyTreeNode.new(kid))\n end\n move_q += move_q[0].children\n move_q.shift\n end\n nil\n end",
"def build_messages\n proper_message_names.each do |message|\n klass = message.to_s.camelize\n attributes = attributes_for(:message, message)\n struct_attrs = struct_attributes_for(:message, message)\n defaults = defaults_for(:message, message)\n types = types_for(:message, message)\n\n self.module_eval <<-EOS, __FILE__, __LINE__ + 1\n class #{klass} < Struct.new('#{klass}'#{struct_attrs})\n def attributes() @@attributes = #{attributes.inspect} end\n def defaults() @@defaults = #{defaults.inspect} end\n\n def initialize\n super\n attributes.each do |attribute|\n send(\\\"\\#{attribute}=\", Bitcoin::Protocol.lookup(defaults[attribute]))\n end\n instance_eval(&block) if block_given?\n end\n\n # evaluated after initialization so it can reflect upon its own values\n def types() @@types = #{types.inspect} end\n\n def load(buf)\n attributes.each do |a|\n if BtcProto.proper_type_names & [types[a]]\n send(\"\\#{types[a]}=\", BtcProto.class_for(:type, types[a]).load(buf))\n else\n send(\"\\#{types[a]}=\", buf.send(\"read_\\#{types[a]}\"))\n end\n end\n end\n\n def dump(buf)\n attributes.each do |a|\n if BtcProto.proper_type_names.include?(types[a])\n send(a).dump(buf)\n else\n buf.send(\"write_\\#{types[a]}\", send(a))\n end\n end\n end\n end\n EOS\n\n self.messages[:classes].\n merge!(message => Bitcoin::Protocol.const_get(klass))\n end\n\n # add logic for marshalling i.e. load and dump\n # each type should be able to determine its size\n\n # associate class with names\n # new_item = { :class => command }\n # properties.assoc(message).push(new_item)\n end",
"def tree(node, *children, **typed_children)\n children += children_for(typed_children)\n children = children.flatten.grep(Tree)\n infos = sub(0, node.start), sub(node.start, node.length), sub(node.stop..-1)\n description = Hansi.render(THEME[:green], node.type.to_s.tr(\"_\", \" \"))\n after = Hansi.render(TEMPLATE, *infos, theme: THEME, tags: true)\n Tree.new(description, *children, after: after, prefix_color: PREFIX_COLOR)\n end",
"def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend",
"def messages\n @messages ||= parse_messages(@raw_messages)\n end",
"def thread_message! message\n startt = Time.now\n\n ## build the path of msgids from leaf to ancestor\n ids = [message.safe_msgid] + message.safe_refs.reverse\n seen = {}\n ids = ids.map { |x| seen[x] = true && x unless seen[x] }.compact\n\n ## write parent/child relationships\n if ids.size > 1\n ids[0 .. -2].zip(ids[1 .. -1]).each do |id, parent|\n pkey = \"pmsgid/#{id}\"\n next if contains_key? pkey # don't overwrite--potential for mischief?\n write_string pkey, parent\n\n ckey = \"cmsgids/#{parent}\"\n v = load_set(ckey)\n v << id\n write_set ckey, v\n end\n end\n\n ## find the root of the whole thread\n root = ids.first\n seen = {} # guard against loops\n while(id = load_string(\"pmsgid/#{root}\"))\n #puts \"parent of #{root} is #{id}\"\n break if seen[id]; seen[id] = true\n root = id\n end\n\n ## get the thread structure in terms of docids docs we've actually seen.\n ## generate psuedo-docids to join trees with parents we haven't seen yet\n ## when necessary.\n thread_structure = build_thread_structure_from root\n #puts \"thread structure is #{thread_structure.inspect}\"\n threadid = thread_structure.first # might actually be a psuedo-docid\n #puts \"root msgid is #{root.inspect}, root docid is #{threadid}\"\n\n ## if any of these docs are roots of old threads, delete those old threads,\n ## but keep track of all the labels we've seen\n old_labels = thread_structure.flatten.inject(Set.new) do |labels, id|\n tkey = \"thread/#{id}\"\n labels + if contains_key? tkey\n lkey = \"tlabels/#{id}\"\n v = load_set lkey\n @store.delete lkey\n @store.delete tkey\n v\n else\n Set.new\n end\n end\n\n ## write the thread ids for all documents. we need this at search time to\n ## do the message->thread mapping.\n thread_structure.flatten.each do |id|\n next if id < 0 # pseudo root\n write_int \"threadid/#{id}\", threadid\n end\n\n @thread_time += (Time.now - startt)\n [threadid, thread_structure, old_labels]\n end",
"def add(text)\n\n\t\t# create a new node and set navigation pointers\n\t\t@old = @tree\n\t\t@tree = Node.new(text)\n\t\[email protected] = @old.next\n\t\tif @old.next != nil\n\t\t\[email protected] = @tree\n\t\tend\n\t\[email protected] = @old\n\t\[email protected] = @tree\n\n\t\t# Prune the tree, so it doesn't get too big.\n\t\t# Start by going back.\n\t\tn=0\n\t\tx = @tree\n\t\twhile x != nil\n\t\t\tn += 1\n\t\t\tx0 = x\n\t\t\tx = x.prev\n\t\tend\n\t\tx = x0\n\t\twhile n > 500\n\t\t\tn -= 1\n\t\t\tx = x.next\n\t\t\tx.prev.delete\n\t\tend\n\t\t# now forward\n\t\tn=0\n\t\tx = @tree\n\t\twhile x != nil\n\t\t\tn += 1\n\t\t\tx0 = x\n\t\t\tx = x.next\n\t\tend\n\t\tx = x0\n\t\twhile n > 500\n\t\t\tn -= 1\n\t\t\tx = x.prev\n\t\t\tx.next.delete\n\t\tend\n\tend",
"def tree\n Tree.new(self)\n end",
"def build_move_tree\n self.root_node = PolyTreeNode.new(start_pos) #instance variable\n \n queue = [root_node]\n until queue.empty?\n #pop,queue\n cur_node = queue.shift\n move_list = new_move_positions(cur_node.value)\n move_list.each do |pos|\n child_node = PolyTreeNode.new(pos)\n cur_node.add_child(child_node)\n queue << child_node\n end\n end\n end",
"def build_thread_structure_from safe_msgid, seen={}\n return nil if seen[safe_msgid]\n\n docid = load_int \"docid/#{safe_msgid}\"\n children = load_set \"cmsgids/#{safe_msgid}\"\n #puts \"> children of #{msgid} are #{children.inspect}\"\n\n seen[safe_msgid] = true\n child_thread_structures = children.map { |c| build_thread_structure_from(c, seen) }.compact\n\n #puts \"< bts(#{msgid}): docid=#{docid.inspect}, child_structs=#{child_thread_structures.inspect}\"\n if docid\n if child_thread_structures.empty?\n [docid.to_i]\n else\n [docid.to_i] + child_thread_structures\n end\n else\n case child_thread_structures.size\n when 0; nil\n when 1; child_thread_structures.first\n else # need to make a psuedo root\n psuedo_root = -child_thread_structures.first.first # weird?\n [psuedo_root] + child_thread_structures\n end\n end\n end",
"def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end",
"def build_tree(s)\n bytes = s.bytes\n uniq_b = bytes.uniq\n nodes = uniq_b.map { |byte| Leaf.new(byte, bytes.count(byte)) }\n until nodes.length == 1\n node1 = nodes.delete(nodes.min_by(&:count))\n node2 = nodes.delete(nodes.min_by(&:count))\n nodes << Node.new(node1, node2, node1.count + node2.count)\n end\n nodes.fetch(0)\nend",
"def messages()\n []\n end",
"def group_root_set_by_subject(root)\n subject_table = {}\n \n # 5B\n # Populate the subject table with one message per each\n # base subject. For each child of the root:\n root.children.each do |container|\n\n # Find the subject of this thread, by using the base\n # subject from either the current message or its first\n # child if the current message is a dummy. This is the\n # thread subject.\n c = nil\n if container.message == nil\n c = container.children[0]\n else\n c = container\n end\n \n message = c.message\n if message.nil?\n next\n end\n \n subject = MessageParser.normalize_subject(message.subject)\n\n # If the thread subject is empty, skip this message\n if subject.length == 0 \n next\n end\n\n existing = subject_table[subject]\n \n # If there is no message in the subject table with the\n # thread subject, add the current message and the thread\n # subject to the subject table.\n if existing == nil\n subject_table[subject] = c\n \n # Otherwise, if the message in the subject table is not a\n # dummy, AND either of the following criteria are true:\n # - The current message is a dummy, OR\n # - The message in the subject table is a reply or forward\n # and the current message is not. \n elsif ( ( not existing.dummy?) && ( c.dummy? || ( \n ( MessageParser.is_reply_or_forward existing.message.subject ) && \n ( not MessageParser.is_reply_or_forward message.subject ))))\n subject_table[subject] = c\n end\n \n end\n \n # 5C\n # using reverse_each here because removing children from root\n # would lead to skipping of root's children\n root.children.reverse_each do |container|\n subject = nil\n \n # Find the subject of this thread, by using the base\n # subject from either the current message or its first\n # child if the current message is a dummy. This is the\n # thread subject.\n if container.message == nil\n subject = container.children[0].message.subject\n else\n subject = container.message.subject\n end\n \n subject = MessageParser.normalize_subject(subject)\n \n c = subject_table[subject]\n \n # If the message in the subject table is the current\n # message, skip this message.\n if c == nil || c == container\n # puts \">>>> skip\"\n next\n end\n \n \n \n # If both messages are dummies, append the current\n # message's children to the children of the message in\n # the subject table (the children of both messages\n # become siblings), and then delete the current message \n if c.dummy?() && container.dummy?()\n container.children.each {|ctr| c.add_child(ctr) }\n container.parent.remove_child(container)\n # If the message in the subject table is a dummy and the\n # current message is not, make the current message a\n # child of the message in the subject table (a sibling\n # of its children). \n elsif c.dummy?() && ( not container.dummy?() )\n c.add_child(container)\n # If the current message is a reply or forward and the\n # message in the subject table is not, make the current\n # message a child of the message in the subject table (a\n # sibling of its children). \n elsif not MessageParser.is_reply_or_forward(c.message.subject) && \n MessageParser.is_reply_or_forward(container.message.subject)\n c.add_child(container) \n # Otherwise, create a new dummy message and make both\n # the current message and the message in the subject\n # table children of the dummy. Then replace the message\n # in the subject table with the dummy message.\n else\n new_container = Container.new\n new_container.add_child(c)\n new_container.add_child(container)\n subject_table[subject] = new_container\n end \n end\n\n subject_table\n end",
"def build_move_tree\n arr = [root_node]\n nodes = []\n\n until arr.empty?\n this_pos = arr.shift\n arr += new_move_positions(this_pos)\n nodes << PolyTreeNode.new(this_pos)\n end\n\n nodes\n end",
"def build_tree(data)\n @root = Node.new(data[0])\n data.shift\n data.each { |value| @root.insert(value) }\n end",
"def make_tree(pre, inord)\n return if pre.size == 0\n root_node = Node.new(pre[0])\n idx = inord.index(pre[0])\n root_node.left = make_tree(pre[1..idx], inord[0...idx])\n root_node.right = make_tree(pre[idx+1...pre.size], inord[idx+1...inord.size])\n return root_node\nend",
"def msgs\n d = data\n if d != nil\n return d.fetch('msgs', [])\n end\n return []\n end",
"def tree\n @tree ||= build_tree\n end",
"def index\n @nodes = Node.find(:all,:order => :lft)\n \n @node_list = []\n 0.upto(@nodes.size-1) do |i|\n node = @nodes[i]\n links = []\n if i > 0\n \tprev_node = @nodes[i-1]\n \tif prev_node.level == node.level\n links << {:link_type=> :arrow_right, :to => 'child_of', :dest_id => prev_node}\n \tend\n \tif prev_node.level < node.level\n links << {:link_type=> :arrow_left, :to => 'right_of', :dest_id => prev_node}\n \tend\n links << {:link_type=> :arrow_up, :to => 'left_of', :dest_id => prev_node}\n end\n if i < @nodes.size-1\n (i+1).upto(@nodes.size-1) do |n|\n if @nodes[n].level <= node.level\n links << {:link_type=> :arrow_down, :to => 'right_of', :dest_id => @nodes[n]}\n break\n end\n end\n end\n @node_list << [node,links]\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def encode(msg)\n doc = REXML::Document.new\n doc << REXML::XMLDecl.default\n root = doc.add_element(\"fipa-message\", { \"act\" => msg.performative, \"conversation-id\" => msg.conversation_id })\n msg.receivers.each do |recv|\n el = root.add_element(\"receiver\")\n el.add_element(\"agent-identifier\")\n end\n el = root.add_element(\"sender\")\n el.add_element(\"agent-identifier\")\n root.add_element(\"content\", { \"href\" => nil })\n root.add_element(\"language\", { \"href\" => nil })\n root.add_element(\"encoding\", { \"href\" => nil })\n root.add_element(\"ontology\", { \"href\" => nil })\n root.add_element(\"protocol\", { \"href\" => nil })\n root.add_element(\"reply-with\", { \"href\" => nil })\n root.add_element(\"in-reply-to\", { \"href\" => nil })\n root.add_element(\"reply-by\", { \"time\" => nil, \"href\" => nil })\n el = root.add_element(\"reply-to\")\n msg.reply_to.each do |repl|\n el.add_element(\"agent-identifier\")\n end\n root.add_element(\"conversation-id\", { \"href\" => nil })\n root.add_element(\"user-defined\")\n doc.to_s\n end",
"def tree\n @stack = @rpn.clone\n get_tree\n end",
"def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += ' ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end",
"def build_tree_rec(preorder, inorder)\n if inorder.length != 0\n original = preorder.shift\n ind = inorder.index(original)\n root = TreeNode.new(inorder[ind])\n root.left = build_tree(preorder, inorder[0...ind])\n root.right = build_tree(preorder, inorder[ind + 1..-1])\n root\n end\nend",
"def build_tree(arr)\n #take array, turn into bt with node objs\n return nil if arr.empty?\n\n mid = (arr.size - 1)/2\n current_node = Node.new(arr[mid])\n\n current_node.left = build_tree(arr[0...mid])\n current_node.right = build_tree(arr[(mid+1)..-1])\n \n current_node\n end",
"def produce_tree(ary); end",
"def build_move_tree\n self.root_node = PolyTreeNode.new(@start_pos)\n\n nodes = [root_node]\n until nodes.empty?\n current_node = nodes.shift\n current_pos = current_node.value\n\n new_move_positions(current_pos).each do |pos|\n next_node = PolyTreeNode.new(pos)\n current_node.add_child(next_node)\n nodes << next_node\n end\n end\n end",
"def to_string_tree\n if ((@children).nil? || (@children.size).equal?(0))\n return self.to_s\n end\n buf = StringBuffer.new\n if (!is_nil)\n buf.append(\"(\")\n buf.append(self.to_s)\n buf.append(Character.new(?\\s.ord))\n end\n i = 0\n while !(@children).nil? && i < @children.size\n t = @children.get(i)\n if (i > 0)\n buf.append(Character.new(?\\s.ord))\n end\n buf.append(t.to_string_tree)\n i += 1\n end\n if (!is_nil)\n buf.append(\")\")\n end\n return buf.to_s\n end",
"def make_tree(in_list, pid = self.pid)\n [].tap do |top_level|\n left_over = []\n # Categorize into top level, or not top level\n in_list.each do |node|\n if node['parent_page_id'].blank? || node['parent_page_id'] == pid\n top_level.unshift node\n else\n left_over.unshift node\n end\n end\n\n # For each of the top_level nodes make a subtree with the leftovers.\n top_level.each do |node|\n node['children'] = make_tree(left_over, node['id'])\n end\n end\n end",
"def messages\n\t\t@content_title = \"Messages\"\n\t\t@messages = Message.paginate(:order => 'created_at DESC', :page => params[:page])\n\tend",
"def internal_structure(indentation=0)\n node_descr = \"\"\n indentation.times { node_descr.concat \" \" }\n description = self.class.to_s.gsub(\"Node\", \"\")\n node_descr.concat \"#{description}\"\n if(!@node_value.nil?)\n node_descr.concat \" #{@node_value}\"\n end\n node_descr.concat \"\\n\"\n if (!children.nil?)\n children.each do |child| \n node_descr.concat(\"#{child.internal_structure(indentation+1)}\")\n end\n end\n return node_descr\n end",
"def replies\n options = {}\n if params[:per_page]\n options[:limit] = params[:per_page].to_i\n if params[:page] && params[:page].to_i >= 1\n options[:offset] = params[:per_page].to_i * (params[:page].to_i-1)\n end\n end\n options[:conditions] = {:channel_id => @channel.id, :reference_to => @message.id }\n sort_order = 'DESC'\n if params[:sort_order]\n if params[:sort_order] == 'ascending'\n sort_order = 'ASC'\n elsif params[:sort_order] == 'descending'\n sort_order = 'DESC'\n end\n end\n options[:order] = 'updated_at ' + sort_order\n @messages = Message.all(options)\n size = Message.count(:conditions => options[:conditions])\n\n render_json :entry => @messages, :size => size and return\n end",
"def show_with_wants_replies_in_reverse_order\n page = params[:page]\n # Find the page of the requested reply\n replies_order = User.current.wants_replies_in_reverse_order? ? 'DESC' : 'ASC'\n @replies = @topic.children.\n includes(:author, :attachments, {:board => :project}).\n reorder(\"#{Message.table_name}.created_on #{replies_order}, #{Message.table_name}.id #{replies_order}\")\n\n if params[:r] && page.nil?\n offset = @replies.pluck(:id).index(params[:r].to_i)\n page = 1 + offset / MessagesController::REPLIES_PER_PAGE\n end\n\n @reply_count = @topic.children.count\n @reply_pages = MessagesController::Paginator.new @reply_count, MessagesController::REPLIES_PER_PAGE, page\n\n @replies = @replies.\n limit(@reply_pages.per_page).\n offset(@reply_pages.offset).\n to_a\n\n @reply = Message.new(:subject => \"RE: #{@message.subject}\")\n render :action => \"show\", :layout => false if request.xhr?\n end",
"def build_tree(data_array)\n root = nil\n \n data_array.each do |elem|\n cur_node = root\n \n node = Node.new(elem)\n\tnode.children = Array.new(2, nil)\n\t\n\twhile !cur_node.nil?\n\t if elem < cur_node.value\n\t if cur_node.children[0].nil?\n\t\t node.parent = cur_node\n\t\t cur_node.children[0] = node\n\t\t cur_node = node\n\t\tend\n\t\tcur_node = cur_node.children[0]\n\t else\n\t if cur_node.children[1].nil?\n\t\t node.parent = cur_node\n\t\t cur_node.children[1] = node\n\t\t cur_node = node\n\t\tend\n\t\tcur_node = cur_node.children[1]\n\t end\n\tend\n\t\n\troot ||= node\n\t \n end\n \n root\nend",
"def list_messages\n if @message_list.nil?\n @message_list = MessageList.new(@connection)\n end #if\n return @message_list\n end",
"def build_queen_move_tree\n move_tree_template = MoveTree.new([0, 0])\n # Get directions\n directions = [-1, 0, 1].repeated_permutation(2).to_a\n directions.delete([0, 0])\n\n directions.each do |direction|\n move_tree_template.root.add_child(build_directional_tree_nodes(direction))\n end\n\n move_tree_template\n end",
"def test_peers\n root = Document.new(Font.new(Font::ROMAN, 'Arial'))\n nodes = []\n nodes.push(root.paragraph)\n nodes.push(root.bold)\n nodes.push(root.underline)\n\n assert(root.previous_node == nil)\n assert(root.next_node == nil)\n assert(nodes[1].previous_node == nodes[0])\n assert(nodes[1].next_node == nodes[2])\n end",
"def build_reply\n new_pm = PrivateMessage.new\n new_pm.author = receiver\n new_pm.receiver = author\n new_pm.title = 'RE: ' + title\n new_pm.message = '> ' + message.gsub(\"\\n\", \"\\n> \") + \"\\n\"\n new_pm\n end",
"def to_nodes(event)\n nodes = []\n event.transitions.each do |transition|\n if transition.multiple_from?\n temp_nodes = transition.from.map{ |from| Jsm::Drawer::Node.new(from: from, to: transition.to, label: event.name) }\n else\n from = transition.from[0] # even only one it is still in array e.g: [:confirmed]\n temp_nodes = [Jsm::Drawer::Node.new(from: from, to: transition.to, label: event.name)]\n end\n nodes += temp_nodes\n end\n nodes\n end",
"def build_move_tree #=> build the tree\n self.root_node = PolyTreeNode.new(start_pos) #=> root_node set to the start pos\n\n # build the tree out in breadth-first fashion\n nodes = [root_node]\n until nodes.empty?\n current_node = nodes.shift\n\n current_pos = current_node.value\n new_move_positions(current_pos).each do |next_pos|\n next_node = PolyTreeNode.new(next_pos)\n current_node.add_child(next_node)\n nodes << next_node\n end\n end\n end",
"def messages options = {}\n query = {\n \"skip\" => options[:skip],\n \"beforeId\" => options[:before],\n \"afterId\" => options[:after],\n \"aroundId\" => options[:around],\n \"limit\" => options[:limit],\n \"q\" => options[:search]\n }\n\n data = client.get \"/v1/rooms/#{id}/chatMessages\", query\n\n Message::Collection.new self, data\n end",
"def render_tree(elements, symbols, parents = [])\n i = 0\n x = elements.map do |li|\n last = elements.length == i+1\n\n current = indentation(parents, last, symbols) + li[:value]\n\n children = \"\"\n if li[:children].length > 0\n children = \"\\n\" + render_tree(li[:children], symbols, parents + [last])\n end\n\n i += 1\n current + children\n end\n\n x.join(\"\\n\")\n end",
"def get_tree(person)\n\n h = build_adjacency_list\n\n n = h[get_tree_top_id(person)] # start creating the tree at this person's supervisor, if there is one\n\n nodes = to_node(h, n) # recurse through the SQL results to construct a tree (nested hashes)\n\n nodes\n end",
"def get_new_messages\n get_messages_link_and_content\n end",
"def build_tree(arr)\n #arr.shuffle!\n arr.each do |x|\n if @root == nil\n @root = Node.new(x)\n else\n current_node = @root\n until current_node == nil\n if x < current_node.value\n parent = current_node\n direction = \"left\"\n current_node = current_node.left_child\n elsif x > current_node.value\n parent = current_node\n direction = \"right\"\n current_node = current_node.right_child\n end\n end\n if direction == \"left\"\n parent.left_child = Node.new(x)\n elsif direction == \"right\"\n parent.right_child = Node.new(x)\n end\n end\n end\n end",
"def messages\n msgs = []\n favorites.each do |fav|\n fav.messages.each do |message|\n msgs << message\n end\n end\n msgs\n end",
"def printf(children=nil)\n queue = [@root]\n\n queue.each do |current|\n puts \"#{current.value}\"\n if current.left && current.right\n queue << current.left << current.right\n elsif current.left\n queue << current.left\n elsif current.right\n queue << current.right\n end\n end\n end",
"def messages\n object.messages.sort_by do |message|\n message.created_at\n end\n end",
"def net_message(message)\n @messages << message\n # Remove last element from messages history\n if messages.length > @history_length\n messages.shift\n messages.pop\n end\n end",
"def build_move_tree(root_node)\n start_pos = root_node.value\n queue = Queue.new \n new_move_positions(start_pos).each do | move |\n move_node = PolyTreeNode.new(move)\n root_node.add_child(move_node)\n end\n end",
"def add_message(message)\r\n fail \"Message needs id\" unless message.respond_to?(:id)\r\n fail \"Message should respond to reply_to\" unless message.respond_to?(:reply_to)\r\n\r\n index = @messages.size-1\r\n unless (message.reply_to.nil?)\r\n index = @messages.find_index { |message_replied| message_replied.message_id.to_i == message.reply_to.to_i }\r\n message.depth = @messages.fetch(index).depth+1\r\n\r\n count = 0\r\n\r\n found = @messages[[email protected]].find do |last_message|\r\n result = last_message.depth < message.depth\r\n count += 1\r\n result\r\n end\r\n\r\n index += count - (found.nil? ? 0 : 1)\r\n end\r\n\r\n @messages.insert(index+1, message)\r\n changed\r\n notify_observers self, message\r\n end",
"def tree(object, locals = {})\n locals = {\n depth: [],\n }.merge(locals)\n\n if locals[:depth].size > @options[:drop]\n if object == object.parent.children.last\n prefix_char = @options[:edge_char]\n else\n prefix_char = @options[:connect_char]\n end\n else\n prefix_char = \"\"\n end\n\n indents = locals[:depth].each.with_index.collect {|e, i|\n if i > @options[:drop]\n tab = e ? @options[:tab_visible_char] : \"\"\n tab.toeuc.ljust(@options[:tab_space]).toutf8\n end\n }.join\n\n if @block\n label = @block.call(object, locals)\n else\n if locals[:depth].empty? && @options[:root_label] # Change if there is root and alternative label\n label = @options[:root_label]\n else\n label = TreeSupport.node_name(object)\n end\n end\n\n buffer = \"\"\n branch_char = nil\n\n if locals[:depth].size > @options[:drop]\n branch_char = @options[:branch_char]\n end\n if locals[:depth].size < @options[:take]\n if locals[:depth].size >= @options[:drop]\n buffer = \"#{indents}#{prefix_char}#{branch_char}#{label}#{@options[:debug] ? locals[:depth].inspect : \"\"}\\n\"\n end\n end\n\n flag = false\n if object.parent\n flag = (object != object.parent.children.last)\n end\n\n locals[:depth].push(flag)\n if locals[:depth].size < @options[:take]\n buffer << object.children.collect {|node| tree(node, locals)}.join\n end\n locals[:depth].pop\n\n buffer\n end",
"def tree\n @roots = @cards.roots\n # TODO: remove jbuilder?\n render :tree, status: :ok\n end",
"def messages( params={} )\n messages = get_connections(\"messages\", params)\n return map_connections messages, :to => Facebook::Graph::Message\n end",
"def build_parsing_tree\n buffer = [] #[[op, rExpr, lExpr], ...]\n @postfix_buffer.each{|s| buffer << (s.class == Array ? s : [s, buffer.pop, buffer.pop]) }\n return buffer.first\n end",
"def text(msg=\"\", nested=false)\n @last_msg = \"\"\n @last_lvl = nil\n\n msg = \"\\n#{msg}\\n \\n\" unless nested\n\n if msg.include?(\"\\n\")\n msg.split(\"\\n\").each do |line|\n text(line, true)\n end\n return\n end\n\n message = colorize(msg, :white, :black, true)\n blocks = colorize(\" \", :black, :white)\n\n puts \"#{blocks} #{message}\"\n end",
"def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend",
"def read_new_messages(last_id=nil)\n newer = \"\"\n newer = \"?newer_than=#{last_id.to_s}\" if last_id\n # Get latest 20 messages\n begin\n reply = @access_token.get(\"/api/v1/messages.xml\" + newer)\n \n# File.open(\"tmp/dump.xml\", \"w\") do |f|\n# f.write reply.body \n# end\n \n # Parse xml. doc has xml, updates has the messages\n doc, @updates = Hpricot::XML(reply.body), []\n \n # First get the names of users\n @names = {}\n (doc/:reference).each do |ref|\n next unless ref.at('type').innerHTML.include? 'user'\n id = ref.at('id').innerHTML\n @names[id] = ref.at('name').innerHTML\n end\n \n # Then the messages\n last_id = 0\n (doc/:message).each do |msg|\n id = msg.at('id').innerHTML\n last_id = id.to_i if last_id < id.to_i\n from = msg.at('sender-id').innerHTML # get the id\n from = @names[from] if @names[from] # get name from id\n time = msg.at('created-at').innerHTML\n content= msg.at('body').at('plain').innerHTML\n @updates << {:id => id, :from => from, :content => content, :time => time}\n end\n \n # Show\n# render :text => make_html(updates, names)\n rescue StandardError, Timeout::Error\n last_id = 0 # Timeouts are very common\n end\n last_id == 0 ? nil : last_id\n end",
"def printf(children=nil)\n queue = [@root]\n result = []\n while queue.length > 0\n new_root = queue.shift\n if new_root.left != nil\n queue.push(new_root.left)\n end\n if new_root.right != nil\n queue.push(new_root.right)\n end\n result.push(\"#{new_root.title}: #{new_root.rating}\")\n end\n result.each {|x| puts x}\n end",
"def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end",
"def link_tree\n ''.html_safe.tap do |content|\n content << toggle_link\n\n unless leaf?\n content << h.content_tag(:ul) do\n h.content_tag_for(:li, children) do |c|\n c.decorate.link_tree\n end\n end\n end\n end\n end",
"def show\n @messaging = @message.messagings.where(recipient_id: current_user.id).first\n if [email protected]?\n @messaging.status = 1\n @messaging.save\n end\n @children = Messaging.where('message_id in (?) AND recipient_id = ?', @message.children.pluck(:id), current_user.id)\n for child in @children\n child.status = 1\n child.save\n end\n if !params[:page].blank?\n @page = params[:page]\n else\n @page = 1\n end\n if !params[:type].blank?\n @type = params[:type]\n else\n @type = 'inbox'\n end\n end",
"def messages\n @messages ||= []\n end",
"def messages\n @messages ||= []\n end",
"def get_messages( page=0 )\n\t result = []\n\t if page > 0\n\t response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n\t JSON.parse( response.body )\n\t else\n\t response = self.class.get( '/message_threads', body: { page: 1 }, headers: {'authorization' => @auth_token} )\n for page in 1..(response[\"count\"]/10 + 1)\n response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n result << JSON.parse(response.body)\n end\n result\n\t end\n\tend",
"def messages\n @set.map(&:message).sort\n end",
"def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end",
"def node_init node\n @messages\n end",
"def index\n @node_messages = NodeMessage.all\n end",
"def latex_qtree\n \"\\\\Tree \" + to_s(delim='[]', nonterm_prefix='.')\n end",
"def to_node\n node = XMPPNode.new('error')\n node.namespace = {'stream' => Blather::Stream::STREAM_NS}\n\n node << (err = XMPPNode.new(@name, node.document))\n err.namespace = 'urn:ietf:params:xml:ns:xmpp-streams'\n\n if self.text\n node << (text = XMPPNode.new('text', node.document))\n text.namespace = 'urn:ietf:params:xml:ns:xmpp-streams'\n text.content = self.text\n end\n\n self.extras.each { |extra| node << extra.dup }\n node\n end",
"def traverse\n nodes = [self]\n until nodes.empty?\n node = nodes.pop\n yield node\n nodes += node.children.reverse unless node.children.empty?\n end\n end",
"def do_reply(msg)\n\n workitem = msg['workitem']\n fei = workitem['fei']\n\n removed = h.children.delete(fei)\n # accept without any check ?\n\n if msg['flanking']\n\n (h.flanks ||= []) << fei\n\n if (not removed) # then it's a timer\n\n do_persist\n return\n end\n end\n\n if ut = msg['updated_tree']\n\n ct = tree.dup\n ct.last[Ruote::FlowExpressionId.child_id(fei)] = ut\n update_tree(ct)\n end\n\n if h.state == 'paused'\n\n (h.paused_replies ||= []) << msg\n\n do_persist\n\n elsif h.state != nil # failing or timing out ...\n\n if h.children.size < 1\n reply_to_parent(workitem)\n else\n #persist_or_raise # for the updated h.children\n do_persist\n end\n\n else # vanilla reply\n\n reply(workitem)\n end\n end",
"def tree_results(word_data)\n #get the data ready for d3 view\n tree_data = {\"name\"=> (@topic.name), \"info\" => \"tst\", \"children\" => []}\n \n word_data.each do |text, v|\n tree_data[\"children\"].push({\"name\" => text.to_s, \"children\" => []})\n end\n \n tree_data[\"children\"][0][\"children\"] << Hash[\"name\", word_data[:word]]\n \n word_data[:definitions].each do |text|\n tree_data[\"children\"][1][\"children\"] << Hash[\"name\", text[\"text\"]]\n end\n \n word_data[:word_associations].each do |text|\n tree_data[\"children\"][2][\"children\"] << Hash[\"name\", text[\"relationshipType\"], \"children\", []]\n end \n if word_data[:reverse_definitions][\"results\"].nil? \n tree_data[\"children\"][3][\"children\"] << nil\n else\n word_data[:reverse_definitions][\"results\"].each do |result| \n tree_data[\"children\"][3][\"children\"] << Hash[\"name\", result[\"text\"]]\n end\n end\n i = 0\n word_data[:word_associations].each do |text|\n text[\"words\"].each do |word|\n tree_data[\"children\"][2][\"children\"][i][\"children\"] << Hash[\"name\", word]\n end\n i+=1\n end\n #reduce duplicates in word_association hash\n tree_data[\"children\"][3][\"children\"].uniq!\n tree_data[\"children\"][2][\"children\"].uniq!\n return tree_data\n end"
] |
[
"0.58822316",
"0.5474144",
"0.5343977",
"0.5229514",
"0.5110403",
"0.51060605",
"0.50866956",
"0.5069726",
"0.5020287",
"0.5011909",
"0.50047123",
"0.49855068",
"0.49716163",
"0.4966702",
"0.4957564",
"0.49504575",
"0.49454376",
"0.49313998",
"0.4927287",
"0.4925083",
"0.49217734",
"0.48995212",
"0.48990384",
"0.4889048",
"0.48882607",
"0.4853468",
"0.48493624",
"0.48258942",
"0.48154902",
"0.48133922",
"0.47986323",
"0.4790804",
"0.47866538",
"0.47796062",
"0.47768074",
"0.4762372",
"0.47618043",
"0.47602865",
"0.47559172",
"0.47537056",
"0.47528663",
"0.47352472",
"0.47348943",
"0.4730315",
"0.47247085",
"0.4718635",
"0.47174853",
"0.4714674",
"0.47128704",
"0.4703947",
"0.46941665",
"0.46931165",
"0.46900648",
"0.46891648",
"0.46850565",
"0.4680344",
"0.4678172",
"0.46771267",
"0.46759227",
"0.46745363",
"0.46659437",
"0.4662677",
"0.46535808",
"0.465245",
"0.4651288",
"0.46483478",
"0.46381828",
"0.4633009",
"0.46292418",
"0.46287823",
"0.46284485",
"0.46266487",
"0.46239248",
"0.46219754",
"0.46203864",
"0.46138814",
"0.46099192",
"0.46086454",
"0.46050444",
"0.4602699",
"0.46003148",
"0.45959392",
"0.4587737",
"0.4586433",
"0.45808265",
"0.4580047",
"0.4575655",
"0.45739597",
"0.4572253",
"0.4572253",
"0.45679292",
"0.45661703",
"0.456427",
"0.45571917",
"0.45470947",
"0.45435786",
"0.45299464",
"0.4523137",
"0.45220602",
"0.4520051"
] |
0.7395399
|
0
|
we'll use the reserved word super to call Monster's initialize and keep our code more DRY
|
def initialize (threat_level=:medium)
# note that zombies created without a threat level
# will still have a default threat_level of :medium
super(threat_level)
@habitat = "graveyard"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(...)\n super\n mon_initialize\n end",
"def initialize() end",
"def initialize(*args)\n super\n mon_initialize\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n \n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n\t\t\n\tend",
"def initialize\n\tinit\n\tsuper\nend",
"def initialize(*_)\n super\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize\n\n\n\n end",
"def init\n\n end",
"def initialize()\r\n\r\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize()\n # override parent\n end",
"def initialize()\n end",
"def initialize\r\n\r\n end",
"def initialize\n init\n end",
"def initialize\n super(true)\n end",
"def initialize\n \n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize(*args)\r\n super(*args)\r\n end",
"def initialize()\n\t\tend",
"def initialize(*args)\n super *args\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize(*args)\n super(*args)\n end",
"def initialize()\n\tend",
"def initialize()\n\tend",
"def init; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize *args\n super\n end",
"def initialize\nend",
"def initialize()\n\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.8007021",
"0.7919353",
"0.791829",
"0.7752017",
"0.7752017",
"0.7752017",
"0.7752017",
"0.77134377",
"0.77134377",
"0.77134377",
"0.77134377",
"0.77134377",
"0.76947504",
"0.76947504",
"0.7581099",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7546463",
"0.750463",
"0.7498797",
"0.7497076",
"0.7497076",
"0.7497076",
"0.7482801",
"0.7482801",
"0.7435339",
"0.74018216",
"0.7399246",
"0.73906463",
"0.73906463",
"0.73906463",
"0.73906463",
"0.73906463",
"0.73906463",
"0.73906463",
"0.7373964",
"0.73711216",
"0.73677045",
"0.7360148",
"0.7353376",
"0.7334154",
"0.73264325",
"0.73264325",
"0.73264325",
"0.73264325",
"0.73264325",
"0.73264325",
"0.73264325",
"0.73264325",
"0.7316614",
"0.7316115",
"0.73107594",
"0.7287753",
"0.7287753",
"0.7287753",
"0.72849405",
"0.72849405",
"0.72739166",
"0.72523224",
"0.72523224",
"0.7236119",
"0.72242373",
"0.72242373",
"0.72132486",
"0.72114575",
"0.7181417",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218",
"0.7178218"
] |
0.0
|
-1
|
GET /entries GET /entries.xml
|
def index
#@tags = Entry.author_counts
@filter = params[:filter]
@sort_by = params[:sort_by]
if (@filter)
@entries = Entry.tagged_with(params[:filter], :order => @sort_by)
else
@entries = Entry.find(:all, :order => @sort_by)
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @entries }
format.rss { render :rss => @entries }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def index\n @entries = list_entries\n respond_with @entries\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def rss_entries(url)\n\t\tresponse = fetch(url)\n\t\tresponse[\"feed\"][\"entry\"]\n\tend",
"def index\n #body, ok = SuperfeedrEngine::Engine.retrieve(Feed.first) \n @entries = Entry.all\n end",
"def index\n @entries = Entry.find_all_by_time(params[:date], :order => :created_at)\n @entry ||= Entry.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def get_entries\n @page.all(input_elements[:entries])\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def entries(query = {})\n resp =\n _instrument 'entries', type: 'Entry', query: query do\n get('entries', query)\n end\n resp.assert_ok!\n end",
"def entries\n trace 'entries'\n $data['entries']\n end",
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def index\n entries\n end",
"def index\n @feed_entries = FeedEntry.all\n @title = \"Feeds List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feed_entries }\n end\n end",
"def entries\n nodes = @doc.xpath(\"atom:feed/atom:entry\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomFeedEntry.new(node) }\n end",
"def show\n @entry = @entries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def entry_list\n unless params[:version] == '3.0'\n raise ActionController::RoutingError.new('Not Found')\n end\n\t\t\n @event = Event.find(params[:id])\n respond_to do |format|\n format.xml { render :layout => false }\n end\n end",
"def index\n @r_entries = REntry.all\n end",
"def entries\n trace 'entries'\n @data['entries']\n end",
"def index\n @entries = Entry.all.first(100)\n end",
"def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def index\n @entries = Entry\n .paginate(:page => params[:page], :per_page => 10)\n .find_all_by_entry_type(params[:entry_type].presence || 'post', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def entries\n Entry.where(:feed_id => pk)\n end",
"def entries\n data[:entries]\n end",
"def list_entries\n\nend",
"def entries\n AllEntries.new(Page.new(latest_events_path, @mingle_access))\n end",
"def show\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def __entries__\n @entries\n end",
"def index\n @user = User.find(params[:user_id])\n @entries = @user.entries.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @feed_entries = FeedEntry.all\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def entries\n @entries ||= Scraper.instance.get_all(Entry, @path, [\n [:reflex, 'td[2]/text()'],\n [:description, 'td[3]/text()'],\n [:language_name, 'td[1]/a/text()'],\n [:language_path, 'td[1]/a/@href'],\n [:source_code, 'td[4]/a/text()'],\n [:source_path, 'td[4]/a/@href'],\n [:reconstruction_name, nil, lambda {|x| @protoform}],\n [:reconstruction_path, nil, lambda {|x| @path}],\n [:flag, \"td[3]/span[@class='flag']/text()\"]\n ], 1)\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def entries\n @entries ||= Scraper.instance.get_all(Entry, @path, [\n [:reflex, 'td[2]/text()'],\n [:description, 'td[3]/text()'],\n [:language_name, nil, lambda {|x| @name}],\n [:language_path, nil, lambda {|x| @path}],\n [:source_code, 'td[4]/a/text()'],\n [:source_path, 'td[4]/a/@href'],\n [:flag, \"td[3]/span[@class='flag']/text()\"]\n ])\n end",
"def index_entries(opts = {})\n data, _status_code, _headers = index_entries_with_http_info(opts)\n data\n end",
"def show\n @feed = Feed.find(params[:id])\n @entries = EntryFeed.where(:feed_id => @feed.id)\n\n if @entries.blank?\n EntryFeed.create_from_feed(@feed)\n @entries = EntryFeed.where(:feed_id => @feed.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feed }\n end\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_entry }\n end\n end",
"def index\n @feeds = Feed.all\n\n # fetching a single feed\n #@feed = Feedzirra::Feed.fetch_and_parse(\"http://feeds.feedburner.com/PaulDixExplainsNothing\")\n\n # @entries = @feed.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @feeds }\n end\n end",
"def entries\n require_initialized_entry_class do \n Array.load(self[:@entries_url])\n end\n end",
"def show\n @subentry = Subentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @subentry }\n end\n end",
"def show_all_entries()\n\n puts @title\n\n @entries.each do |entry|\n puts entry\n end\n\n end",
"def index\n @entries = Entry.new\n end",
"def get_atom_entry(url)\n res = get(url, \"Accept\" => \"application/atom+xml\")\n\n # XXX handle other HTTP codes\n if res.code != \"200\"\n raise Atom::HTTPException, \"failed to fetch entry: expected 200 OK, got #{res.code}\"\n end\n\n # be picky for atom:entrys\n res.validate_content_type( [ \"application/atom+xml\" ] )\n\n Atom::Entry.parse(res.body, url)\n end",
"def show\n @feed = Feed.find(params[:id])\n @related_feeds = @feed.list_related_feeds(current_user)\n @feed_entries = Entry.where(feed_id: @feed.id).order(\"updated_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html {}\n format.json { render json: @entry }\n end\n end",
"def xml\n @entry ||= open(entry_url).read\n rescue => e\n raise RuntimeError, \"coult not open entry url: #{entry_url} : \\n#{e}\"\n end",
"def entries\n params[:return_entries] = true\n self\n end",
"def get_elements entry\n xml = entry.to_xml\n\n b = Atom::Entry.parse(xml)\n\n assert_equal(xml.to_s, b.to_s)\n\n base_check xml\n\n xml\n end",
"def index\n @entries = Entry.all.order(:created_at).page params[:page]\n\n\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry }\n end\n end",
"def index\n if params[:dictionary_id]\n @dictionary = Dictionary.find(params[:dictionary_id])\n @entries = @dictionary.entries\n else\n @entries = Entry.all\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def entries\n @controller.send(:entries)\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journal_entry }\n end\n end",
"def index\n @title = \"医药招商\"\n @entries = Entry.recent.includes(:user).page(params[:page] || 1).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n #@tags = Entry.author_counts\n\t@filter = params[:filter]\n\t@sort_by = params[:sort_by]\n\t\n\tif params[:search]\n\t\t@entries = Entry.search(params[:search])\n\t\t#@entries = search.results\n\telsif @filter\n\t\t@entries = Entry.tagged_with(params[:filter], :order => @sort_by)\n\telse\n\t\t@entries = Entry.find(:all, :order => @sort_by)\n end\n\t\n\t@entries = @entries.paginate\t:page =>params[:page], :per_page => 5\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n\t format.rss { render :rss => @entries }\n end\n end",
"def show\n @journalentry = Journalentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journalentry }\n end\n end",
"def entries(options={})\n validate_entries_options(options)\n entry_class = Harvest::Resources::Entry.clone\n entry_class.project_id = self.id\n entry_class.find :all, :params => format_params(options)\n end",
"def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n @comments = @entry.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def index_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.index_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?\n query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?\n query_params[:'from_date'] = opts[:'from_date'] if !opts[:'from_date'].nil?\n query_params[:'to_date'] = opts[:'to_date'] if !opts[:'to_date'].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(['*/*'])\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] || 'Array<Entry>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.index_entries\",\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: EntriesApi#index_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @entries = Entry.ordered\n end",
"def show\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# Entry filter\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\t# Pager\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('baseentry', 'list', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end",
"def show\n @feed = Feed.find(params[:feed_id])\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html { render :layout => 'feed'}\n format.json { render json: @entry }\n end\n end",
"def index\n @atoms = Atom.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @atoms }\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 index\n @entries = @category.entries \nend",
"def entries(options = {})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{index + 1}\"] = filter.join(' ')\n end\n end\n\n query[:pageSize] = options[:limit] if options[:limit]\n\n query[:pageStart] = options[:pageStart] if options[:pageStart]\n\n query[:system] = true if options[:system]\n\n if options[:sort]\n field, direction = options[:sort].split(' ')\n query[:sort] = field\n query[:sortDirection] = direction || 'ASC'\n end\n\n @party.get(\"forms/#{@id}/entries\", query: query)['Entries']\n end",
"def index\n @exp_entries = ExpEntry.all\n end",
"def entries(options={})\n return @entries if @entries and options == {} \n validate_options(options)\n @entries = Harvest::Resources::Entry.find(:all, :conditions => {:person_id => self.id}, :params => format_params(options))\n end",
"def get_entries(json: nil, ld: nil)\n entries = []\n data = ld ? ld[self.uri] : nil\n if data\n data.each do |key, value|\n prefix, index = key.split('_')\n entries[index.to_i - 1] = self.factory.get(value[0]['value'], self, ld: ld) if prefix == KEY_PREFIX\n end\n end\n entries\n end",
"def index\n\n #@entries = Entry.find(:all, :include => :transactions)\n\t@entries = Entry.order('entries.date DESC').includes(:transactions)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n max_length = get_max_transaction_length\n entry_strings = @entries.map do |entry|\n entry.render_text max_length\n end.reduce { |x, y| x + \"\\n\" + y}\n format.text { render :text => entry_strings }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n end",
"def show\n @entry = Entry.find(params[:id])\n end",
"def entries(limit=nil)\n limit ||= -1\n LiveJournal::Request::GetEvents.new(@user, :recent => limit, :strict => false).run\n end",
"def entries\n @list\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @journal_entry }\n format.xml { render :xml => @journal_entry }\n end\n end",
"def entries; end",
"def entries; end"
] |
[
"0.73774385",
"0.7352769",
"0.723138",
"0.70918024",
"0.6968695",
"0.6959239",
"0.6927212",
"0.689944",
"0.6817086",
"0.67637634",
"0.6759492",
"0.6714782",
"0.66889846",
"0.66414034",
"0.66272306",
"0.661824",
"0.661824",
"0.661824",
"0.661824",
"0.661824",
"0.661824",
"0.64885634",
"0.64885634",
"0.6469027",
"0.63780856",
"0.636982",
"0.6328746",
"0.63026094",
"0.62972844",
"0.6291543",
"0.6281216",
"0.62715846",
"0.62707305",
"0.62698054",
"0.62635964",
"0.6245441",
"0.6217026",
"0.6166394",
"0.6137952",
"0.61237574",
"0.60962313",
"0.6074436",
"0.60694796",
"0.60681057",
"0.6065377",
"0.60460263",
"0.6045254",
"0.6044388",
"0.60396624",
"0.60329145",
"0.60281324",
"0.6020806",
"0.6001371",
"0.5984762",
"0.5965608",
"0.5957494",
"0.5946779",
"0.5937155",
"0.59179586",
"0.5899821",
"0.5882641",
"0.5880551",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5877855",
"0.5865955",
"0.5857203",
"0.5855195",
"0.58244705",
"0.5821547",
"0.58213073",
"0.581198",
"0.5793308",
"0.57900596",
"0.57856935",
"0.5784757",
"0.577949",
"0.57787144",
"0.5776882",
"0.5771603",
"0.5767777",
"0.5762335",
"0.574862",
"0.5747673",
"0.57452375",
"0.5744959",
"0.5711142",
"0.5708705",
"0.5708705",
"0.5697917",
"0.5687902",
"0.5684842",
"0.5682511",
"0.5682511"
] |
0.60191774
|
52
|
GET /entries/1 GET /entries/1.xml
|
def show
@entry = Entry.find(params[:id])
@entry.viewed += 1
@entry.update_attributes(params[:entry])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @entry }
format.rss { render :rss => @entry }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def index\n @entries = Entry.find_all_by_time(params[:date], :order => :created_at)\n @entry ||= Entry.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n #body, ok = SuperfeedrEngine::Engine.retrieve(Feed.first) \n @entries = Entry.all\n end",
"def show\n @entry = @entries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def rss_entries(url)\n\t\tresponse = fetch(url)\n\t\tresponse[\"feed\"][\"entry\"]\n\tend",
"def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def show\n @subentry = Subentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @subentry }\n end\n end",
"def show\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def index\n @entries = list_entries\n respond_with @entries\n end",
"def entry_list\n unless params[:version] == '3.0'\n raise ActionController::RoutingError.new('Not Found')\n end\n\t\t\n @event = Event.find(params[:id])\n respond_to do |format|\n format.xml { render :layout => false }\n end\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_entry }\n end\n end",
"def index\n @feed_entries = FeedEntry.all\n @title = \"Feeds List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feed_entries }\n end\n end",
"def xml\n @entry ||= open(entry_url).read\n rescue => e\n raise RuntimeError, \"coult not open entry url: #{entry_url} : \\n#{e}\"\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journal_entry }\n end\n end",
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @journalentry = Journalentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journalentry }\n end\n end",
"def get_atom_entry(url)\n res = get(url, \"Accept\" => \"application/atom+xml\")\n\n # XXX handle other HTTP codes\n if res.code != \"200\"\n raise Atom::HTTPException, \"failed to fetch entry: expected 200 OK, got #{res.code}\"\n end\n\n # be picky for atom:entrys\n res.validate_content_type( [ \"application/atom+xml\" ] )\n\n Atom::Entry.parse(res.body, url)\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def show\n @feed = Feed.find(params[:id])\n @entries = EntryFeed.where(:feed_id => @feed.id)\n\n if @entries.blank?\n EntryFeed.create_from_feed(@feed)\n @entries = EntryFeed.where(:feed_id => @feed.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feed }\n end\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def index\n @entries = Entry.all.first(100)\n end",
"def index\n entries\n end",
"def show\n @feed = Feed.find(params[:id]) rescue Feed.find_by_uri(params[:id])\n if @feed.is_duplicate? and @feed.duplicate\n redirect_to feed_url(@feed.duplicate)\n else\n respond_to do |wants|\n wants.html do\n render :action => 'show'\n end\n wants.atom do\n render :xml => @feed.to_atom(:base => \"http://#{request.host}:#{request.port}\", :include_entries => true, :page => params[:page]) \n end\n wants.xml { render :xml => @feed.to_xml }\n end\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html {}\n format.json { render json: @entry }\n end\n end",
"def entries(query = {})\n resp =\n _instrument 'entries', type: 'Entry', query: query do\n get('entries', query)\n end\n resp.assert_ok!\n end",
"def get_entries\n @page.all(input_elements[:entries])\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @journal_entry }\n format.xml { render :xml => @journal_entry }\n end\n end",
"def entries\n Entry.where(:feed_id => pk)\n end",
"def show\n @entry = Entry.find(params[:id])\n\[email protected] += 1\n\[email protected]_attributes(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n\t format.rss { render :rss => @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry }\n end\n end",
"def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @feed = Feed.find(params[:feed_id])\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html { render :layout => 'feed'}\n format.json { render json: @entry }\n end\n end",
"def index\n @entries = Entry\n .paginate(:page => params[:page], :per_page => 10)\n .find_all_by_entry_type(params[:entry_type].presence || 'post', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\r\n @feed = Feed.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @rss_entry }\r\n end\r\n end",
"def index\n @r_entries = REntry.all\n end",
"def show\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n @comments = @entry.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def entries\n trace 'entries'\n $data['entries']\n end",
"def show\n @twitterfeed = Twitterfeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @twitterfeed }\n end\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def index\n @feeds = Feed.all\n\n # fetching a single feed\n #@feed = Feedzirra::Feed.fetch_and_parse(\"http://feeds.feedburner.com/PaulDixExplainsNothing\")\n\n # @entries = @feed.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @feeds }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n end",
"def show\n @entry = Entry.find(params[:id])\n end",
"def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def show\n @feed = Feed.find(params[:id])\n @related_feeds = @feed.list_related_feeds(current_user)\n @feed_entries = Entry.where(feed_id: @feed.id).order(\"updated_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def list_entries\n\nend",
"def show\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @hour_entry = HourEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hour_entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end",
"def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end",
"def show\n @blog_entry = BlogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def index\n @feed_entries = FeedEntry.all\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def show\n @datafeed = Datafeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datafeed }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @entries = @user.entries.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n @feed_entry.set_read\n @title = @feed_entry.title\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_entry }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n # @entry = @activity.entries.find (params[:id])\n\n end",
"def index\n @entries = Entry.new\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def show\n# @term = Term.find(params[:id])\n @term = Term.where(:name=>params[:name]).first\n\t\tif @term.nil?\n @term = Term.new\n redirect_to( @term, :notice => \"Term '#{params[:name]}' not exists yet\" )\n return\n\t\tend\n\n @entries = @term.entries\n logger.debug \"entries #{@entries}\"\n @entries.each do |entry|\n logger.debug \"entry.id #{entry.id}\"\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def index\n #@tags = Entry.author_counts\n\t@filter = params[:filter]\n\t@sort_by = params[:sort_by]\n\t\n\tif (@filter)\n\t\t@entries = Entry.tagged_with(params[:filter], :order => @sort_by)\n\telse\n\t\t@entries = Entry.find(:all, :order => @sort_by)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n\t format.rss { render :rss => @entries }\n end\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @bib_entry = BibEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bib_entry }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed_entry }\n end\n end",
"def index_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.index_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?\n query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?\n query_params[:'from_date'] = opts[:'from_date'] if !opts[:'from_date'].nil?\n query_params[:'to_date'] = opts[:'to_date'] if !opts[:'to_date'].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(['*/*'])\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] || 'Array<Entry>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.index_entries\",\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: EntriesApi#index_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def entries\n AllEntries.new(Page.new(latest_events_path, @mingle_access))\n end",
"def index\n @entries = Entry.all.order(:created_at).page params[:page]\n\n\n end",
"def index\n if params[:dictionary_id]\n @dictionary = Dictionary.find(params[:dictionary_id])\n @entries = @dictionary.entries\n else\n @entries = Entry.all\n end\n end",
"def index\n @atoms = Atom.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @atoms }\n end\n end",
"def get_elements entry\n xml = entry.to_xml\n\n b = Atom::Entry.parse(xml)\n\n assert_equal(xml.to_s, b.to_s)\n\n base_check xml\n\n xml\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 new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def show\n @entry = Entry.where(:numid => params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def print_my_recent_bookmarks(username, password)\n # Make the HTTPS request.\n response = open('https://api.del.icio.us/v1/posts/recent',\n :http_basic_authentication => [username, password])\n\n # Read the response entity-body as an XML document.\n xml = response.read\n\n # Turn the document into a data structure.\n document = REXML::Document.new(xml)\n\n # For each bookmark...\n REXML::XPath.each(document, \"/posts/post\") do |e|\n # Print the bookmark's description and URI\n puts \"#{e.attributes['description']}: #{e.attributes['href']}\"\n end\nend",
"def show\n @entry_view = EntryView.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry_view }\n end\n end",
"def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end"
] |
[
"0.7118641",
"0.71141446",
"0.68437636",
"0.6827899",
"0.6716551",
"0.6700706",
"0.6700706",
"0.66596735",
"0.6640895",
"0.656696",
"0.64813584",
"0.6418889",
"0.639086",
"0.6332453",
"0.63303244",
"0.6318188",
"0.62884516",
"0.6286663",
"0.62810963",
"0.6236334",
"0.616893",
"0.6152802",
"0.61257637",
"0.61067665",
"0.6097586",
"0.6097586",
"0.6097586",
"0.6097586",
"0.6097586",
"0.6097586",
"0.60698473",
"0.6065954",
"0.60536677",
"0.6033835",
"0.5937019",
"0.5932358",
"0.5931049",
"0.59181535",
"0.5898295",
"0.5897504",
"0.58911824",
"0.5887701",
"0.5885109",
"0.58722365",
"0.58722365",
"0.58722365",
"0.58722365",
"0.58722365",
"0.58722365",
"0.58722365",
"0.58722365",
"0.58722365",
"0.5871707",
"0.5865277",
"0.5847593",
"0.58466303",
"0.58435386",
"0.5834073",
"0.58143324",
"0.5798589",
"0.57954085",
"0.5786159",
"0.57816786",
"0.577949",
"0.577949",
"0.57612354",
"0.57591575",
"0.57590014",
"0.5744495",
"0.57327145",
"0.5725743",
"0.5712237",
"0.5711146",
"0.57022965",
"0.5695485",
"0.56946015",
"0.56931835",
"0.56878805",
"0.56845176",
"0.56841",
"0.5681832",
"0.56795347",
"0.5665267",
"0.56652355",
"0.5658673",
"0.5637921",
"0.5633729",
"0.56276464",
"0.56172043",
"0.5616239",
"0.56048715",
"0.56033665",
"0.560031",
"0.55873644",
"0.5583203",
"0.5582468",
"0.5578566",
"0.5567085",
"0.5566327",
"0.55594957"
] |
0.59057677
|
38
|
GET /entries/new GET /entries/new.xml
|
def new
authenticate_user!
@entry = Entry.new
@systems = Array.new[System.find(:all).size]
@components = Array.new[Component.find(:all).size]
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @entry }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @journalentry = Journalentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journalentry }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal_entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n @entry = Entry.new\n @folders = Folder.find(:all, :order => \"updated_at DESC\").map { |f| [f.name, f.id] }\n @new = true;\n\n respond_to do |format|\n format.html { render \"edit\" }\n format.xml { render :xml => @entry }\n end\n end",
"def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end",
"def new\n @feed = Feed.find(params[:feed_id])\n @entry = @feed.entries.new\n respond_to do |format|\n format.html { render :layout => 'feed'}\n format.json { render json: @entry }\n end\n end",
"def new\n @attachment = Attachment.new\n @entries = Entry.find(:all, :order => \"updated_at DESC\").map { |e| [e.title, e.id] }\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @attachment }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @journal_entry }\n format.xml { render :xml => @journal_entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @twitterfeed = Twitterfeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitterfeed }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @entry = Entry.new\n\n render json: @entry\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def new\n @feedentry = Feedentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedentry }\n end\n end",
"def new\n @feed = Feed.new\n @page_title = 'Add Feed'\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @feed }\n end\n end",
"def new\n @feed_entry = FeedEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed_entry }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holder }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @feed_entry = FeedEntry.new\n @project = Project.find(params[:project_id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feed_entry }\n end\n end",
"def create\n logger.info \"Creating Entry\"\n @entry = Entry.new(params[:entry])\n logger.info \"Entry Created\"\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(entries_url, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @entry_view = EntryView.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry_view }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @datafeed = Datafeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datafeed }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end",
"def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end",
"def new\n @populate_feed_info = PopulateFeedInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @populate_feed_info }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @resource }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @page }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end",
"def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end",
"def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @entry = Entry.new\n 2.times { @entry.transactions.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new\n @recipe = Recipe.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @typo = Typo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @typo }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end",
"def new\n @blog_entry = BlogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end",
"def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end",
"def new\n @todos = Todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todos }\n end\n end",
"def new\n @hour_entry = HourEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hour_entry }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @changelog = Changelog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @changelog }\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n flash[:notice] = 'Entry was successfully created.'\n format.html { redirect_to(@entry) }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @creation = Creation.new\n @topics = Topic.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creation }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @post404 = Post404.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post404 }\n end\n end",
"def new\n @entry_type = EntryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry_type }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @event }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(@entry, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"def new\n @add_on = AddOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_on }\n end\n end"
] |
[
"0.7487182",
"0.74756294",
"0.73580587",
"0.72526073",
"0.69531655",
"0.6934435",
"0.6929773",
"0.69131255",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.6893476",
"0.68658763",
"0.6830648",
"0.6801082",
"0.67548615",
"0.6722641",
"0.6691154",
"0.6674895",
"0.6613153",
"0.6599405",
"0.65650576",
"0.6542921",
"0.6516977",
"0.65070534",
"0.6491897",
"0.6490991",
"0.6477392",
"0.6477392",
"0.6477392",
"0.6465812",
"0.6456824",
"0.6454793",
"0.64523214",
"0.64523214",
"0.64450324",
"0.64447856",
"0.6435095",
"0.6429157",
"0.6428736",
"0.6428273",
"0.64265466",
"0.6416754",
"0.64114636",
"0.64114636",
"0.64025885",
"0.6400997",
"0.6400997",
"0.6387346",
"0.63870865",
"0.6386583",
"0.6384631",
"0.63816863",
"0.63816863",
"0.63744307",
"0.63738924",
"0.6365195",
"0.63602644",
"0.6348739",
"0.63426685",
"0.63407594",
"0.63392085",
"0.6314972",
"0.6314972",
"0.631029",
"0.63093174",
"0.63058263",
"0.63051164",
"0.63051164",
"0.6303992",
"0.6293866",
"0.62919635",
"0.6291799",
"0.6291799",
"0.6291799",
"0.6291799",
"0.6291799",
"0.6291799",
"0.62876886",
"0.62859505",
"0.62832433",
"0.6282427",
"0.6280084",
"0.6278772",
"0.626909",
"0.6266784",
"0.6264151",
"0.62606114",
"0.6260605",
"0.6260605",
"0.6260605",
"0.625922",
"0.6258774",
"0.6257335",
"0.62552005"
] |
0.66272086
|
24
|
POST /entries POST /entries.xml
|
def create
@entry = Entry.new(params[:entry])
@entry.viewed = 0
@entry.user_id = current_user
@systems = params[:systems]
@systems.each do |s|
@entry.system_list.add(s)
end
@components = params[:components]
@components.each do |c|
@entry.comp_list.add(c)
end
respond_to do |format|
if @entry.save
format.html { redirect_to(@entry, :notice => 'Entry was successfully created.') }
format.xml { render :xml => @entry, :status => :created, :location => @entry }
else
format.html { render :action => "new" }
format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n logger.info \"Creating Entry\"\n @entry = Entry.new(params[:entry])\n logger.info \"Entry Created\"\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(entries_url, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\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 create_entries(opts = {})\n data, _status_code, _headers = create_entries_with_http_info(opts)\n data\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(@entry, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n flash[:notice] = 'Entry was successfully created.'\n format.html { redirect_to(@entry) }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to \"/entries/#{@entry.id}\" }\n format.json { render :show }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n if @entry.valid?\n @entry.save\n render json: @entry, status: :created\n # , location: @entry\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed = Feed.find(params[:feed_id])\n @entry = @feed.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n @entry.author.save\n format.html { redirect_to feed_entry_path(@feed,@entry), notice: 'Entry was successfully created.' }\n format.json { render json: feed_entry_path(@feed, @entry), status: :created, location: feed_entry_path(@feed, @entry) }\n else\n format.html { render action: \"new\" }\n format.json { render json: feed_entry_path(@feed,@entry).errors, status: :unprocessable_entity }\n end\n end\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.create_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\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(['*/*'])\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[:debug_body] || @api_client.object_to_http_body(opts[:'create_entries_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Entry'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.create_entries\",\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: EntriesApi#create_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @entry = Entry.new(entry_params)\n\n flash[:notice] = 'Entry was successfully created.' if @entry.save\n respond_with(@entry)\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def post(opts = {})\n return ':data argument not provided' unless opts[:data]\n \n type = opts[:type] || Names::AtomEntryMediaType\n @invoker = Poster.new(@uri, @authent)\n @invoker['Slug'] = opts[:slug] if opts[:slug]\n \n if @invoker.post(type, opts[:data]) \n @invoker.entry \n else\n @invoker.last_error \n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @current_user.entries << @entry\n format.html { redirect_to user_entries_path, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_entries entries, log_name: nil, resource: nil, labels: nil\n ensure_connection!\n resp = connection.write_entries Array(entries).map(&:to_gapi),\n log_name: log_name,\n resource: resource, labels: labels\n return true if resp.success?\n fail ApiError.from_response(resp)\n end",
"def create\n @entry = @resource_finder.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n flash[:notice] = \"Entry for #{@entry.player.full_name} was entered.\"\n format.html { redirect_to_new_resource }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = current_user.entries.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Your entry has been posted!' }\n format.json { render action: 'show', status: :created, location: @entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(:action => :index, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html do\n @entries = Entry.find_all_by_time params[:date]\n render :action => \"index\"\n end\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_rest\n @entry_answer = EntryAnswer.new(params[:entry_answer])\n\n respond_to do |format|\n if @entry_answer.save\n flash[:notice] = 'EntryAnswer was successfully created.'\n format.html { redirect_to(@entry_answer) }\n format.xml { render :xml => @entry_answer, :status => :created, :location => @entry_answer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end",
"def create\n @entry = Entry.new(entry_params)\n #binding.pry\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed_entry = FeedEntry.new(params[:feed_entry])\n\n respond_to do |format|\n if @feed_entry.save\n flash[:notice] = 'FeedEntry was successfully created.'\n format.html { redirect_to(@feed_entry) }\n format.xml { render :xml => @feed_entry, :status => :created, :location => @feed_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(:feed_id, :atom_id, :title, :url, :content)\n end",
"def create\n\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n @today_entries = Entry.where(\"date = ?\", Date.today)\n @yesterday_entries = Entry.where(\"date = ?\", Date.yesterday)\n format.html { render :action => :index }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to [:admin, @entry], notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = current_user.entries.build(entry_params)\n if @entry.save\n render json: EntrySerializer.new(@entry), status: :created\n else\n render json: { error: @entry.errors.full_messages.to_sentence}, status: :unprocessable_entity\n end\n end",
"def create\n params[:entry].delete(\"freigeschaltet\")\n @entry = Entry.new(entry_params)\n @entry.user = current_user unless @entry.user_id.present?\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Eintrag erfolgreich erstellt.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @content_entry = Content::Entry.new(content_entry_params)\n\n respond_to do |format|\n if @content_entry.save\n format.html { redirect_to @content_entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @content_entry }\n else\n format.html { render :new }\n format.json { render json: @content_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n resource.post(request, response)\n end",
"def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end",
"def create\n @entry = current_user.entries.build(entry_params)\n if @entry.save\n flash[:success] = \"Entry created!\"\n redirect_to root_url\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def create_entries(doc)\n return nil\n end",
"def entries\n params[:return_entries] = true\n self\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def create\n @feed_entry = FeedEntry.new(feed_entry_params)\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to @feed_entry, notice: 'Feed entry was successfully created.' }\n format.json { render :show, status: :created, location: @feed_entry }\n else\n format.html { render :new }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n @entry['user_id'] = current_user.id\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def test_can_post_valid_entry\n valid_entry = SEED_ENTRIES.first\n post_json '/api/entries', valid_entry.except(:slug)\n\n assert last_response.created?\n\n location = \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.headers['Location'] = location\n assert last_response.headers['Content-Location'] = location\n\n parsed_resp = parse_json_resp(last_response)\n assert_instance_of Hash, parsed_resp\n assert_equal valid_entry[:word], parsed_resp['word']\n assert_equal valid_entry[:definition], parsed_resp['definition']\n assert_equal location, parsed_resp['location']\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to new_entry_path, notice: \"Entry #{@entry} was successfully created.\" }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { get_events\n render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = current_user.entries.build(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @entries = Entry.new\n end",
"def entry_params\n params.require(:entry).permit(:titulo, :descricao, :tipo, :periodicidade, :category_id)\n end",
"def index\n @entries = list_entries\n respond_with @entries\n end",
"def create\n create_entry\n end",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n flash[:success] = \"Erfolgreich eingereicht (Successfully submitted)\"\n format.html {redirect_to action: :new}\n# format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n# format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n respond_to do |format|\n if @entry.save\n format.html { redirect_to [@blog, @entry], notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: [@blog, @entry] }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed_entry = FeedEntry.new(params[:feed_entry])\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to @feed_entry, notice: 'Feed entry was successfully created.' }\n format.json { render json: @feed_entry, status: :created, location: @feed_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n create_entry\n \n # Redirect to entry view to show the new element\n redirect_to show_entry_path(params[:type], @entry[:id])\n end",
"def save_dictionary_entries(dictionary, dictionary_entries, opts = {})\n response = @transporter.write(\n :POST,\n path_encode('/1/dictionaries/%s/batch', dictionary),\n { clearExistingDictionaryEntries: false, requests: chunk('addEntry', dictionary_entries) },\n opts\n )\n\n DictionaryResponse.new(self, response)\n end",
"def create\n @journal_entry = JournalEntry.new(params[:journal_entry])\n\n respond_to do |format|\n if @journal_entry.save\n flash[:notice] = 'JournalEntry was successfully created.'\n format.html { redirect_to(@journal_entry) }\n format.xml { render :xml => @journal_entry, :status => :created, :location => @journal_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(:content, :word_id, :date)\n end",
"def save\n self.client.api_post(\"/feed\", self.create_params)\n end",
"def entries_params\n params.require(:daily_entry).permit(:body, :prefix)\n end",
"def entries\n trace 'entries'\n $data['entries']\n end",
"def create\n @entry = Entry.new(entry_params)\n @dictionary = Dictionary.find(params[:dictionary_id])\n respond_to do |format|\n if @entry.save\n format.html { redirect_to dictionary_entry_path(@dictionary, @entry),\n notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def create\n @feedentry = Feedentry.new(params[:feedentry])\n\n respond_to do |format|\n if @feedentry.save\n format.html { redirect_to @feedentry, notice: 'Feedentry was successfully created.' }\n format.json { render json: @feedentry, status: :created, location: @feedentry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedentry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_entries(entries, entry_id)\n entries.each do |entry|\n data = ::RssFeedDatum.where(url: entry.url).first_or_create(rss_feed_keyword_id: entry_id, guid: entry.id, name: entry.title, published_at: entry.published, blurb: get_html_content(\"#{entry.url}\"))\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n @entry.user_id = current_user.id\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to root_url, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @journalentry = Journalentry.new(params[:journalentry])\n\n respond_to do |format|\n if @journalentry.save\n flash[:notice] = 'Journalentry was successfully created.'\n format.html { redirect_to(@journalentry) }\n format.xml { render :xml => @journalentry, :status => :created, :location => @journalentry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @journalentry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(\n :term, :id, :_destroy,\n definitions_attributes: [:definition, :id, :_destroy],\n examples_attributes: [:example, :id, :_destroy],\n references_attributes: [:source, :id, :_destroy]\n )\n end",
"def create\n @entry = Entry.new(params[:entry])\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, :notice => 'Entry was successfully created.' }\n format.json { render :json => @entry, :status => :created, :location => @entry }\n else\n @clients = Client.all.collect{ |c| [c.name, c.id] }\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n \n format.html { render :action => \"new\" }\n format.json { render :json => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n cite_key = params['entry']['cite_key']\n category = params['entry']['category']\n clean_params = EntryValidator.clean_params category, params\n @entry = Entry.new(category:category, cite_key:cite_key)\n entry_valid = EntryValidator.validate @entry, clean_params\n\n respond_to do |format|\n if entry_valid and @entry.save and create_fields(clean_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n @fields = get_fields\n format.html { render :new_thing }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n request :post, *args\n end",
"def index\n @entries = Entry.find_all_by_time(params[:date], :order => :created_at)\n @entry ||= Entry.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def create\n @subentry = Subentry.new(params[:subentry].permit(allowed_params))\n\n respond_to do |format|\n if @subentry.save\n flash[:notice] = 'Subentry was successfully created.'\n format.html { redirect_to(@subentry) }\n format.xml { render xml: @subentry, status: :created, location: @subentry }\n else\n format.html { render action: 'new' }\n format.xml { render xml: @subentry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(:title, :content)\n end",
"def create\n @journal_entry = JournalEntry.new(params[:journal_entry])\n\n respond_to do |format|\n if @journal_entry.save\n format.html { redirect_to(@journal_entry, :notice => 'Journal entry was successfully created.') }\n format.json { render :json => @journal_entry, :status => :created, :location => @journal_entry }\n format.xml { render :xml => @journal_entry, :status => :created, :location => @journal_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @journal_entry.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_content_entry(content_type, content_entry)\n # log before\n self.output_resource_op content_entry\n\n # get the params\n params = self.buffer_log { self.content_entry_to_params(content_entry) }\n\n # send the request\n response = self.post \"content_types/#{content_type}/entries\", params, nil, true\n\n self.apply_response(content_entry, response)\n\n status = self.response_to_status(response)\n\n # log after\n self.output_resource_op_status content_entry, status\n self.flush_log_buffer\n end",
"def create_entries(doc,id_map = {})\n encounter_list = []\n entry_elements = doc.xpath(@entry_xpath)\n entry_elements.each do |entry_element|\n encounter = create_entry(entry_element, id_map={})\n if @check_for_usable\n encounter_list << encounter if encounter.usable?\n else\n encounter_list << encounter\n end\n end\n encounter_list\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def post(*args)\n request(:post, *args)\n end",
"def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def create\n @r_entry = REntry.new(r_entry_params)\n\n respond_to do |format|\n if @r_entry.save\n format.html { redirect_to @r_entry, notice: 'R entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @r_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @r_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_entry = TaskEntry.new(task_entry_params)\n\n respond_to do |format|\n if @task_entry.save\n format.json { render action: 'show', status: :created, location: @task_entry }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(:content)\n end",
"def entry_params\n params.require(:entry).permit(:title, :url, :content, :image, :feed_id)\n end",
"def create\n \n @entry = Entry.new(params[:entry])\n @entry.date = Date.strptime(params[:entry][:date], '%m/%d/%Y')\n \n respond_to do |format|\n if @entry.save\n format.html { redirect_to manage_entry_path( @entry ), notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @entry = @time_sheet.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n # [@user, @time_sheet, @entry]\n # user_time_sheet_entries_path(@user, @time_sheet)\n format.html { redirect_to user_time_sheet_entries_path(@user, @time_sheet), notice: 'Hours were successfully added.' }\n format.json { render json: [@user, @time_sheet, @entry], status: :created, location: [@user, @time_sheet, @entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(\n :name,\n :description,\n :start_date,\n :end_date,\n :created_at,\n :updated_at,\n :imp_quantity,\n :advertiser_rate,\n :states,\n :zip_codes,\n :address,\n :agency_name,\n :advertiser_name,\n :advertiser_url,\n :geofence_poi,\n :audiences_prem => [],\n :platforms => [],\n :audiences => [],\n :metros => [],\n :carriers => [],\n :content_cats => [],\n :operating_sys => [],\n :creative_types => [],\n )\n end",
"def entry_params\n params.require(:entry).permit(:name, :address, :phone, :email)\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end"
] |
[
"0.62269115",
"0.6189906",
"0.60944426",
"0.6051307",
"0.6038386",
"0.58648914",
"0.58509773",
"0.58441854",
"0.5820264",
"0.5808413",
"0.58058083",
"0.5761974",
"0.5755941",
"0.5737393",
"0.5737393",
"0.5737393",
"0.5736821",
"0.5736727",
"0.57349133",
"0.5724143",
"0.56773037",
"0.56760937",
"0.56527776",
"0.5651279",
"0.56410867",
"0.56181484",
"0.56109345",
"0.56065017",
"0.5596043",
"0.5555071",
"0.5554559",
"0.5540369",
"0.5533288",
"0.5532678",
"0.5525336",
"0.5520395",
"0.55194825",
"0.5511235",
"0.5500588",
"0.5482386",
"0.54775804",
"0.5464425",
"0.5459629",
"0.54591477",
"0.5421919",
"0.5397286",
"0.5396497",
"0.53904146",
"0.5386372",
"0.5384743",
"0.5381703",
"0.5381463",
"0.53769016",
"0.53703076",
"0.5366338",
"0.53635186",
"0.5362849",
"0.5358838",
"0.53572387",
"0.53406835",
"0.53380036",
"0.53368837",
"0.53319424",
"0.5316165",
"0.53092974",
"0.5305591",
"0.53022397",
"0.52992046",
"0.5296453",
"0.5290579",
"0.5285317",
"0.52848476",
"0.52840996",
"0.52736425",
"0.5271668",
"0.5263523",
"0.52589417",
"0.52579623",
"0.5251871",
"0.5249763",
"0.5244902",
"0.5240782",
"0.5237101",
"0.523692",
"0.5235599",
"0.5233985",
"0.52337545",
"0.52260065",
"0.5223781",
"0.5223206",
"0.5220822",
"0.51998335",
"0.51995873",
"0.51952314",
"0.5194769",
"0.5191163",
"0.5191163",
"0.5191163",
"0.5191163",
"0.5191163"
] |
0.5343489
|
59
|
PUT /entries/1 PUT /entries/1.xml
|
def update
@entry = Entry.find(params[:id])
@entry.system_list = ""
@systems = params[:systems]
@systems.each do |s|
@entry.system_list.add(s)
end
@entry.comp_list = ""
@components = params[:components]
@components.each do |c|
@entry.comp_list.add(c)
end
respond_to do |format|
if @entry.update_attributes(params[:entry])
format.html { redirect_to(@entry, :notice => 'Entry was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put_atom_entry(entry, url = entry.edit_url)\n raise \"Cowardly refusing to PUT a non-Atom::Entry (#{entry.class})\" unless entry.is_a? Atom::Entry\n headers = {\"Content-Type\" => \"application/atom+xml\" }\n\n put(url, entry.to_s, headers)\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to(entries_url, :notice => 'Entry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n flash[:notice] = 'Entry was successfully updated.'\n format.html { redirect_to(@entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to(:action => :index, :notice => 'Entry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n if @entry.update_attributes(params[:entry])\n head :no_content\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to(@entry, :notice => 'Entry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n flash[:notice] = 'Entry was successfully updated.'\n format.html { redirect_to_resource }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reindex(*entries)\n list = Upload.get_relation(*entries).to_a\n result = ingest_api.put_records(*list)\n result.exec_report.error_messages.each { |e| $stderr.puts e }.blank?\n end",
"def put(*args)\n request :put, *args\n end",
"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 update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\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 update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n @feed = @entry.feed\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to feed_entry_path(@feed, @entry), notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n @feed = @entry.feed\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to feed_entry_path(@feed, @entry), notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def put!\n request! :put\n end",
"def update\n @entry ||= Entry.find(params[:id])\n @entry.user = current_user\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n flash[:notice] = 'Entry was successfully updated.'\n format.html { redirect_to(@entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @entries = args[:entries] if args.key?(:entries)\n end",
"def update!(**args)\n @entries = args[:entries] if args.key?(:entries)\n end",
"def update!(**args)\n @entries = args[:entries] if args.key?(:entries)\n end",
"def update\n @entry = FeedEntry.find(params[:id])\n\n tags = params['tags' + params[:id]]\n\n respond_to do |format|\n if FeedEntry.add_tag(@entry, tags)\n format.html {render action: 'index'}\n format.json {head :no_content}\n else\n format.html {render action: 'index'}\n format.json {render json: @entry.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n flash[:success] = \"Entry updated\"\n format.html { redirect_to edit_entry_path }\n else\n format.html { redirect_to edit_entry_path }\n end\n end\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update\n connection.put(element_path, to_xml)\n end",
"def update\n @entry = Entry.find(params[:id])\n params[:entry][:status] = 'publish' if params[:entry][:status] == 'update'\n \n if params[:entry][:entry_metas_attributes].present?\n params[:entry][:entry_metas_attributes].replace(convert_entry_metas_attributes(params[:entry][:entry_metas_attributes]))\n end\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to edit_admin_entry_path(@entry), notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry_set = EntrySet.find(params[:id])\n @entry_set.update_attributes(params[:entry_set])\n\n render 'show'\n \n end",
"def update\n @feed_entry = FeedEntry.find(params[:id])\n\n respond_to do |format|\n if @feed_entry.update_attributes(params[:feed_entry])\n flash[:notice] = 'FeedEntry was successfully updated.'\n format.html { redirect_to(@feed_entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feed_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @entries = args[:entries] if args.key?(:entries)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update\n put :update\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n flash[:notice] = 'JournalEntry was successfully updated.'\n format.html { redirect_to(@journal_entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n format.html { redirect_to @entry }\n format.json { render :show }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to [:admin, @entry], notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update_content_entry(content_type, content_entry)\n locale = Locomotive::Mounter.locale\n\n # log before\n self.output_resource_op content_entry\n\n # get the params\n params = self.buffer_log { self.content_entry_to_params(content_entry) }\n\n # send the request\n response = self.put \"content_types/#{content_type}/entries\", content_entry._id, params, locale\n\n status = self.response_to_status(response)\n\n # log after\n self.output_resource_op_status content_entry, status\n self.flush_log_buffer\n end",
"def show\n @entry = Entry.find(params[:id])\n\[email protected] += 1\n\[email protected]_attributes(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n\t format.rss { render :rss => @entry }\n end\n end",
"def update\n @journalentry = Journalentry.find(params[:id])\n\n respond_to do |format|\n if @journalentry.update_attributes(params[:journalentry])\n flash[:notice] = 'Journalentry was successfully updated.'\n format.html { redirect_to(@journalentry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @journalentry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to edit_entry_path(@entry), notice: 'Entry updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to(@journal_entry, :notice => 'Journal entry was successfully updated.') }\n format.json { render :json => [] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @journal_entry.errors, :status => :uncprocessable_entity }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = current_user.entries.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n flash[:notice] = 'Entry was successfully updated.'\n format.html { redirect_to(@entry) }\n format.xml { render :text => \"success\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :text => \"save_error\" }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def show\n @entry = Entry.find(params[:id])\n\[email protected] += 1\n\[email protected]_attributes(params[:entry])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n\t format.rss { render :rss => @entry }\n end\n end",
"def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subentry = Subentry.find(params[:id])\n\n respond_to do |format|\n if @subentry.update(params.fetch(:subentry, {}))\n flash[:notice] = 'Subentry was successfully updated.'\n format.html { redirect_to(@subentry) }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @subentry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to root_url, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end",
"def set_entry\n @entry = Entry.find(params[:id])\n end"
] |
[
"0.6826835",
"0.6384481",
"0.63784885",
"0.63533026",
"0.6222491",
"0.61160046",
"0.6093023",
"0.60561115",
"0.60546976",
"0.6050203",
"0.6040439",
"0.6001884",
"0.5946076",
"0.59074014",
"0.5896197",
"0.58877313",
"0.5828895",
"0.5821725",
"0.5819541",
"0.5819541",
"0.57608604",
"0.5718184",
"0.5713855",
"0.5712842",
"0.57119447",
"0.5687673",
"0.5660261",
"0.5660261",
"0.56576705",
"0.56571835",
"0.5656832",
"0.5656832",
"0.5656832",
"0.56564885",
"0.56564885",
"0.56564885",
"0.5643197",
"0.5632434",
"0.56051636",
"0.56051636",
"0.55989534",
"0.55968267",
"0.55949455",
"0.558386",
"0.55618626",
"0.5555547",
"0.551815",
"0.5491153",
"0.5490071",
"0.5475941",
"0.5475941",
"0.5475941",
"0.5470429",
"0.5469107",
"0.5467865",
"0.545433",
"0.5448199",
"0.5441521",
"0.54355603",
"0.54297835",
"0.54250973",
"0.5423817",
"0.54180723",
"0.54146963",
"0.54118025",
"0.5411332",
"0.5409387",
"0.5409387",
"0.5409387",
"0.5409387",
"0.5409387",
"0.5409387",
"0.5404854",
"0.5404854",
"0.5399624",
"0.5394878",
"0.5389663",
"0.5381748",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139",
"0.5378139"
] |
0.0
|
-1
|
DELETE /entries/1 DELETE /entries/1.xml
|
def destroy
@entry = Entry.find(params[:id])
@entry.destroy
respond_to do |format|
format.html { redirect_to(entries_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @entry ||= Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_entries(entries)\n delete_all(:id => entries)\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subentry = Subentry.find(params[:id])\n @subentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(subentries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_entries(entries)\n all(:id => entries.map(&:id)).destroy!\n end",
"def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n head :no_content\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journalentry = Journalentry.find(params[:id])\n @journalentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journalentries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\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 destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path current_user }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find_by_id(params[:id])\n @entry.destroy if @entry\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\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 @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @account_entry = AccountEntry.find(params[:id])\n @account_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed_entry = FeedEntry.find(params[:id])\n @feed_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(feed_entries_url) }\n format.xml { head :ok }\n end\n end",
"def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end",
"def delete_entry(aliaz)\n\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_entries_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n redirect_to(entries_url)\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 destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to '/entries' }\n format.json { render json: @entry }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.json { render :json => [] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url, notice: \"Eintrag erfolgreich gelöscht. #{undo_link}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url, :notice => \"Entry has been deleted\" }\n format.json { head :no_content }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @entry = current_user.entries.find(params[:id])\n @entry.destroy\n current_user.entries_sum -= 1\n current_user.save!\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { render :text => \"success\" }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def delete\n request(:delete)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy_rest\n @entry_answer = EntryAnswer.find(params[:id])\n @entry_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_answers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_entry(entry)\n @address_book.entries.delete(entry)\n puts \"#{entry.name} has been deleted\"\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @r_entry.destroy\n respond_to do |format|\n format.html { redirect_to r_entries_url }\n format.json { head :no_content }\n end\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 destroy\n @ldap_entry = LdapEntry.find(params[:id])\n @ldap_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to ldap_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to [@project, :entries] }\n format.json { head :no_content }\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @test_case_entry = TestCaseEntry.find(params[:id])\n @test_case_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_case_entries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_entries(entries)\n collection.find(:_id => { '$in' => entries.map(&:id) }).delete_many\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @feed = @entry.feed\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to feed_path(@feed) }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @update = Update.find_by_permalink(params[:id])\n @update.destroy\n\n respond_to do |format|\n format.html { redirect_to(updates_url) }\n format.xml { head :ok }\n end\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to blog_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_entry = BlogEntry.find(params[:id])\n @blog_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry_set = EntrySet.find(params[:id])\n @entry_set.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_sets_url }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @atom = Atom.find(params[:id])\n @atom.destroy\n\n respond_to do |format|\n format.html { redirect_to(atoms_url) }\n format.xml { head :ok }\n end\n end",
"def test_for_deleteEntry\n assert_equal( @item1.deleteEntry( \"doesn't exist\" ),\n\t \"Error: 'Doesn't exist' is not logged for '2013-02-01'.\" )\n\tassert_equal( @item1.deleteEntry( \"ham\" ),\n\t \"Success! 'Ham' was deleted for '2013-02-01'.\" )\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(path)\n request(:delete, path)\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def delete\n delete_from_server single_url\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find_by_sysname(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @entry = current_user.entries.find(params[:id])\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7227281",
"0.7106644",
"0.70635635",
"0.6982504",
"0.6865913",
"0.6860874",
"0.67615414",
"0.67322755",
"0.6691479",
"0.6674829",
"0.6633014",
"0.65948296",
"0.6584446",
"0.6557223",
"0.65317374",
"0.65304327",
"0.65259486",
"0.6503882",
"0.6503882",
"0.6494026",
"0.6494026",
"0.6494026",
"0.64927626",
"0.64896387",
"0.64841187",
"0.6452482",
"0.6443838",
"0.643844",
"0.6416803",
"0.64060456",
"0.6397358",
"0.6378798",
"0.63735324",
"0.6365642",
"0.63653904",
"0.63590795",
"0.63567144",
"0.6341306",
"0.6323154",
"0.63137233",
"0.63133097",
"0.6301877",
"0.6284318",
"0.6284318",
"0.6279704",
"0.6269134",
"0.6268008",
"0.6250831",
"0.62454486",
"0.62454486",
"0.624354",
"0.62263966",
"0.6225882",
"0.6219896",
"0.6219284",
"0.6212806",
"0.6212806",
"0.6205302",
"0.620522",
"0.61992604",
"0.6190425",
"0.61887395",
"0.6177463",
"0.61725676",
"0.6170143",
"0.61579776",
"0.61533874",
"0.61421233",
"0.61290187",
"0.61285967",
"0.6126414",
"0.61255723",
"0.61255723",
"0.6122209",
"0.6115865",
"0.61129427",
"0.611106",
"0.6110897",
"0.61085397",
"0.610756",
"0.610378",
"0.61036944",
"0.61034673",
"0.609812",
"0.60929596",
"0.60928684",
"0.60917896",
"0.60858655",
"0.60837847",
"0.60837847",
"0.60837847",
"0.60837847",
"0.60837847",
"0.60837847",
"0.60837847",
"0.60837847"
] |
0.7109776
|
5
|
configure this after the routes is finalized skip_before_action :authenticate_user!, only: :home
|
def home
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def home\n authenticate!\n end",
"def home\n redirect_to signin_path() and return if ( @current_user.nil? )\n end",
"def home\n if user_signed_in?\n current_user.update_attribute(:login_status, true) if current_user # update login status for logged in user\n if !current_user.is_super_admin? && current_user.sign_in_count == 1 && current_user.created_by != 0 #User records which are created by super admin or dept admin has to change the password while they are logged in first time\n redirect_to :controller => \"registrations\", :action => \"privacy_setting\"\n else\n redirect_to :controller => \"dashboard\", :action => \"index\"\n end\n else\n redirect_to new_user_session_path\n end\n end",
"def home\r\n\r\n redirect_to(@current_user.home_page)\r\n end",
"def home\n redirect_to user_path(current_user)\n end",
"def home\n if !view_context.signed_in?\n redirect_to '/'\n end\n end",
"def check_logged_in_home\n if current_user != nil\n redirect_to user_path(current_user)\n end\n end",
"def home\n if current_user\n redirect_to '/dashboard'\n else\n render 'home'\n end\n end",
"def after_authentication\n @initiating_url = session[:initiating_url]\n session[:initiating_url] = nil\n render :'authentication/after_authentication'\n end",
"def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end",
"def after_sign_in_path_for(resource)\n home_passthrough_path\n end",
"def must_be_authenticated!\n unless current_admin\n redirect_to :controller => 'home', :action => 'index'\n end\n end",
"def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end",
"def after_sign_in_path_for(resource)\n '/home'\n end",
"def home\n if logged_in?\n redirect_to user_path(current_user) # Redirect to user show page if logged in\n else\n render layout: 'welcome' # Render home view with welcome layout\n end\n end",
"def index\r\n # State machine stuff\r\n current_user.came_home\r\n eval current_user.redirect, binding()\r\n return\r\n end",
"def after_sign_in_path_for(_resource)\n home_index_path\n end",
"def after_sign_in_path_for(resource)\n redirect_to_home(resource)\n end",
"def home_check\n if logged_in? && @current_user.admin?\n puts @current_user\n redirect_to account_url(@current_user.id)\n return\n elsif logged_in?\n redirect_to cases_path\n else\n redirect_to page_path(\"home\")\n return\n end\n end",
"def after_magic_link_authentication\n end",
"def after_custom_authentication; end",
"def routes\n # /home is temporary\n ['login', 'logout', 'home', 'newuser', 'edituser']\n end",
"def not_authenticated\n redirect_to root_landing_url\n end",
"def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end",
"def home\n # if user_signed_in?\n # redirect_to studios_path=end\n # end\n end",
"def authenticate\n\t\tunless admin?\n\t\t\tflash[:error] = 'unauthorized access'\n\t\t\tredirect_to home_path\n\t\tend\n\tend",
"def home_path\n if user_signed_in?\n if admin_signed_in?\n admins_posts_path\n else #If Alum or friend\n opportunities_path\n end\n else #If not logged in\n root_path\n end\n end",
"def after_sign_up_path_for(resource)\n\t root_path + \"home\"\n end",
"def redirect_to_home\n redirect_to '/'\n end",
"def home_page\n if current_user.guest?\n user_signup_url\n elsif current_user.administrator?\n admin_films_path\n elsif current_user.judge?\n judging_categories_path\n else\n obejct_url current_user\n end\n end",
"def clean_home_url\n redirect_to(home_page) and return if request.path == '/'\n end",
"def after_custom_authentication\n\n end",
"def home\n if !current_user\n redirect_to :new_user_session\n else\n redirect_to '/post/new'\n end\n end",
"def redirect_to_home\n redirect_to session[:superadmin_mode] ? ubiquo.superadmin_home_path : ubiquo.home_path\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end",
"def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end",
"def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"def home\n if user_signed_in?\n\n if current_user.connection_valid?\n @favorites = current_user.favorites\n @queries = current_user.queries\n @keytech_username = current_user.keytech_username\n # Load Dashboard async in javascript\n render 'home'\n else\n render 'invalid_login'\n end\n else\n\n # User is not signed in in platform\n render 'landing_page'\n end\n end",
"def authenticate_user\n redirect_to root_path unless signed_in?\n end",
"def after_sign_in_path_for(user)\n home_locations_path\n end",
"def check_for_login\n #if not, back home with you!\n redirect_to root_path unless @current_user.present?\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def home\n logger.info \"Got in action home in account controller\"\n @force_refresh_on_login = true\n \t@user = get_user\n @level = @user.get_level\n if(@level)\n next_level = @level.get_next_level\n if(next_level)\n @points_required = next_level.points_required - @user.total_points\n end\n end\n\n @missions = get_user.missionStatuses.select{|s| s.activated?}.map{|m| m.mission}\n logger.info \"Current missions: \" + @missions.inspect\n\n mission_statuses = get_user.missionStatuses.find(:all, :conditions=>[\"status = ?\", MissionStatus::COMPLETED_STATUS])\n @pastMissions = mission_statuses.map { |ms| ms.mission }\n\n @upcoming_quests = get_user.missionStatuses.find(:all)\n @upcoming_quests = @upcoming_quests.select{|quest| (!quest.completed?) || quest.mission.repeatable?}\n @futureMissions = @upcoming_quests.map { |ms| ms.mission }\n\n \t#Update first name if any\n \tif(request.post? && params[:user])\n \t @user.update_attributes(params[:user])\n\t end\n end",
"def after_sign_in_path_for(resource_or_scope)\n home_path\n end",
"def home\n redirect_to action: :index\n end",
"def home\n # do nothing\n end",
"def home\n\t\t\n\tend",
"def home\n\t\t\n\tend",
"def after_sign_up_path_for(resource)\n redirect_to_home(resource)\n end",
"def user_root\r\n if logged_in?\r\n redirect_to current_user\r\n else\r\n redirect_to login_path\r\n end\r\n end",
"def landing_page\n if current_user\n redirect_to actions_path(current_user[:id])\n end\n end",
"def index\n redirect_to after_sign_in_path_for current_user if current_user\n end",
"def index\n redirect_to after_sign_in_path_for current_user if current_user\n end",
"def after_hash_token_authentication\n end",
"def authorized\n redirect_to '/welcome' unless logged_in?\n end",
"def authenticate\n redirect_to login_path if !logged_in\n end",
"def authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end",
"def index\n redirect_to(:action => 'login') unless logged_in? \n end",
"def authenticate_user\n redirect_to login_path unless logged_in_user?\n end",
"def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end",
"def authenticate_user\n if !user_logged_in?\n # Store current url path for future reference\n store_location\n # Redirect to home page with error flash\n flash[:error] = \"Please Signin to access this page\"\n redirect_to root_path\n end\n end",
"def home \n\tend",
"def home hash = {}\n hash[:controller] = 'kopal/home'\n return root if hash[:action].blank? or hash[:action] == 'index'\n home_path hash.update :trailing_slash => true\n end",
"def enforce_login\n redirect_to welcome_path if @user.nil?\n end",
"def after_sign_in_path_for(resource)\n static_pages_home_path\n end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def index\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def index\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def index\n if !user_signed_in?\n redirect_to home_path\n elsif current_user.admin?\n redirect_to admin_portal_path\n else\n redirect_to portal_path\n end\n end",
"def authenticate\n redirect_to '/login' unless current_user\n end",
"def authenticate\n\n # This suppresses the log in suggestion on subsequent\n # request if the user clicks \"No\"\n if params[:stay_anonymous]\n cookies[:shunt_hint] = 'anonymous'\n logger.info \"Suppressing log in suggestion\"\n redirect_to url_for(params.except!(:stay_anonymous))\n end\n\n if params[:public]\n cookies[:shunt_hint] = 'public'\n redirect_to url_for(params.except!(:public))\n end\n\n if should_force_authentication\n force_authentication\n end\n end",
"def authenticate\n redirect_to login_url, danger: \"Please Login\" unless current_user\n end",
"def index\n redirect_to disabled_path\n # unless logged_in?\n # redirect_to tour_path\n # else\n # @current_item = \"my_hsa\"\n # end\n end",
"def landing\n redirect_to dashboard_path if current_user\n end",
"def sign_in_routing\n logger.info \"Sing In Routing Controller\"\n if cookies[:object].blank?\n redirect_to(show_user_path(current_user.id))\n\n\t#artist is only assigned when its coming from payment routing.\n\telsif cookies[:artist].blank?\n\t\t#assing_to_user is in the Application controller, assings song and albums to the user\n\t\tassign_object_user\n\t\tredirect_to(show_user_path(current_user.id))\n\telse\n #this is the part is currently not being used\n\t\tredirect_to(payment_method_path(cookies[:object],cookies[:artist],cookies[:song_album_or_event_id]))\n\t\t# deletes the download cookie so that muliple downloads won't happen\n\t\tcookies[:artist] = {:expires => 1.year.ago}\n end\n end",
"def home\r\n \r\n end",
"def home\n\tend",
"def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end",
"def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end",
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def home\n\n end",
"def home\n\n end",
"def home\n\n end",
"def home\n\n end",
"def home\n if current_user.workspaces.none?\n redirect_to no_workspace_path\n else\n if current_user.user_profile.current_workspace\n redirect_to current_user.user_profile.current_workspace\n else\n current_user.user_profile.update(current_workspace: current_user.workspaces.first)\n redirect_to current_user.user_profile.current_workspace\n end\n end\n end",
"def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to member_home_path\n end\n end",
"def manager_home\n redirect_to(:action => 'index')\n end",
"def welcome\n if user_logged_in?\n redirect_to root_path\n else\n redirect_to new_user_registration_path\n end\n end",
"def set_home\n end",
"def login_checkpoint\n redirect to '/' if !logged_in?\n end",
"def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end",
"def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end",
"def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end",
"def home\n\t\t# Home Page\n\tend",
"def home\n end",
"def home\n end"
] |
[
"0.72083336",
"0.71486306",
"0.7038525",
"0.6954358",
"0.6884677",
"0.68303233",
"0.6826214",
"0.6774407",
"0.6745907",
"0.66669214",
"0.66284674",
"0.6537676",
"0.6526583",
"0.6501439",
"0.64968437",
"0.64906543",
"0.6474953",
"0.6445634",
"0.64330965",
"0.64162976",
"0.64057493",
"0.6404962",
"0.63895655",
"0.637009",
"0.63677335",
"0.6367593",
"0.6351534",
"0.63319016",
"0.6298116",
"0.62949866",
"0.62898314",
"0.6288067",
"0.6274023",
"0.62698233",
"0.6259612",
"0.6259612",
"0.6259612",
"0.62561065",
"0.62407285",
"0.6239444",
"0.62376815",
"0.6235895",
"0.6228833",
"0.6222699",
"0.61993116",
"0.61988753",
"0.619383",
"0.6183856",
"0.6174483",
"0.6156702",
"0.6156702",
"0.6155014",
"0.61528915",
"0.61522776",
"0.6147246",
"0.6147246",
"0.61450475",
"0.61383414",
"0.61257124",
"0.6109989",
"0.6089585",
"0.6081534",
"0.60806984",
"0.6076562",
"0.6075874",
"0.6067442",
"0.6066508",
"0.60661614",
"0.6064308",
"0.6064308",
"0.60597354",
"0.60597354",
"0.6058703",
"0.6052704",
"0.6040252",
"0.60394114",
"0.6036317",
"0.60351956",
"0.6029771",
"0.60290027",
"0.6022901",
"0.60215116",
"0.6017311",
"0.60126364",
"0.60090446",
"0.600245",
"0.600245",
"0.600245",
"0.600245",
"0.6001033",
"0.59944624",
"0.5994393",
"0.5986305",
"0.5981848",
"0.5973859",
"0.5972184",
"0.5972184",
"0.5966719",
"0.5958183",
"0.59574115",
"0.59574115"
] |
0.0
|
-1
|
TODO: reconsider handling of parent resources
|
def load_ancestors
resource_ancestors.map do |ancestor_name|
# TODO: reconsider namespace handling
instance_variable_set("@#{ancestor_name}", model_namespace.const_get(ancestor_name.camelize).find(params[:"#{ancestor_name}_id"]))
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_parent_resources\n # Key to hash for controller relationships information.\n ar_parents_key= @controller.controller_class_name.intern\n parents= @res_parents[@controller.controller_name]\n\n if !parents || parents.empty?\n @controller.ar_controller_parents[ar_parents_key]= Set.new\n else\n parents.each do |controller_name|\n AutoRest::RailsResources.of_controller(controller_name).each do |parent_res|\n \n # I don't support nesting more than one level yet. Sorry!\n next if parent_res.name_prefix && !parent_res.name_prefix.empty?\n \n self.parent_resources << Struct::ARResource.new(parent_res.singular.to_s, \n parent_res.plural.to_s,\n parent_res.singular.camelize.constantize,\n parent_res.singular.capitalize,\n (\"#{parent_res.singular.to_s}_\" || ''))\n \n parent_controller= \"#{parent_res.plural.to_s.camelize}Controller\".intern\n \n (@controller.ar_controller_parents[ar_parents_key]||= Set.new) << parent_controller\n end\n end\n end\n self.parent_resources= Set.new(self.parent_resources)\n end",
"def parent_resources\n @parent_resources ||= []\n end",
"def parent_resource_class\n @parent_resource_class ||= parent_resource_name.classify.constantize\n end",
"def get_nested_resource_objects\n end",
"def perm_ancestors\n super + [parent_resource]\n end",
"def get_resources_by_parent parent_resource_uuid, name=nil\n parent_resource_uuid = parent_resource_uuid if parent_resource_uuid.is_a?(Resource)\n \n @resources.find_all{|res|res.parent_uuid == parent_resource_uuid && (name.blank? || res.name == name)}\n end",
"def get_parent_resource\n instance_variable_get(\"@#{parent_resource_name}\")\n end",
"def ar_verify_parent_resource\r\n parent= ardata.parent_resources.select { |res| res.model == @parent_resource.class }\r\n \r\n real_parent= @resource.send(parent.first.singular)\r\n \r\n if @parent_resource.to_param != real_parent.to_param\r\n @parent_resource= real_parent\r\n ar_set_parent_instance_var if @parent_resource\r\n end\r\n end",
"def parent\n @parent || NullResource.new\n end",
"def handle_resource(definition, parent, parent_params)\n if definition.is_a? Array\n return definition.each{|d| handle_resource(d, parent, parent_params)}\n end\n # normalize to a hash\n unless definition.is_a? Hash\n definition = {definition => nil}\n end\n\n definition.each do |name, child_definition|\n if !parent_params || !parent_params.has_key?(name.to_s)\n next\n end\n \n reflection = parent.class.reflect_on_association(name)\n \n attrs = parent_params.delete(name.to_s)\n\n if reflection.collection?\n attrs ||= []\n handle_plural_resource parent, name, attrs, child_definition\n else\n handle_singular_resource parent, name, attrs, child_definition\n end\n end\n end",
"def parent_resource_name\n command_has_resources ? resources.last : ''\n end",
"def parent_resource\n return @parent_resource if defined?(@parent_resource)\n @parent_resource = if @mediator.through\n if @controller.instance_variable_defined? :\"@#{@mediator.through}\"\n @controller.instance_variable_get(:\"@#{@mediator.through}\")\n elsif @controller.respond_to?(@mediator.through, true)\n @controller.send(@mediator.through)\n end\n end\n end",
"def parent\n @parent ||= resource.decorate.parent\n end",
"def _parent; end",
"def resources\n @pruned_resources || super\n end",
"def belongs_to(parent_resource)\n parent_resource = parent_resource.to_sym\n parent_resources << parent_resource unless parent_resource.in?(parent_resources)\n end",
"def resource\n (@nested_resource || @root_resource)\n end",
"def find_resource\n if parent_data.present?\n parent.send(collection_name).find(params[:id])\n else\n model_class.find_by!(account_id: current_account.id, id: params[:id])\n end\n end",
"def ar_resources_path\n meth= \"#{controller.ardata.resources_method(@parent_resource, '')}_path\"\n @parent_resource ? send(meth, @parent_resource) : send(meth)\n end",
"def resource_singular() self.class.read_inheritable_attribute(:resource_singular) end",
"def rest_parent_name\n self.class.rest_parent_name\n end",
"def parent_resource_name(params)\n parent_resource_param(params).to_s.gsub(/\\_id/, '').pluralize\n end",
"def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end",
"def resource_parent\n project\n end",
"def check_parent_ids\n # This should not be necesary as parent_ids should be included on reflections.\n #parent_resources.each { |res| parent_ids << \"#{res.singular}_id\" }\n\n # Model foreign keys \n resource.model.reflections.each do |key, refl|\n if refl.macro == :belongs_to || refl.macro == :has_and_belongs_to_many\n parent_ids << refl.primary_key_name\n foreing_models[refl.primary_key_name.to_s]= refl.class_name.constantize\n end\n end\n self.parent_ids= Set.new(self.parent_ids)\n end",
"def get_parent_resource\n parent_id_param = request.path_parameters.keys.detect { |k| k.to_s.end_with?('_id') }\n if parent_id_param\n parent_type = parent_id_param.to_s.chomp('_id')\n parent_class = safe_class_lookup(parent_type.camelize)\n if parent_class\n @parent_resource = parent_class.find(params[parent_id_param])\n end\n end\n end",
"def parents\n return Resource.joins(:resource_hierarchies).where(\"child_resource_id = ?\", self.id)\n end",
"def parent_api; end",
"def parent_api; end",
"def resources; end",
"def resources; end",
"def enclosing_resources\n self.resource_tuple[0..-2]\n end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent_resource_name\n if params[:candidate_id]\n name = 'candidate'\n elsif params[:employer_id]\n name = 'employer'\n else\n params[:job_post_id]\n name = 'job_post'\n end\n @parent_resource_name ||= name\n end",
"def resources_parents\n if @@resources_parents.length > 0\n @@resources_parents\n else\n analyze()\n end\n end",
"def as_resource\n {\n :primary => @primary.as_resource,\n :other => @other.count > 0 ? @other.map {|t| t.as_resource} : nil\n }\n end",
"def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end",
"def resources()\n end",
"def parent\n @parent or raise LifecycleException.new(\"can't call parent until you materialize the resource\")\n end",
"def fix_parent_template_value\n return if new_resource.parent =~ %r{^/[A-Za-z0-9]+/.*}\n current_resource.parent(current_resource.parent.gsub(%r{^/Common/}, ''))\n end",
"def enclosing_resource\n self.resource_tuple[-2]\n end",
"def fetch_or_build_nested_resource_for(parent, index, attributes)\n nested_resources = parent.association(name).load_target\n\n if (id = attributes['id'].presence)\n nested_resources.find { |res| res.id == id.to_i }\n else\n parent.association(name).build(attributes.slice('type')).tap do |resource|\n attributes['id'] = \"__#{ index }\"\n temporarily_extend_new_resource(resource, attributes)\n end\n end\n end",
"def resource; end",
"def parent\n end",
"def parent\n end",
"def parent\n end",
"def parent\n end",
"def parents; end",
"def fetch_or_build_nested_resource_for(parent, attributes)\n if (nested_resource = parent.association(name).load_target)\n return nested_resource\n end\n\n parent.association(name).build(attributes.slice('type')).tap do |resource|\n attributes['id'] = \"__#{ object_id }\"\n temporarily_extend_new_resource(resource, attributes)\n end\n end",
"def reference_resource\n return super if defined?(super)\n\n raise NotImplementedError\n end",
"def resource_list\n self.resources\n end",
"def resource\n self.class.resource\n end",
"def parent_object_exists\n begin\n self.parent_class.constantize.find(self.parent_id)\n rescue\n self.errors.add(:parent_id,\"the #{self.parent_class} does not exist, Create it before trying to add an image to it\")\n end\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 parent_resource_param(params)\n (params.symbolize_keys.keys & parent_resource_id_params).first\n end",
"def subresources\n if any?\n { collection_rel => self }\n else\n {}\n end\n end",
"def parent_resource\n @parent_resource ||=\n begin\n return nil if resource.try(:imported_metadata).present?\n Wayfinder.for(resource).parent\n end\n end",
"def method_missing(method, *args)\n child_resource_template = resource_template.find_by_rel(method.to_s).first\n if child_resource_template && (child_class = child_class_for(self, method, params, child_resource_template))\n positional_params, params_hash = extract_params(args, params)\n complete_params_hash!(params_hash, child_resource_template.positional_params(resource_template), positional_params)\n child(child_class, method, params_hash, child_resource_template)\n else\n super\n end\n end",
"def get_nested(parent)\n raise_method_not_available(__method__, 'is top-level asset') unless parent_type\n path_options = { parent: parent }\n assets = client.get(asset_type, path_options)\n assets.map { |data| self.new_from_payload(data) }\n end",
"def resources\n ([self] + parent_groups).reverse.inject({}) do |memo, group|\n begin\n memo.merge(group.poise_spec_helpers[:resources] || {})\n rescue NoMethodError\n memo\n end\n end\n end",
"def to_resource\n\t\t\tr = super\n\t\t\tr[\"current room\"] = r.delete(:parent)\n\t\t\tr\n\t\tend",
"def children\n @children ||= assets.map { |asset| asset.key.split('/').first }.uniq.map do |bucket|\n path = \"#{ resource.public_path }/#{ bucket }\"\n Shopidav::Resource.new(path, path, resource.request, resource.response, resource.options)\n end\n end",
"def parent_association\n @parent_object=parent_object # ResourceController normally sets this\n if params[:id].nil?\n return parent_object.all_parent_relations \n end\n # Gotta find it seperately, will get a recursive stack error elsewise\n o = FeatureRelation.find(params[:id])\n parent_object.id == o.parent_node.id ? parent_object.all_child_relations : parent_object.all_parent_relations\n end",
"def parent_resource_id_params\n parent_resources.map { |pr| :\"#{pr}_id\" }\n end",
"def base_resource\n\t\t\t Subresource.new persisted? ? self.class.identify(self) : self.class.base_resource\n\t\t\tend",
"def image_resource?\n parent.respond_to?(:image_resource?) && parent.image_resource?\n end",
"def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end",
"def parent(resource)\n if @resource_config[:parent]\n raise DefinitionError, \"parent already declared in #{self}\"\n end\n @resource_config[:parent] = resource\n end",
"def initialize(new_resource, run_context)\n super(new_resource, run_context)\n\n if new_resource.path && new_resource.path != ''\n @path = new_resource.path\n else\n @path = \"/home/#{new_resource.owner}/newrelic_elastic_#{new_resource.application_name}\"\n end\nend",
"def resources_path_names; end",
"def resource_has_parents?(resource, params)\n if !resource.persisted?\n params[:parent_id]\n else\n resource.decorate.respond_to?(:decorated_parent) && !resource.decorate.decorated_parent.nil?\n end\n end",
"def method_missing(name, *args, &block)\n if args.empty? and resources and resources.has_resource?(name)\n resources[name]\n else\n super(name, *args, &block)\n end\n end",
"def load_current_resource; end",
"def resource\n self\n end",
"def shift\n orphan_resource(super)\n end",
"def child_resources(resource, all_visible_resources)\n resource.child_resources.select { |r| all_visible_resources.include?(r) }\n end",
"def child_resources(resource, all_visible_resources)\n resource.child_resources.select { |r| all_visible_resources.include?(r) }\n end",
"def new\n # @resource = parent.medical_records.build\n # @resource.medical_record_images.build\n # @resource.laboratory_examination_images.build\n # @resource.imaging_examination_images.build\n super\n end",
"def singular_resource\n super.decorate\n end",
"def parent_object\n #todoable = \n # case\n # when params[:user_id] then User.find(params[:user_id])\n # when params[:project_id] then Project.find(params[:project_id])\n # #when params[:todo_template_id] then TodoTemplate.find(params[:todo_template_id])\n # end \n todoable = Project.find(params[:project_id]) if params[:project_id]\n raise ActiveRecord::RecordNotFound, \"TODO association not FOUND! \" if !todoable\n \n return todoable\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def create\n @parent_resource = ParentResource.find(params[:child_resource][:parent_resource_id])\n require_privilege(Alberich::Privilege::CREATE, ChildResource,\n @parent_resource)\n @child_resource = ChildResource.new(params[:child_resource])\n\n respond_to do |format|\n if @child_resource.save\n @child_resource.assign_owner_roles(current_user)\n format.html { redirect_to @child_resource, notice: 'Child resource was successfully created.' }\n format.json { render json: @child_resource, status: :created, location: @child_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @child_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def method_missing(method, *args)\n child_resource_template = resource_templates_by_name[method.to_s]\n if child_resource_template && (child_class = child_class_for(self, method, params, child_resource_template))\n positional_params, params_hash = extract_params(args, params)\n complete_params_hash!(params_hash, child_resource_template.positional_params(nil), positional_params)\n child(child_class, method, params_hash, child_resource_template)\n else\n super\n end\n end",
"def inherited(resource)\r\n resource.class_eval do\r\n self.versions ||= {}\r\n self.helper_object = Object.new\r\n\r\n begin\r\n plural = name.demodulize.tableize\r\n self.path = lambda { |format|\r\n begin\r\n new.polymorphic_path [:resources, plural], :format => format\r\n rescue => e\r\n nil\r\n end\r\n }\r\n self.query_template = DEFAULT_COLLECTION_QUERY_TEMPLATE.dup\r\n self.model = name.sub(/^Restful\\b/, '').constantize\r\n finder :find, :all, :first, :last\r\n helper ApplicationHelper\r\n rescue ArgumentError, NameError => e\r\n nil\r\n end\r\n\r\n Restful::Resource.classes << self\r\n end\r\n end",
"def children\n @resource.children\n end",
"def initialize(parent_resources=[], before_all=[], after_all=[])\n @current_resource = parent_resources.pop\n @parent_resources = parent_resources\n @before, @after, @routes = before_all, after_all, []\n end",
"def current_resource_owner\n return @current_resource_owner if defined?(@current_resource_owner)\n\n super\n end",
"def find_resource(obj)\n\n\n\n resources.detect do |r|\n\n\n\n r.resource_name.to_s == obj.to_s || r.resource_class.to_s == obj.to_s\n\n\n\n end ||\n\n\n\n if obj.respond_to? :base_class\n\n\n\n resources.detect{ |r| r.resource_class.to_s == obj.base_class.to_s }\n\n\n\n end\n\n\n\n end",
"def as_resource(options = {})\n links = self_link\n\n if is_collection?\n links[:web] = {\n :href => \"#{@@web_url}/#{pk}\"\n }\n end\n \n resource = {\n :id => pk,\n :accession => objectnumber,\n :sort_number => sortnumber,\n :sort_title => sort_title,\n :sort_name => sort_name,\n :constituents => constituents.map {\n |c| c.as_resource({'no_objects' => true, 'no_bio' => true})\n },\n :titles => titles.as_resource,\n :series => series == nil ? nil : series.as_resource,\n :dates => date_resource(datebegin, dateend, dated),\n :sites => sites.count > 0 ? sites.map {\n |s| s.as_resource({'no_objects' => true})} : nil,\n :movements => movements.count > 0 ? movements.map {\n |m| m.as_resource({'no_objects' => true})} : nil,\n :acquisition => acquisition != nil ? \n acquisition.as_resource({'no_objects' => true}) : nil,\n :exhibitions => exhibitions.count > 0 ? exhibitions.map {\n |e| {\n :location => location(e.pk) != nil ? location(e.pk).as_resource : nil,\n :exhibition => e.as_resource({'no_objects' => true})\n }\n } : nil,\n :edition => edition,\n :medium => medium,\n :dimensions => dimensions,\n :credit => creditline,\n :has_essay => has_essay?,\n :has_extended_label => has_essay?,\n :copyright => copyright,\n :current_location => current_location == nil ? \n nil : current_location.as_resource,\n :media => media.count > 0 ? media.map { |m|\n m.as_resource\n } : nil,\n :object_types => object_types.count > 0 ? object_types.map { |t|\n t.as_resource({'no_objects' => true})\n } : nil,\n :permanent_collection => permanent_collection?,\n :recent_acquisition => is_recent_acquisition?,\n :_links => links\n }\n\n if options['no_essay'] != 'true'\n resource[:essay] = essay\n resource[:extended_label] = extended_label\n end\n\n return resource\n end"
] |
[
"0.681683",
"0.66582495",
"0.6615209",
"0.6601737",
"0.6456767",
"0.6412563",
"0.6393283",
"0.63446915",
"0.63200015",
"0.6318581",
"0.6298036",
"0.6297628",
"0.62963885",
"0.62863725",
"0.6240965",
"0.6136084",
"0.6127339",
"0.61232996",
"0.61213565",
"0.6111859",
"0.6079084",
"0.60717493",
"0.60497653",
"0.60300475",
"0.6001294",
"0.59815985",
"0.598084",
"0.5957077",
"0.5957077",
"0.59351206",
"0.59351206",
"0.5908723",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.59049875",
"0.58830804",
"0.58795047",
"0.5870484",
"0.58698905",
"0.5865155",
"0.58247626",
"0.5822589",
"0.5803582",
"0.5797651",
"0.5785037",
"0.5784062",
"0.5784062",
"0.5784062",
"0.5784062",
"0.57708406",
"0.5764982",
"0.57611775",
"0.5757411",
"0.575385",
"0.575027",
"0.5749754",
"0.57430583",
"0.570255",
"0.56977046",
"0.56941366",
"0.5691571",
"0.56893796",
"0.5674103",
"0.5671871",
"0.5668758",
"0.5667345",
"0.5667045",
"0.56608367",
"0.5647033",
"0.5633708",
"0.56335443",
"0.56241983",
"0.5623776",
"0.5623404",
"0.56213176",
"0.56192994",
"0.5615125",
"0.56124055",
"0.56124055",
"0.56071484",
"0.56054103",
"0.56005096",
"0.5598602",
"0.5598602",
"0.55921143",
"0.5580983",
"0.5559019",
"0.5539562",
"0.55292726",
"0.5522449",
"0.55181986",
"0.5509481"
] |
0.0
|
-1
|
TODO: reconsider resource filtering
|
def load_objects
instance_variable_set("@#{model_name.underscore.pluralize}", (@instances = model.where(params || {}) rescue nil))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_resource_semantics!; end",
"def resource; end",
"def resources()\n end",
"def find_resource(obj)\n\n\n\n resources.detect do |r|\n\n\n\n r.resource_name.to_s == obj.to_s || r.resource_class.to_s == obj.to_s\n\n\n\n end ||\n\n\n\n if obj.respond_to? :base_class\n\n\n\n resources.detect{ |r| r.resource_class.to_s == obj.base_class.to_s }\n\n\n\n end\n\n\n\n end",
"def resources; end",
"def resources; end",
"def check_mixed_resources\n end",
"def check_resource! resource \n resources.include?(resource.to_s) ? resource_parsed(resource) : raise(\"resource should be in [tags, posts, bundles]\") \n end",
"def resource_list\n self.resources\n end",
"def controlled_resources\n @controlled_resources ||= if params[:media_name]\n super.where(type: singular_linked_media_type)\n else\n super\n end\n end",
"def get_resource_params\n \traise NotImplementedError\n end",
"def list_resource\n resource_class.all_but_other\n end",
"def get_nested_resource_objects\n end",
"def setup_request\n @resource_name = params[:resource].singularize.camelize\n @resource_klass_name = \"Entity::#{@resource_name}\"\n \n begin \n # Check that resource is managed by this controller\n unless ACCEPTED_RESOURCES[@resource_name]\n raise NameError\n end\n \n # Get resource arity\n @resource_arity = ACCEPTED_RESOURCES[@resource_name][:arity] || 'collection'\n \n rescue NameError => e\n render json: { errors: process_errors([\"Unknown Resource\"], 400) }, status: :bad_request\n return false\n end\n \n true\n end",
"def resources\n @pruned_resources || super\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 filter\n super\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 resource\n @resource\n end",
"def setup_request\n @resource_name = params[:resource]\n @resource_klass_name = \"Entity::#{@resource_name}\"\n \n begin \n # Check that resource is managed by this controller\n unless ACCEPTED_RESOURCES.include? @resource_name\n raise NameError\n end\n\n rescue NameError => e\n logger.info(\"ressource-name:\"+@resource_name)\n render json: { errors: process_errors([\"Unknown Resource\"], 400) }, status: :bad_request\n return false\n end\n \n true\n end",
"def filters; end",
"def filters; end",
"def validate_resource\n begin \n # Below line will skip extra processing of fiter \n # in subsequent action execution in request chain.\n @resource ||= params[:resource_type].constantize.find(params[:resource_id]) \n rescue\n flash[ :notice ] => \"Invalid #{params[:resource_type] }\"\n end\n end",
"def resource_params\n @resource[:resource_params]\n end",
"def is_resource\n return self.resource_type == Resource::RESOURCE;\n end",
"def as_resource\n {\n :primary => @primary.as_resource,\n :other => @other.count > 0 ? @other.map {|t| t.as_resource} : nil\n }\n end",
"def resource_name\n @resource_name\n end",
"def is_resource_like\n return (self.is_resource || self.is_collection_object)\n end",
"def resource\n resource_model.find(params[:id])\n end",
"def read_resource(resource)\n resource\n end",
"def read_resource(resource)\n resource\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 as_resource(options = {})\n links = self_link\n\n if is_collection?\n links[:web] = {\n :href => \"#{@@web_url}/#{pk}\"\n }\n end\n \n resource = {\n :id => pk,\n :accession => objectnumber,\n :sort_number => sortnumber,\n :sort_title => sort_title,\n :sort_name => sort_name,\n :constituents => constituents.map {\n |c| c.as_resource({'no_objects' => true, 'no_bio' => true})\n },\n :titles => titles.as_resource,\n :series => series == nil ? nil : series.as_resource,\n :dates => date_resource(datebegin, dateend, dated),\n :sites => sites.count > 0 ? sites.map {\n |s| s.as_resource({'no_objects' => true})} : nil,\n :movements => movements.count > 0 ? movements.map {\n |m| m.as_resource({'no_objects' => true})} : nil,\n :acquisition => acquisition != nil ? \n acquisition.as_resource({'no_objects' => true}) : nil,\n :exhibitions => exhibitions.count > 0 ? exhibitions.map {\n |e| {\n :location => location(e.pk) != nil ? location(e.pk).as_resource : nil,\n :exhibition => e.as_resource({'no_objects' => true})\n }\n } : nil,\n :edition => edition,\n :medium => medium,\n :dimensions => dimensions,\n :credit => creditline,\n :has_essay => has_essay?,\n :has_extended_label => has_essay?,\n :copyright => copyright,\n :current_location => current_location == nil ? \n nil : current_location.as_resource,\n :media => media.count > 0 ? media.map { |m|\n m.as_resource\n } : nil,\n :object_types => object_types.count > 0 ? object_types.map { |t|\n t.as_resource({'no_objects' => true})\n } : nil,\n :permanent_collection => permanent_collection?,\n :recent_acquisition => is_recent_acquisition?,\n :_links => links\n }\n\n if options['no_essay'] != 'true'\n resource[:essay] = essay\n resource[:extended_label] = extended_label\n end\n\n return resource\n end",
"def resource\n\n end",
"def resource_type\n\t\t\t\t\t\traise \"Not implemented.\"\n\t\t\t\t\tend",
"def resource_pattern?\n true\n end",
"def filter\n end",
"def show\n @resource = Resource.find(params[:id])\n @tags = Tagging.for_resource(params[:id])\n if current_user.role?(:reentrant)\n @referred = @resource.referred?(current_user.reentrant)\n else\n @referred = false\n end\n end",
"def resource(*resources, &block); 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 get_author_resources\n # Get the user and author ids for the current resource\n author = self.author_id\n user = self.user_id\n\n rel_resource_list = {}\n # If an author is assigned use that\n if author\n Resource.where('author_id=? OR user_id=?', author, author).find_each do |rel_resource|\n if rel_resource.id != self.id\n if rel_resource.author_id == author\n rel_resource_list[rel_resource.id] = rel_resource.title\n elsif rel_resource.author_id == nil and rel_resource.user_id == user\n rel_resource_list[rel_resource.id] = rel_resource.title\n end\n end\n end\n # If not, use the user who created the Resource\n else\n Resource.where('author_id=? OR user_id=?', user, user).find_each do |rel_resource|\n if rel_resource.id != self.id\n if rel_resource.author_id == user\n rel_resource_list[rel_resource.id] = rel_resource.title\n elsif rel_resource.author_id == nil and rel_resource.user_id == user\n rel_resource_list[rel_resource.id] = rel_resource.title\n end\n end\n end\n end\n return rel_resource_list\n end",
"def resource_limits; end",
"def resource_limits; end",
"def resource_params\n raise NotImplementedError\n end",
"def resource\n return @resource unless @resource.nil?\n\n @user_type = 'public'\n res = id.resources.submitted&.by_version_desc&.first\n return res if res.nil? # no submitted resources\n\n @resource = if admin?(resource: res)\n @user_type = 'privileged'\n id.resources.submitted.by_version_desc.first\n else # everyone else only gets to see published or embargoed metadata latest version\n id.latest_resource_with_public_metadata\n end\n end",
"def subclass_resource_equivalents\n @subclass_resource_names ||= [resource_name.to_sym]\n end",
"def private; end",
"def get_resource\n params.each do |name, value|\n if name.end_with?('_id')\n c = name.chomp('_id').classify.constantize rescue NameError\n if c.method_defined?(:collaborations)\n @resource = c.friendly.find(value)\n end\n end\n end\n end",
"def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end",
"def resource_scope\n resource_class.all\n end",
"def show_resources\r\n @resources_pages = Paginator.new self, \r\n Resource.count, \r\n Resource.get(\"resources_paginator_count\").to_i, \r\n params[:page] \r\n @resources = Resource.find :all, :order => 'name',\r\n :limit => @resources_pages.items_per_page,\r\n :offset => @resources_pages.current.offset \r\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 resource_params\n @resource_params ||= self.send(\"#{resource_name}_params\")\n end",
"def filters\n end",
"def allowed_resources\n %w( )\n end",
"def _filter r, options\n return r if params[:f].blank?\n return resource_class.filter r, params[:f], options if resource_class.respond_to? :filter\n r\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def get_resource(resource_type, filter = {})\n fail \"resource_type must be specified\" if resource_type.nil?\n\n # Ensure the hash key is correct when searching\n hash_key = resource_type.to_s.upcase\n hash_key = 'VMTEMPLATE' if hash_key == 'TPL' || hash_key == 'TEMPLATE'\n\n if filter.empty?\n Chef::Log.warn(\"get_resource: 'name' or 'id' must be provided\")\n return nil\n end\n pool = get_pool(resource_type)\n\n if resource_type.to_s != 'user' && filter[:id] && !filter[:id].nil?\n pool.info!(-2, filter[:id].to_i, filter[:id].to_i)\n return pool.first\n end\n\n if resource_type.to_s == 'user'\n pool.info\n else\n pool.info!(-2, -1, -1)\n end\n resources = []\n pool.each do |res|\n next unless res.name == filter[:name]\n next if filter[:uname] && res.to_hash[hash_key]['UNAME'] != filter[:uname]\n resources << res\n end\n return nil if resources.empty?\n return resources[0] if resources.size == 1\n resources\n end",
"def load_current_resource; end",
"def resource?\n true\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 incoming_chmod\n list\n lock_file\n log_file\n log_format\n max_connections\n munge_symlinks\n numeric_ids\n outgoing_chmod\n path\n postxfer_exec\n prexfer_exec\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 )\nend",
"def resources\n end",
"def filter(resource)\n resource.select { |key, _value| include? key }\n end",
"def resource\n self\n end",
"def findMappedResource(resources)\n obj=nil\n resources.each { |uri|\n if uri\n case uri.scheme\n when \"file\"\n file=uri.path\n if File.exists?(file)\n obj=File.open(file)\n end\n when \"http\"\n resp=Net::HTTP.get_response(uri)\n obj=resp.body if resp.code==\"200\"\n end\n if obj\n print \"found mapped resource #{uri}\\n\"\n break\n end\n end\n }\n obj\nend",
"def find_resource\n get params[:resource_path]\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def filtered_path; end",
"def resources\n @resources ||= {}\n end",
"def file_filtering_conditions(resource_name)\n NfsStore::Filter::Filter.generate_filters_for resource_name, user: current_user\n end",
"def method_missing(name, *args, &block)\n if args.empty? and resources and resources.has_resource?(name)\n resources[name]\n else\n super(name, *args, &block)\n end\n end",
"def pre_process_exposed_object(resource, type, singular)\n end",
"def generic_resource( unit )\n resources unit, concerns: [:search_suggestion, :uniqueness_validation, :retrieve_resource]\n end",
"def show\n case params[:medium]\n when 'videos' then @resources = @user.resources.where(medium_type: %w(VideoUpload VideoLink))\n when 'images' then @resources = @user.resources.where(medium_type: 'Album')\n else\n @resources = @user.resources\n end\n\n @resources = @resources.where(status: 'active') unless @user.eql?(current_user)\n end",
"def resource_pattern?\n false\n end",
"def resource\n self.class.resource\n end",
"def resource_all(stack)\n raise NotImplementedError\n end",
"def access_to_resources?(record)\n @normalized_resources.include?(record.resource)\n end",
"def initialize(new_resource, run_context)\n super(new_resource, run_context)\n\n if new_resource.path && new_resource.path != ''\n @path = new_resource.path\n else\n @path = \"/home/#{new_resource.owner}/newrelic_elastic_#{new_resource.application_name}\"\n end\nend",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def index\n if current_user.role?(:admin)\n if params[:search]\n @resources = Resource.search(params[:search]).paginate(:page => params[:page]).per_page(10)\n elsif params[:resource]\n @resources = Resource.tagged_with(params[:resource][:tagged_with]).paginate(:page => params[:page]).per_page(10)\n else\n @resources = Resource.all.paginate(:page => params[:page]).per_page(10)\n end\n else\n if params[:search]\n @resources = Resource.search(params[:search]).active.paginate(:page => params[:page]).per_page(10)\n elsif params[:resource]\n @resources = Resource.tagged_with(params[:resource][:tagged_with]).active.paginate(:page => params[:page]).per_page(10)\n else\n @resources = Resource.active.paginate(:page => params[:page]).per_page(10)\n end\n end\n end",
"def resource_full?\n resource? && @gapi_json.key?(:friendlyName)\n end",
"def extract_titles(resources)\n titles = []\n\n resources.each do |resource|\n titles << resource[:resource_id]\n end\n\n titles\nend",
"def resource_singular() self.class.read_inheritable_attribute(:resource_singular) end",
"def get_resource_to_use\n return @resources.first\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def get_resources_by_parent parent_resource_uuid, name=nil\n parent_resource_uuid = parent_resource_uuid if parent_resource_uuid.is_a?(Resource)\n \n @resources.find_all{|res|res.parent_uuid == parent_resource_uuid && (name.blank? || res.name == name)}\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 index\n unless params[:resource_group_id].blank?\n @resource_group = ResourceGroup.find(params[:resource_group_id])\n @resources = @resource_group.resources.includes(:resource_group, :users).order(\"resource_groups.name, resources.name\").paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)\n else\n # TODO FIXME for some reason the includes below stopped working when :permission_types is included\n # 'PGError: ERROR: column permission_types.activated does not exist' but not sure why it thinks it should exist at this point\n @resources = Resource.includes(:resource_group, :users).order(\"resource_groups.name, resources.name\").paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)\n end\n @resource_groups = ResourceGroup.order('name').all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end",
"def type\n Resource::ALL\n end",
"def perm_ancestors\n super + [parent_resource]\n end",
"def get_resource resource_uuid\n return resource_uuid if resource_uuid.is_a?(Resource)\n \n tmp = @resources.find{|res|res.uuid == resource_uuid}\n \n raise \"unknown resource with uuid #{resource_uuid}\" unless tmp\n \n tmp\n end",
"def show_resource_content\n resource_content\n end",
"def resource_class\n raise NotImplementedError\n end",
"def resource_type\n \"b\"\n end",
"def resource\n instance_variable_get(resource_name) || params[:id] && set_resource(controller_model.find(params[:id]))\n end",
"def resources _args\n \"resources _args;\" \n end"
] |
[
"0.6408725",
"0.6263638",
"0.6250768",
"0.6150716",
"0.6126603",
"0.6126603",
"0.61125785",
"0.60635257",
"0.60473853",
"0.6025615",
"0.5980223",
"0.59429896",
"0.593329",
"0.59237605",
"0.5907516",
"0.5885984",
"0.58440244",
"0.5816659",
"0.580991",
"0.5794237",
"0.578278",
"0.578278",
"0.57780606",
"0.57737994",
"0.5767335",
"0.575956",
"0.5721901",
"0.572103",
"0.5705914",
"0.5705433",
"0.5705433",
"0.5689389",
"0.5688907",
"0.5670486",
"0.56630427",
"0.5643052",
"0.562041",
"0.56110096",
"0.5609244",
"0.5600947",
"0.5600947",
"0.55988985",
"0.55943257",
"0.55943257",
"0.55935836",
"0.5576274",
"0.5563101",
"0.55537087",
"0.55521536",
"0.55515856",
"0.55502087",
"0.5542893",
"0.55376726",
"0.5536407",
"0.5535089",
"0.5525896",
"0.55239314",
"0.5521561",
"0.5521561",
"0.55183125",
"0.5516655",
"0.5510917",
"0.5505787",
"0.55014104",
"0.54947925",
"0.5487197",
"0.5484058",
"0.54782265",
"0.5477462",
"0.5476672",
"0.54717994",
"0.5467194",
"0.5464694",
"0.5461329",
"0.5446742",
"0.54451907",
"0.54449785",
"0.5440344",
"0.54383326",
"0.5437186",
"0.5435193",
"0.54312253",
"0.54281056",
"0.5425813",
"0.5410252",
"0.54069",
"0.54003567",
"0.5398179",
"0.5398179",
"0.5398179",
"0.5392991",
"0.5371767",
"0.5367032",
"0.536703",
"0.536649",
"0.5366328",
"0.536589",
"0.535722",
"0.5352603",
"0.53513217",
"0.53490216"
] |
0.0
|
-1
|
GET /feedbacks GET /feedbacks.json Admin only index page
|
def index
@feedbacks = Feedback.all.sort_by(&:created_at).reverse
respond_with @feedbacks
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all\n respond_to do |format|\n if request.xhr?\n format.html # index.html.erb\n end\n format.json { render json: @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n respond_with Feedback.all\n end",
"def index\n @title = t('view.feedbacks.index_title')\n @feedbacks = @lesson.feedbacks.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def index\n @feedback_items = FeedbackItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedback_items }\n end\n end",
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedbacks }\n end\n end",
"def index\n @user_feedbacks = UserFeedback.all\n end",
"def index\n @feedback_requests = FeedbackRequest.all\n end",
"def index\n @feedbacks = Feedback.all.order('created_at DESC')\n render json: @feedbacks\n end",
"def index\n @feedbacks = Feedback.where(status_id: 2)\n @feedback_requests = Feedback.where(status_id: 1)\n end",
"def index\n @feedbacks = Feedback.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @feedbacks\n end",
"def index\n\n \n @feedbacks = Feedback.all\n #@feedbacks = Feedback.find_each(batch_size: 30)\n \n # if current_user_is_admin?\n # @feedbacks = Feedback.all\n # else\n # @feedbacks = Feedback.where('feedbacks.department_id=?',current_user.department_id)\n # end\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def index\n @team = User.find(@idea.team_ids)\n @idea = Idea.find(params[:idea_id])\n authorize @idea\n\n @feedbacks = @idea.get_published_feedbacks.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def index\n @feedback_users = FeedbackUser.all\n end",
"def index\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n if @current_user.is_admin\n @feedbacks = Feedback.all\n else\n @feedbacks = Feedback.where('email=?', @current_user.email)\n end\n else\n flash[:notice] = \"Please login to view your feedback.\"\n redirect_to login_path\n end\n \n end",
"def show\n render json: @feedback\n end",
"def index\n @feedback_items = FeedbackItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedback_items }\n end\n end",
"def show\n @title = t('view.feedbacks.show_title')\n @feedback = find_feedback\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def index\n submission = Submission.get_submission_by_group_id_and_assignment_id(\n params[:group_id], params[:assignment_id]\n )\n\n collection = submission.feedback_files\n\n feedback_files = get_collection(collection) || return\n\n respond_to do |format|\n format.xml do\n render xml: feedback_files.to_xml(only: DEFAULT_FIELDS, root: 'feedback_files', skip_types: 'true')\n end\n format.json { render json: feedback_files.to_json(only: DEFAULT_FIELDS) }\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: { code: '404', message:\n e }, status: :not_found\n end",
"def index\n @feedback_forms = FeedbackForm.all\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def index \n @feedback = @line_item.feedback\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feedback.to_xml }\n end\n end",
"def show\n @team = User.find(@idea.team_ids)\n authorize @feedback.idea\n @feedbacks = @feedback.root_comments.paginate(page: params[:page], per_page: 10)\n end",
"def index\n @feedbacks = Feedback.paginate(:page=> params[:page], :per_page => 15, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedbacks }\n end\n end",
"def index\n if params[:topic_id]\n lessons = Lesson.where( topic_id: params[:topic_id] )\n else\n lessons = Lesson.all\n end\n\n respond_to do |format| \n format.html { }\n format.js { }\n format.json { render json: lessons }\n end\n end",
"def index\n @user_feedback_notes = UserFeedbackNote.all\n end",
"def filter_feedbacks\n if params[:user_id].present?\n @user = User.find(params[:user_id])\n @feedbacks = @user.my_feedbacks(params[:resonance], params[:search])\n all_user_feedbacks = @user.my_feedbacks\n elsif params[:manager].present? && current_user.is_a?(Manager)\n @feedbacks = current_user.employee_feedbacks(params[:resonance], params[:search])\n all_user_feedbacks = current_user.employee_feedbacks\n else\n @feedbacks = current_user.home_feedbacks(params[:resonance], params[:search])\n all_user_feedbacks = current_user.home_feedbacks\n end\n @feedbacks = @feedbacks.paginate(page: params[:page])\n html = render_to_string(partial: 'feedbacks/index', locals: { feedbacks: @feedbacks })\n resonances = { resonant: all_user_feedbacks.resonant.count.count, mixed: all_user_feedbacks.mixed.count.count, isolated: all_user_feedbacks.isolated.count.count }\n if params[:page]\n respond_to do |format|\n format.js\n end\n else\n respond_to do |format|\n format.json { render json: { feedbacks: html, resonances: resonances } }\n end\n end\n end",
"def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end",
"def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end",
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n @feedback_replies = FeedbackReply.all.paginate(page: params[:page], :per_page => 20)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def feedback\n client.feedback app_id\n end",
"def index\n @users = Question.users\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @feedbacks = Feedback.all\n @topics = Topic.all\n\n for topic in @topics\n if @topicstats\n @topicstats = @topicstats + [[FeedbackItem.where(:topic_id => topic.id).sum(:position).to_f / @feedbacks.length, FeedbackItem.where(:topic_id => topic.id).sum(:percentage).to_f / @feedbacks.length, topic.id]]\n else\n @topicstats = [[FeedbackItem.where(:topic_id => topic.id).sum(:position).to_f / @feedbacks.length, FeedbackItem.where(:topic_id => topic.id).sum(:percentage).to_f / @feedbacks.length, topic.id]]\n end \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def index\n unless current_user.admin?\n respond_to do |format|\n format.html { redirect_to '/', alert: \"You don't have access to view that page\" }\n format.json { render :show, status: :ok, location: @user }\n end\n end\n @questions = Question.all\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end",
"def index\n if session[:group] == \"admin\"\n if params[:search]\n @feedbacks = Feedback.search(params[:search].strip).order(\"created_at DESC\").page(params[:page])\n else\n @feedbacks = Feedback.order(:id).page(params[:page])\n end\n else\n company_id = User.where(account:session[:account]).first.company_id\n if params[:search]\n @feedbacks = Feedback.search(params[:search].strip,company_id).order(\"created_at DESC\").page(params[:page])\n else\n @feedbacks = Feedback.where(company_id:company_id).order(:id).page(params[:page])\n end \n end\n # @filterrific = initialize_filterrific(\n # Feedback,\n # params[:filterrific]\n # ) or return\n # @feedbacks = @filterrific.find.page(params[:page])\n\n # respond_to do |format|\n # format.html\n # format.js\n # end\n end",
"def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end",
"def index\n @feedbacks = Feedback.all\n if params[:q]\n @feedbacks = Feedback.where(\"lower(name) like lower(?)\", \"%#{params[:q]}%\")\n else \n @feedbacks = Feedback.paginate(page: params[:page], :per_page => 20)\n end \n end",
"def index\n @talk_comments = TalkComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_comments }\n end\n end",
"def index\n if current_user.userable_type.to_str == \"Admin\"\n @feedbacks = Feedback.all\n elsif current_user.userable_type.to_str == \"Student\"\n @feedbacks = Feedback.where(student_id: current_user.userable.id)\n else current_user.userable_type.to_str == \"Teacher\"\n @feedbacks = Feedback.where(teacher_id: current_user.userable.id)\n end\n end",
"def feedback\n @seller = Seller.find(params[:id])\n @feedback = @seller.feedback.find(:all)\n \n respond_to do |format|\n format.html # feedback.rhtml\n format.xml { render :xml => @feedback.to_xml }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n respond_with(@feedback)\n end",
"def show\n @feedback = Feedback.find(params[:id])\n respond_with(@feedback)\n end",
"def index\n @admin_topics = Topic.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @admin_topics }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n respond_with @feedback\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @talks = Talk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talks }\n end\n end",
"def index\n @community_topics = CommunityTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @community_topics }\n end\n end",
"def help\r\n\r\n @user_actions = Access.where(:table_sid => \"dev_feedbacks\", :action_sid => [\"index\", \"list\", \"new\", \"create\", \"show\", \"edit\", \"update\", \"destroy\", \"search\", \"download\", \"feed\", \"help\", \"adv_search\"]).includes([:user_accesses, :profile_accesses]).reject{|a| @current_user.can_run?(a) }\r\n render(:layout => !request.xhr?)\r\n end",
"def index\n if params[:admin]==\"1\"\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devans }\n end\n end",
"def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @score_templates = ScoreTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @score_templates }\n end\n end",
"def index\n @surveys = Survey.all\n\n respond_to do |format|\n format.html { render \"index\", layout: \"application\" }\n format.json { render json: @surveys }\n end\n end",
"def index\n @chats = Chat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chats }\n end\n end",
"def index\n @questions = Question.accessible_by(current_ability)\n\n respond_with @questions\n end",
"def index\n @discussions = Discussion.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discussions }\n end\n end",
"def index\n @forum_categories = ForumCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forum_categories }\n end\n end",
"def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end",
"def show\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def show\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def index\n @discussions = Discussion.paginate page: params[:page], order: \"last_post_at DESC\", per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def show\n @feedback_page = FeedbackPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback_page }\n end\n end",
"def index\n @discussions = Discussion.includes(:user)\n .order('updated_at DESC')\n .paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @faq_categories = FaqCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faq_categories }\n end\n end",
"def index\n @surveys = Survey.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @surveys }\n end\n end",
"def index\n @surveys = Survey.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @surveys }\n end\n end",
"def index\n @surveys = Survey.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @surveys }\n end\n end",
"def recommended_feedbacks\n @user = User.find(params[:user_id])\n @articles = Article.accessibles(current_user).feedbacks_recommended(@user).paginate(page: params[:page], per_page: Article::PER_PAGE) unless @user.blank?\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: Article::List::Type::FEEDBACKS_RECOMMENDED)\n respond_to do |format|\n format.html { render 'articles_by_user' }\n end\n unless @articles.any?\n flash[:alert] = get_resource 'no_article'\n end\n end",
"def index\n @mail_tmps = MailTmp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mail_tmps }\n end\n end",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end"
] |
[
"0.8125489",
"0.78079593",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.76093894",
"0.7596521",
"0.7515115",
"0.7427078",
"0.7413484",
"0.7413484",
"0.7405309",
"0.7365898",
"0.7277934",
"0.72519225",
"0.7216201",
"0.72119486",
"0.7140531",
"0.7017974",
"0.6993246",
"0.69836867",
"0.692612",
"0.681887",
"0.6797233",
"0.67960083",
"0.67926866",
"0.67926866",
"0.67926866",
"0.67926866",
"0.67926866",
"0.67926866",
"0.66846484",
"0.6671702",
"0.6614241",
"0.6508104",
"0.64799124",
"0.64781404",
"0.64354044",
"0.64325166",
"0.6431617",
"0.64131796",
"0.6410846",
"0.63996977",
"0.637998",
"0.6379948",
"0.634509",
"0.63163656",
"0.6302991",
"0.63021404",
"0.62944126",
"0.6289987",
"0.6271973",
"0.62678856",
"0.6263963",
"0.62585557",
"0.6250963",
"0.6250756",
"0.62426966",
"0.62426966",
"0.62349373",
"0.621229",
"0.6211935",
"0.62052155",
"0.6202279",
"0.6197241",
"0.61923033",
"0.61918193",
"0.6191398",
"0.61909515",
"0.61909515",
"0.61909515",
"0.61909515",
"0.61820626",
"0.6181498",
"0.61752844",
"0.61707735",
"0.6169751",
"0.6167022",
"0.6166742",
"0.6148787",
"0.6148787",
"0.6146498",
"0.6143703",
"0.61435384",
"0.61434066",
"0.61426604",
"0.6133199",
"0.6133199",
"0.61265177",
"0.6120806",
"0.6120806",
"0.6120091",
"0.609851",
"0.6094952",
"0.6094416"
] |
0.6852526
|
27
|
GET /feedbacks/1 GET /feedbacks/1.json Admin only show feedback page (note there is no link to actually get to this page, but keeping it for possible future use)
|
def show
@feedback = Feedback.find(params[:id])
respond_with @feedback
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def show\n @title = t('view.feedbacks.show_title')\n @feedback = find_feedback\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n render json: @feedback\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def show\n @feedback_page = FeedbackPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback_page }\n end\n end",
"def index\n @title = t('view.feedbacks.index_title')\n @feedbacks = @lesson.feedbacks.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n respond_to do |format|\n if request.xhr?\n format.html # index.html.erb\n end\n format.json { render json: @feedbacks }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @team = User.find(@idea.team_ids)\n authorize @feedback.idea\n @feedbacks = @feedback.root_comments.paginate(page: params[:page], per_page: 10)\n end",
"def show\n @feedback = Feedback.find(params[:id])\n respond_with(@feedback)\n end",
"def show\n @feedback = Feedback.find(params[:id])\n respond_with(@feedback)\n end",
"def index\n respond_with Feedback.all\n end",
"def index\n @user_feedbacks = UserFeedback.all\n end",
"def show\n @feedback_item = FeedbackItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback_item }\n end\n end",
"def show\n @feedback_form = FeedbackForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback_form }\n end\n end",
"def show\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def show\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def feedback\n client.feedback app_id\n end",
"def index\n @feedback_requests = FeedbackRequest.all\n end",
"def index\n @feedback_items = FeedbackItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedback_items }\n end\n end",
"def index\n @feedbacks = Feedback.all.order('created_at DESC')\n render json: @feedbacks\n end",
"def index\n @feedbacks = Feedback.where(status_id: 2)\n @feedback_requests = Feedback.where(status_id: 1)\n end",
"def index\n @team = User.find(@idea.team_ids)\n @idea = Idea.find(params[:idea_id])\n authorize @idea\n\n @feedbacks = @idea.get_published_feedbacks.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def show\n @feedback_short = FeedbackShort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback_short }\n end\n end",
"def show\n @presentation = Presentation.find(params[:id])\n @feedbacks = @presentation.feedbacks\n\n\n end",
"def show\n @feedback = Feedback.find(params[:id])\n @comment = Comment.new\n\n respond_to do |format|\n if request.xhr?\n format.html # show.html.erb\n end\n format.json { render json: @feedback }\n end\n end",
"def index\n @feedbacks = Feedback.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @feedbacks\n end",
"def show\n @validated_feedback = ValidatedFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @validated_feedback }\n end\n end",
"def show\n @resume_feedback = ResumeFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resume_feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n if current_user.admin?\n flash[:success] = \"Here is your feedback\"\n @feedbacks = Feedback.all\n render 'feedbacks/show_feedback'\n else\n render 'static_pages/feedback'\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feedback }\n end\n end",
"def show\n @session = Session.find(params[:id])\n @feedback= @session.feedback\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end",
"def show\r\n\r\n @dev_feedback_attributes = params[:dev_feedback] ? params[:dev_feedback][params[:id]].clone : {}\r\n @dev_feedback_attributes.merge!(:id => params[:id]) if @dev_feedback_attributes\r\n @dev_feedback_attributes.delete(:ip) if @dev_feedback_attributes && restrict_ip_for_show_5\r\n @dev_feedback_attributes.delete(:ua) if @dev_feedback_attributes && restrict_ua_for_show_5\r\n @dev_feedback = DevFeedback.load_from_params(@dev_feedback_attributes)\r\n if @dev_feedback.nil?\r\n flash[:warning] ||= []\r\n flash[:warning] << _(\"Warning: %{obj} with ID %{id} does not exist!\") % {:obj => 'dev_feedback', :id => params[:id]}\r\n redirect_to(:action => :index)\r\n return\r\n end\r\n\r\n respond_to do |format|\r\n format.html {\r\n render :layout => !request.xhr? }\r\n format.pdf {\r\n render :layout => false }\r\n format.xml {\r\n render :xml => @dev_feedback.to_xml }\r\n format.json {\r\n render :json => @dev_feedback.to_json }\r\n end\r\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedbacks }\n end\n end",
"def index\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n if @current_user.is_admin\n @feedbacks = Feedback.all\n else\n @feedbacks = Feedback.where('email=?', @current_user.email)\n end\n else\n flash[:notice] = \"Please login to view your feedback.\"\n redirect_to login_path\n end\n \n end",
"def recommended_feedbacks\n @user = User.find(params[:user_id])\n @articles = Article.accessibles(current_user).feedbacks_recommended(@user).paginate(page: params[:page], per_page: Article::PER_PAGE) unless @user.blank?\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: Article::List::Type::FEEDBACKS_RECOMMENDED)\n respond_to do |format|\n format.html { render 'articles_by_user' }\n end\n unless @articles.any?\n flash[:alert] = get_resource 'no_article'\n end\n end",
"def feedback\n render 'feedback_items/feedback_form'\n end",
"def feedback\n @seller = Seller.find(params[:id])\n @feedback = @seller.feedback.find(:all)\n \n respond_to do |format|\n format.html # feedback.rhtml\n format.xml { render :xml => @feedback.to_xml }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feedback.to_xml }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feedback.to_xml }\n end\n end",
"def filter_feedbacks\n if params[:user_id].present?\n @user = User.find(params[:user_id])\n @feedbacks = @user.my_feedbacks(params[:resonance], params[:search])\n all_user_feedbacks = @user.my_feedbacks\n elsif params[:manager].present? && current_user.is_a?(Manager)\n @feedbacks = current_user.employee_feedbacks(params[:resonance], params[:search])\n all_user_feedbacks = current_user.employee_feedbacks\n else\n @feedbacks = current_user.home_feedbacks(params[:resonance], params[:search])\n all_user_feedbacks = current_user.home_feedbacks\n end\n @feedbacks = @feedbacks.paginate(page: params[:page])\n html = render_to_string(partial: 'feedbacks/index', locals: { feedbacks: @feedbacks })\n resonances = { resonant: all_user_feedbacks.resonant.count.count, mixed: all_user_feedbacks.mixed.count.count, isolated: all_user_feedbacks.isolated.count.count }\n if params[:page]\n respond_to do |format|\n format.js\n end\n else\n respond_to do |format|\n format.json { render json: { feedbacks: html, resonances: resonances } }\n end\n end\n end",
"def show\n @purchase_feedback = PurchaseFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_feedback }\n end\n end",
"def index\n @feedbacks = Feedback.paginate(:page=> params[:page], :per_page => 15, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedbacks }\n end\n end",
"def index\n @feedback_users = FeedbackUser.all\n end",
"def index\n\n \n @feedbacks = Feedback.all\n #@feedbacks = Feedback.find_each(batch_size: 30)\n \n # if current_user_is_admin?\n # @feedbacks = Feedback.all\n # else\n # @feedbacks = Feedback.where('feedbacks.department_id=?',current_user.department_id)\n # end\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all.sort_by(&:created_at).reverse\n respond_with @feedbacks \n end",
"def set_feedback\n begin\n @feedback = Feedback.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render \"layouts/not_found.html.erb\"\n else\n @feedback = Feedback.find(params[:id])\n end\n end",
"def index\n @feedback_forms = FeedbackForm.all\n end",
"def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n @feedbacks = Feedback.find_all_by_project_id(params[:project_id])\n format.js { render action: \"index\" }\n else\n @feedback_types = current_user.possible_feedback_types\n format.js {}\n end\n end\n end",
"def index\n submission = Submission.get_submission_by_group_id_and_assignment_id(\n params[:group_id], params[:assignment_id]\n )\n\n collection = submission.feedback_files\n\n feedback_files = get_collection(collection) || return\n\n respond_to do |format|\n format.xml do\n render xml: feedback_files.to_xml(only: DEFAULT_FIELDS, root: 'feedback_files', skip_types: 'true')\n end\n format.json { render json: feedback_files.to_json(only: DEFAULT_FIELDS) }\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: { code: '404', message:\n e }, status: :not_found\n end",
"def ask_for_feedback\n feedback = show do\n title \"We want your feedback\"\n \n note \"Notice anything weird with this protocol? Tell us below!\"\n \n get \"text\", var: \"feedback_user\", label: \"Enter your feedback here\", default: \"\"\n end\n feedback[:feedback_user] # return\n end",
"def index \n @feedback = @line_item.feedback\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feedback.to_xml }\n end\n end",
"def index\n @feedback_replies = FeedbackReply.all.paginate(page: params[:page], :per_page => 20)\n end",
"def feedback_app\n @feedback_text = params[:feedback_text]\n respond_to do |format|\n FeedbackMailer.to_admin(@feedback_text, current_user).deliver_now\n format.js { render template: 'singles/feedback_app.js.erb' }\n end\n end",
"def new\n @feedback_short = FeedbackShort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback_short }\n end\n end",
"def index\n @feedback_items = FeedbackItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedback_items }\n end\n end",
"def set_feedback\n @feedback = SiteFeedback::Feedback.find(params[:id])\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def set_feedback\n @feedback = current_user.feedbacks.find(params[:id])\n end",
"def show\n @feedback_item = FeedbackItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feedback_item }\n end\n end",
"def new\r\n\r\n @dev_feedback_attributes = params[:dev_feedback] ? params[:dev_feedback]['0'].clone : {}\r\n\r\n @dev_feedback = DevFeedback.load_from_params(@dev_feedback_attributes)\r\n\r\n render(:layout => !request.xhr?)\r\n end",
"def get_feedback\n @title_page = 'Feedback'\n\n params.each { |question, answer| $game.quiz.user_answer << answer.to_i }\n\n $game.player.score = ($game.quiz.number_corrects * 100) / $game.quiz.question_answer.length\n @feedback = $game.player.score\n\n @questions = $game.quiz.questions\n @user_answer = $game.quiz.user_answer\n\n erb :feedback, layout: :template\nend",
"def show\n @user = User.find_by(id: @feedback.user_id)\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def new\n @customer_feedback = CustomerFeedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def help\r\n\r\n @user_actions = Access.where(:table_sid => \"dev_feedbacks\", :action_sid => [\"index\", \"list\", \"new\", \"create\", \"show\", \"edit\", \"update\", \"destroy\", \"search\", \"download\", \"feed\", \"help\", \"adv_search\"]).includes([:user_accesses, :profile_accesses]).reject{|a| @current_user.can_run?(a) }\r\n render(:layout => !request.xhr?)\r\n end",
"def new\n @title = t('view.feedbacks.new_title')\n @feedback = @lesson.feedbacks.build(default_args)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"def set_feedback\n @feedback = Feedback.find(params[:id])\n end"
] |
[
"0.80434686",
"0.7733841",
"0.7676877",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7535486",
"0.7425618",
"0.73609686",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.72710586",
"0.7247952",
"0.72359824",
"0.7174516",
"0.7174516",
"0.7159122",
"0.70583844",
"0.70304",
"0.70285803",
"0.70245785",
"0.70245785",
"0.702247",
"0.6990986",
"0.6950001",
"0.6943293",
"0.69427115",
"0.69341695",
"0.69246745",
"0.6910955",
"0.68680185",
"0.6858179",
"0.68514895",
"0.68497413",
"0.6847782",
"0.68449175",
"0.6836717",
"0.6836717",
"0.6836717",
"0.68204",
"0.6819157",
"0.68175375",
"0.68175375",
"0.68175375",
"0.6817379",
"0.6817379",
"0.68084836",
"0.67952627",
"0.6761876",
"0.6736502",
"0.66809356",
"0.66809356",
"0.6659892",
"0.66303194",
"0.6528389",
"0.6505507",
"0.65048754",
"0.64985955",
"0.6493964",
"0.64788836",
"0.6467571",
"0.646379",
"0.64491785",
"0.64420694",
"0.64342606",
"0.64183015",
"0.6410344",
"0.6408253",
"0.63942575",
"0.6381206",
"0.63533896",
"0.6334596",
"0.6330825",
"0.6323508",
"0.6308995",
"0.6306054",
"0.6306054",
"0.6306054",
"0.63009495",
"0.62948596",
"0.6287402",
"0.6286366",
"0.62850964",
"0.62850237",
"0.62850237",
"0.62850237",
"0.62850237",
"0.62850237",
"0.62850237",
"0.62850237",
"0.62850237"
] |
0.71308714
|
26
|
GET /feedbacks/new GET /feedbacks/new.json new feedback page note only gets called when there is an error from popup
|
def new
@feedback = Feedback.new
respond_with @feedback
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @title = t('view.feedbacks.new_title')\n @feedback = @lesson.feedbacks.build(default_args)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @feedback_item = FeedbackItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback_item }\n end\n end",
"def new_feedback\n\n end",
"def new\n @resume_feedback = ResumeFeedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resume_feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n if current_user.admin?\n flash[:success] = \"Here is your feedback\"\n @feedbacks = Feedback.all\n render 'feedbacks/show_feedback'\n else\n render 'static_pages/feedback'\n end\n end",
"def new\n @feedback = Feedback.new\n respond_with(@feedback)\n end",
"def new\n @feedback = Feedback.new\n respond_with(@feedback)\n end",
"def new\n @feedback_form = FeedbackForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback_form }\n end\n end",
"def new\n @customer_feedback = CustomerFeedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feedback }\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @feedback = Feedback.new(params[:feedback])\n \n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # @feedback = Feedback.new\n # \n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @feedback }\n # end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.user = current_user\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to feedbacks_path(tab_page: 1), notice: 'Feedback was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new', tab_page: 1 }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to action: \"index\", notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n\r\n @dev_feedback_attributes = params[:dev_feedback] ? params[:dev_feedback]['0'].clone : {}\r\n\r\n @dev_feedback = DevFeedback.load_from_params(@dev_feedback_attributes)\r\n\r\n render(:layout => !request.xhr?)\r\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end",
"def new\n @feedback_short = FeedbackShort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback_short }\n end\n end",
"def create\n @feedback = @entry.feedbacks.new(params[:feedback].merge(user: current_user))\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to contest_entry_url(@contest, @entry), notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @purchase_feedback = PurchaseFeedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_feedback }\n end\n end",
"def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:dev_feedback].blank? || !params[:dev_feedback].is_a?(Hash)\r\n @dev_feedback_attributes = params[:dev_feedback] ? params[:dev_feedback]['0'].clone : {}\r\n @dev_feedback_attributes.delete(:ip) if @dev_feedback_attributes && restrict_ip_for_create_5\r\n @dev_feedback_attributes.delete(:ua) if @dev_feedback_attributes && restrict_ua_for_create_5\r\n @dev_feedback = DevFeedback.load_from_params(@dev_feedback_attributes)\r\n @dev_feedback.user = set_user_for_create_8\r\n @dev_feedback.ip = set_ip_for_create_9\r\n @dev_feedback.ua = set_ua_for_create_10\r\n if @dev_feedback.errors.empty? && @dev_feedback.save\r\n @dev_feedback.move_to_child_of(@dev_feedback_attributes[:parent_id]) unless @dev_feedback_attributes[:parent_id].blank?\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Dev Feedback\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @dev_feedback.id}.merge(@dev_feedback.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @dev_feedback.errors.full_messages}.merge(@dev_feedback.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end",
"def create\n @feedback = Feedback.new(feedback_params) # 获取view页面传的feedback_params参数创建意见反馈\n respond_to do |format| # 处理表单方法\n if @feedback.save # 保存\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully created.' } # 保存成功,跳转到意见反馈列表页面\n else\n format.html { render :new } # 保存失败,跳转到填写意见反馈的页面\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to(common_feedbacks_path, :notice => 'Feedback was successfully created.') }\n format.xml { render :xml => @feedback, :status => :created, :location => @feedback }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.feedbacks.new_title')\n @feedback = @lesson.feedbacks.build default_args.reverse_merge(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to [@lesson, @feedback], notice: t('view.feedbacks.correctly_created') }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.user = current_user\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to feedbacks_with_token_url(feedback_params[:token]), notice: 'Feedback was successfully created. Thanks!' }\n format.json { render :new, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to(admin_feedback_path(@feedback), :notice => 'Feedback was successfully created.') }\n format.xml { render :xml => @feedback, :status => :created, :location => @feedback }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n respond_to do |format|\n if @feedback.save\n format.html do\n redirect_to @feedback, notice: 'Feedback was successfully created.'\n end\n else\n format.html { render :new }\n end\n end\n end",
"def json_create_feedback\n\n @feedback = Feedback.new()\n @feedback.name = params[:name] unless params[:name].nil?\n @feedback.email = params[:email] unless params[:email].nil?\n @feedback.description = params[:description] unless params[:description].nil?\n @feedback.user_id = params[:user_id] unless params[:user_id].nil?\n\n respond_to do |format|\n if @feedback.save\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to(@feedback, :notice => 'Feedback was successfully created.') }\n format.xml { render :xml => @feedback, :status => :created, :location => @feedback }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @feedback = Feedback.new\n render :layout => 'application'\n end",
"def new\n @feedback_item = FeedbackItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feedback_item }\n end\n end",
"def new\n @feedback = Feedback.new\n end",
"def create\n @feedback = Feedback.create!(\n name: params['feedback']['name'],\n email: params['feedback']['email'],\n title: params['feedback']['title'],\n review: params['feedback']['review']\n )\n\n if @feedback\n render json:{\n status: :created,\n feedback: @feedback\n }\n else\n render json: { status: 500}\n end\n end",
"def new\n @issue = Issue.new\n @feedback = Feedback.find(params[:feedback_id])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.feedback_id = @feedback.id\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n @issue = Issue.new\n @feedback = Feedback.find(params[:feedback_id])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.feedback_id = @feedback.id\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def create\n # make sure only students not assigned to this presentation can access this page\n student = Student.find_by(email: current_user.email)\n redirect_to(presentations_path) and return if Presentation.find(cookies[:id]).students.include?(student)\n\n # create new feedback with the comment and grade based off what user entered in the create new feedback form\n @feedback = Feedback.new(feedback_params)\n # assign the feedback to its given presentation based on the cookie stored in the create feedback page\n @feedback.presentation = Presentation.find(cookies[:id])\n # assign the current student to the feedback's student\n @feedback.student = Student.find_by_email(current_user.email)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to '/presentations'}\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { redirect_to(feedbacks_path + '/new/' + cookies[:id].to_s) }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n #template = NotificationTemplate.where(category: I18n.t('Notification.feedback')).last\n #Notification.create(recipient: current_user, actor: current_user, action: 'Offer', notifiable: @feedback, notification_template: template)\n UserMailer.delay.feedback(@feedback)\n \n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n flash[:feed_key] = @feedback.editable_key\n flash[:notice] = 'Your Feedback was successfully created.Thank you! We really appreciate you participation.'\n format.html { redirect_to feedback_url(@feedback) }\n format.xml { head :created, :location => feedback_url(@feedback) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors.to_xml }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n\n respond_to do |format|\n if @feedback.save\n # User.send_feedback_notification(@feedback)\n Thread.new(@feedback) { |feedback|\n User.send_feedback_notification(feedback)\n }\n @feedbacks = Feedback.project_feedbacks @feedback.project_id\n format.js { render action: \"index\" }\n else\n @feedback_types = current_user.possible_feedback_types\n format.js {}\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n respond_with(@feedback) do\n redirect_to \"/feedbacks/thank_you\" if @feedback.save\n end\n end",
"def send_feedback\n feedback = FeedbackItem.new(:user_id=>current_user.id, :url=>params[:url], :page=>params[\"feedback-form-select\"], :description=>params[:description])\n if @saved = feedback.save\n flash[:success_message] = \"Thank you for your feedback. We will inform you when this issue has been resolved.\"\n else\n flash[:error_message] = \"We're sorry, but we could not complete this request. Please send an email to [email protected] with a description of the problem.\"\n end\n render 'feedback_items/feedback_submit.js.erb'\n end",
"def new\n load_data\n @feedback = Feedback.new()\n end",
"def create\n @feedback_form = FeedbackForm.new(params[:feedback_form])\n\n respond_to do |format|\n if @feedback_form.save\n format.html { redirect_to @feedback_form, notice: 'Feedback form was successfully created.' }\n format.json { render json: @feedback_form, status: :created, location: @feedback_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n @feedback.save\n respond_with(@feedback)\n end",
"def show\n render json: @feedback\n end",
"def new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def create\n @user_feedback = UserFeedback.new(user_feedback_params)\n\n respond_to do |format|\n if @user_feedback.save\n format.html { redirect_to @user_feedback, notice: 'User feedback was successfully created.' }\n format.json { render :show, status: :created, location: @user_feedback }\n else\n format.html { render :new }\n format.json { render json: @user_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n post_link = feedback_params[:post_link]\n\n post = Post.find_by_link(post_link)\n\n if post == nil\n render :text => \"Error: No post found for link\" and return\n end\n\n post.reasons.each do |reason|\n expire_fragment(reason)\n end\n \n expire_fragment(\"post\" + post.id.to_s)\n\n @feedback.post = post\n\n respond_to do |format|\n if @feedback.save\n format.json { render :show, status: :created, :text => \"OK\" }\n else\n format.json { render json: @feedback.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: @tips_trick }\n end\n end",
"def show\n @title = t('view.feedbacks.show_title')\n @feedback = find_feedback\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def create\n @resume_feedback = ResumeFeedback.new(params[:resume_feedback])\n\n respond_to do |format|\n if @resume_feedback.save\n format.html { redirect_to @resume_feedback, notice: 'Resume feedback was successfully created.' }\n format.json { render json: @resume_feedback, status: :created, location: @resume_feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resume_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @customer_feedback = CustomerFeedback.new\n\n @child = Child.new\n\n @investment = Investment.new\n @planned = Planned.new\n\n @reference = Reference.new\n\n @perssonal_assets = PersonalAssets.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_feedback }\n end\n end",
"def create\n @feedback_item = FeedbackItem.new(params[:feedback_item])\n\n respond_to do |format|\n if @feedback_item.save\n format.html { redirect_to @feedback_item, notice: 'Feedback item was successfully created.' }\n format.json { render json: @feedback_item, status: :created, location: @feedback_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = CreateFeedbackService.new(feedback_params, @idea, current_user).call\n authorize @feedback\n respond_to do |format|\n if @feedback.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def popup_new\n @breadcrumb = 'create'\n @ticket = Ticket.new(params[:ticket])\n @ticket.created_by = current_user.id if !current_user.nil?\n @ticket.source_ip = request.remote_ip\n @ticket.hd_email = mail_to\n @ticket.office_id = from_office\n @ticket.organization_id = from_organization\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to params[:referrer] }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { redirect_to params[:referrer], notice: I18n.t('activerecord.errors.ticket.popup') }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @poll_question = PollQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def create\n @feedback_request = FeedbackRequest.new(feedback_request_params)\n\n respond_to do |format|\n if @feedback_request.save\n format.html { redirect_to feedback_requests_path, notice: 'Feedback request was successfully created.' }\n format.json { render :show, status: :created, location: @feedback_request }\n else\n format.html { render :new }\n format.json { render json: @feedback_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def new\n @feedback = Feedback.new\n @topics = Topic.all.shuffle\n @p_range = -5..5\n priority = 0\n for topic in @topics do\n priority = priority + 1\n @feedback.feedback_items.build(:topic => topic, :position => priority, :percentage => 0) \n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback_mail = FeedbackMail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feedback_mail }\n end\n end",
"def new\n @feedback_page = FeedbackPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.turk do\n @disabled = Turkee::TurkeeFormHelper::disable_form_fields?(params)\n @feedback_page = FeedbackPage.find(params[:feedback_page_id])\n @questions = User.current_questions_for(params[:user_id])\n\n render :layout => false\n end\n end\n end",
"def new\n @topic = Topic.new\n @page_title = \"New Topic\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @bug_category = BugCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_category }\n end\n end",
"def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n if signed_in?\n @feedback.user_id = current_user.id\n end\n respond_to do |format|\n if @feedback.save\n if(UserMailer.feedback_request(@feedback).deliver)\n # flash[:success] = \"Your Request is send for Quote.\"\n else\n flash[:error] = \"Error sending email.\"\n end \n format.html { redirect_to @feedback, notice: \"Thanks, we'll get back to you shortly.\" }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @feedback = Feedback.new\n @feedback.interested_in = params[:interested_in]\n @feedback.user_id = current_user\n \n respond_to do |format|\n if @feedback.save\n head :created\n else\n head :bad_request\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.service_id = @service.id\n @feedback.user_id = @user.id\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to [@user, @service, @feedback], notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_feedback(feedback, community)\n subject = t(\"feedback.feedback_subject\", service_name: community.name(I18n.locale))\n\n premailer_mail(\n :to => mail_feedback_to(community, APP_CONFIG.feedback_mailer_recipients),\n :from => community_specific_sender(community),\n :subject => subject,\n :reply_to => feedback.email) do |format|\n format.html {\n render locals: {\n author_name_and_email: feedback_author_name_and_email(feedback.author, feedback.email, community),\n community_name: community.name(I18n.locale),\n content: feedback.content\n }\n }\n end\n end",
"def new_feedback\n UserMailer.new_feedback\n end",
"def show\n @feedback = Feedback.find(params[:id])\n @comment = Comment.new\n\n respond_to do |format|\n if request.xhr?\n format.html # show.html.erb\n end\n format.json { render json: @feedback }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def create\n data = params[:feedback]\n @feedback = Feedback.new(feedback_params(data))\n # @pitch.save\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to \"/pitches/#{data[:pitch_id]}\", notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render \"/pitches/#{data[:pitch_id]}\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end",
"def feedback\n render 'feedback_items/feedback_form'\n end",
"def new\n @talk_suggestion = TalkSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_suggestion }\n end\n end",
"def create\n Rails.logger.debug \"=========================================================\"\n Rails.logger.debug \"#{params}\"\n Rails.logger.debug \"=========================================================\"\n @feedback = Feedback.new(feedback_params)\n Announcement.where(\"id = ?\",params[:feedback][:annuncio_id]).limit(1).update_all(\"etichetta = 2\") # => 1\n Booking.where(\"id = ?\",params[:feedback][:booking_id]).limit(1).destroy_all\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to \"/feedbacks?utente=#{params[:feedback][:proprietario_id]}\", notice: 'Il feedback è stato lasciato correttamente!' }\n format.json { render :index, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end"
] |
[
"0.78339034",
"0.78339034",
"0.78339034",
"0.75340706",
"0.7406975",
"0.7308081",
"0.7254815",
"0.7224183",
"0.7184945",
"0.71809024",
"0.71809024",
"0.7168144",
"0.7161278",
"0.716113",
"0.716113",
"0.7127967",
"0.7127967",
"0.71135956",
"0.71110505",
"0.71087736",
"0.7076077",
"0.70547235",
"0.7024099",
"0.7022682",
"0.70061594",
"0.6966748",
"0.69591",
"0.69590795",
"0.68854326",
"0.6883817",
"0.68815124",
"0.68773973",
"0.68562156",
"0.6844653",
"0.68239224",
"0.6804522",
"0.67764294",
"0.6769299",
"0.6762362",
"0.6747618",
"0.6742124",
"0.67389655",
"0.6731915",
"0.6731915",
"0.6680508",
"0.6671271",
"0.6657576",
"0.66511184",
"0.6643969",
"0.66270673",
"0.6612612",
"0.660687",
"0.65913093",
"0.6589462",
"0.65886885",
"0.65851134",
"0.655117",
"0.6550482",
"0.6488082",
"0.6476316",
"0.6463306",
"0.64551187",
"0.6454403",
"0.6442177",
"0.642765",
"0.642533",
"0.6419133",
"0.6419133",
"0.6419133",
"0.6419133",
"0.6419133",
"0.6419133",
"0.6415719",
"0.6409932",
"0.6409068",
"0.63957167",
"0.63912493",
"0.6378501",
"0.637128",
"0.637128",
"0.63596934",
"0.6357475",
"0.635271",
"0.63462925",
"0.63347536",
"0.63257945",
"0.6312288",
"0.6309751",
"0.6292413",
"0.627838",
"0.6268001",
"0.62647784",
"0.6257322",
"0.625684",
"0.625684",
"0.625684",
"0.625684",
"0.625684",
"0.62567514",
"0.62567514"
] |
0.7192644
|
8
|
POST /feedbacks POST /feedbacks.json
|
def create
@feedback = Feedback.new(params[:feedback])
respond_with(@feedback) do
redirect_to "/feedbacks/thank_you" if @feedback.save
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end",
"def create\n \n @feedback = Feedback.new(params[:feedback])\n \n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.create!(\n name: params['feedback']['name'],\n email: params['feedback']['email'],\n title: params['feedback']['title'],\n review: params['feedback']['review']\n )\n\n if @feedback\n render json:{\n status: :created,\n feedback: @feedback\n }\n else\n render json: { status: 500}\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to action: \"index\", notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = @entry.feedbacks.new(params[:feedback].merge(user: current_user))\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to contest_entry_url(@contest, @entry), notice: 'Feedback was successfully created.' }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to feedbacks_with_token_url(feedback_params[:token]), notice: 'Feedback was successfully created. Thanks!' }\n format.json { render :new, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n @feedback.save\n respond_with(@feedback)\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.user_id = current_user.id\n @feedback.status_id = 2;\n sections = params[:sections]\n\n #puts \"Sections ######\"\n #puts sections\n\n respond_to do |format|\n if @feedback.save\n for section in sections\n feedbackSection = FeedbackSection.new\n feedbackSection.feedback_id = @feedback.id\n feedbackSection.question = section[\"question\"]\n feedbackSection.answer = section[\"answer\"]\n\n feedbackSection.rating = 0\n feedbackSection.question_type = 1\n feedbackSection.action_plan = ''\n feedbackSection.category = ''\n feedbackSection.save\n end\n\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:title, :content, :comment, :responded)\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.service_id = @service.id\n @feedback.user_id = @user.id\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to [@user, @service, @feedback], notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.feedbacks.new_title')\n @feedback = @lesson.feedbacks.build default_args.reverse_merge(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to [@lesson, @feedback], notice: t('view.feedbacks.correctly_created') }\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.user = current_user\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_create_feedback\n\n @feedback = Feedback.new()\n @feedback.name = params[:name] unless params[:name].nil?\n @feedback.email = params[:email] unless params[:email].nil?\n @feedback.description = params[:description] unless params[:description].nil?\n @feedback.user_id = params[:user_id] unless params[:user_id].nil?\n\n respond_to do |format|\n if @feedback.save\n format.json { render json: @feedback, status: :created, location: @feedback }\n else\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n #template = NotificationTemplate.where(category: I18n.t('Notification.feedback')).last\n #Notification.create(recipient: current_user, actor: current_user, action: 'Offer', notifiable: @feedback, notification_template: template)\n UserMailer.delay.feedback(@feedback)\n \n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end",
"def create\n @feedback = CreateFeedbackService.new(feedback_params, @idea, current_user).call\n authorize @feedback\n respond_to do |format|\n if @feedback.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to(common_feedbacks_path, :notice => 'Feedback was successfully created.') }\n format.xml { render :xml => @feedback, :status => :created, :location => @feedback }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n respond_to do |format|\n if @feedback.save\n format.html do\n redirect_to @feedback, notice: 'Feedback was successfully created.'\n end\n else\n format.html { render :new }\n end\n end\n end",
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def create\n @user_feedback = UserFeedback.new(user_feedback_params)\n\n respond_to do |format|\n if @user_feedback.save\n format.html { redirect_to @user_feedback, notice: 'User feedback was successfully created.' }\n format.json { render :show, status: :created, location: @user_feedback }\n else\n format.html { render :new }\n format.json { render json: @user_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:title, :description)\n end",
"def create\n @feedback = Feedback.new(feedback_params) # 获取view页面传的feedback_params参数创建意见反馈\n respond_to do |format| # 处理表单方法\n if @feedback.save # 保存\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully created.' } # 保存成功,跳转到意见反馈列表页面\n else\n format.html { render :new } # 保存失败,跳转到填写意见反馈的页面\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:update_id, :user_id, :description)\n end",
"def feedback_params\n params.require(:feedback).permit(:title, :email, :category, :body)\n end",
"def feedback_params\n params.require(:feedback).permit(:name, :email, :comment)\n end",
"def feedback_params\n params.require(:feedback).permit(:title, :description, :rating, :user_id)\n end",
"def feedback_params\n params.require(:feedback).permit(:comments, :rating, :receiver_id, :giver_id)\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.user = current_user\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to feedbacks_path(tab_page: 1), notice: 'Feedback was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new', tab_page: 1 }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @feedback = Feedback.new\n @feedback.interested_in = params[:interested_in]\n @feedback.user_id = current_user\n \n respond_to do |format|\n if @feedback.save\n head :created\n else\n head :bad_request\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:body, :tag_list)\n end",
"def feedback_params\r\n params.require(:feedback).permit(:rate, :evaluation_id, :feedback_type_id)\r\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to(@feedback, :notice => 'Feedback was successfully created.') }\n format.xml { render :xml => @feedback, :status => :created, :location => @feedback }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n\n respond_to do |format|\n if @feedback.save\n # User.send_feedback_notification(@feedback)\n Thread.new(@feedback) { |feedback|\n User.send_feedback_notification(feedback)\n }\n @feedbacks = Feedback.project_feedbacks @feedback.project_id\n format.js { render action: \"index\" }\n else\n @feedback_types = current_user.possible_feedback_types\n format.js {}\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:message_link, :user_name, :user_link, :feedback_type, :post_link)\n end",
"def feedback_params\n params.require(:feedback).permit(:rating, :text, :conf_id, :player_id, :game_id)\n end",
"def index\n @feedback_requests = FeedbackRequest.all\n end",
"def create\n @feedback_request = FeedbackRequest.new(feedback_request_params)\n\n respond_to do |format|\n if @feedback_request.save\n format.html { redirect_to feedback_requests_path, notice: 'Feedback request was successfully created.' }\n format.json { render :show, status: :created, location: @feedback_request }\n else\n format.html { render :new }\n format.json { render json: @feedback_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:email, :content, :category)\n end",
"def create\n Rails.logger.debug \"=========================================================\"\n Rails.logger.debug \"#{params}\"\n Rails.logger.debug \"=========================================================\"\n @feedback = Feedback.new(feedback_params)\n Announcement.where(\"id = ?\",params[:feedback][:annuncio_id]).limit(1).update_all(\"etichetta = 2\") # => 1\n Booking.where(\"id = ?\",params[:feedback][:booking_id]).limit(1).destroy_all\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to \"/feedbacks?utente=#{params[:feedback][:proprietario_id]}\", notice: 'Il feedback è stato lasciato correttamente!' }\n format.json { render :index, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:comment)\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to(admin_feedback_path(@feedback), :notice => 'Feedback was successfully created.') }\n format.xml { render :xml => @feedback, :status => :created, :location => @feedback }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def feedback_params\n params.require(:feedback).permit(:user_id, :title, :content, :image, :status)\n end",
"def create\n data = params[:feedback]\n @feedback = Feedback.new(feedback_params(data))\n # @pitch.save\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to \"/pitches/#{data[:pitch_id]}\", notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render \"/pitches/#{data[:pitch_id]}\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:token, :goals_for_week, :last_week, :something_small)\n end",
"def feedback_params\n params.require(:feedback).permit(:description)\n end",
"def feedback_params\n params.require(:feedback).permit(:yes, :message)\n end",
"def feedback_params\n params.require(:feedback).permit(:message)\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def index\n @feedbacks = Feedback.all\n end",
"def show\n render json: @feedback\n end",
"def feedback_params\n params.require(:feedback).permit(:quantiy_service, :comment, :traveller_id)\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n if @feedback.save\n flash[:success] = \"Feedback was successfully submitted. Thank you. :)\"\n AppMailer.feedback(@feedback).deliver\n redirect_to \"/\"\n else\n flash[:error] = \"Please try again.\"\n redirect_to \"/feedback\"\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def feedback_params\n #params.fetch(:feedback, {})\n params.require(:feedback).permit(:tenant_id, :date, :username, :age_type, :rating, :tenant_id, :favourite_dish, :least_dish, :comment, :reason)\n end",
"def index\n @feedbacks = Feedback.all.order('created_at DESC')\n render json: @feedbacks\n end",
"def feedback_params\n params.require(:feedback).permit(:parent_id, :user_id, :email, :kind, :subject, :description, :priority, :status)\n end",
"def new\n @title = t('view.feedbacks.new_title')\n @feedback = @lesson.feedbacks.build(default_args)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def create\n @conf = Conf.find_by(id: params[:feedback][:conf_id])\n\n @success = true\n\n if @conf.nil?\n success = false\n else\n @feedback = @conf.feedbacks.new(feedback_params)\n @conf.feedback_count = @conf.feedbacks.count + 1 #considera os ja salvos em banco + este\n @conf.rating = @conf.feedbacks.sum(:rating) + @feedback.rating #considera os ja salvos em banco + este\n success = @conf.save\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render :show, status: :ok }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:comment, :grade)\n end",
"def feedback_params\n params.require(:feedback).permit(:comment, :type, :station, :line)\n end",
"def create\n @team = Team.where(:id => params[:team_id]).first\n if @team == nil\n flash[:error] = \"Could not find team\"\n return redirect_to :action => \"index\"\n end\n @feedback = @team.feedbacks.new(feedback_params)\n @receiver_id= params[:user][:user_id]\n @feedback.receiver_id = @receiver_id\n if check_params(@feedback, @team)\n flash[:error] = \"Wrong arguments\"\n return redirect_to :action => \"new\"\n end\n assignment = Assignment.find(params[:assignment_id])\n @instructions = assignment.instructions\n respond_to do |format|\n if @feedback.save\n assignment.feedbacks << @feedback\n format.html { redirect_to course_team_assignment_feedbacks_path(params[:course_id], params[:team_id], params[:assignment_id], params[:id]), notice: 'Feedback was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def index\n @feedbacks = Feedback.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @feedbacks\n end",
"def feedback\n client.feedback app_id\n end",
"def index\n respond_with Feedback.all\n end",
"def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:dev_feedback].blank? || !params[:dev_feedback].is_a?(Hash)\r\n @dev_feedback_attributes = params[:dev_feedback] ? params[:dev_feedback]['0'].clone : {}\r\n @dev_feedback_attributes.delete(:ip) if @dev_feedback_attributes && restrict_ip_for_create_5\r\n @dev_feedback_attributes.delete(:ua) if @dev_feedback_attributes && restrict_ua_for_create_5\r\n @dev_feedback = DevFeedback.load_from_params(@dev_feedback_attributes)\r\n @dev_feedback.user = set_user_for_create_8\r\n @dev_feedback.ip = set_ip_for_create_9\r\n @dev_feedback.ua = set_ua_for_create_10\r\n if @dev_feedback.errors.empty? && @dev_feedback.save\r\n @dev_feedback.move_to_child_of(@dev_feedback_attributes[:parent_id]) unless @dev_feedback_attributes[:parent_id].blank?\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Dev Feedback\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @dev_feedback.id}.merge(@dev_feedback.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @dev_feedback.errors.full_messages}.merge(@dev_feedback.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end",
"def index\n @feedbacks = Feedback.all\n respond_to do |format|\n if request.xhr?\n format.html # index.html.erb\n end\n format.json { render json: @feedbacks }\n end\n end",
"def create\n @course = Course.find(params[:course_id])\n @course_section = CourseSection.find(params[:course_section_id])\n @feedback = Feedback.new(feedback_params)\n @feedback.course_section = @course_section\n @feedback.student = current_user.userable\n @feedback.teacher = @course_section.teacher\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' }\n format.json { render :show, status: :created, location: @feedback }\n else\n format.html { render :new }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:name, :email, :body, :attachment)\n end",
"def feedback_params\n params.require(:feedback).permit(:username, :pesan, :user_id)\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n respond_to do |format|\n if @feedback.save\n flash[:feed_key] = @feedback.editable_key\n flash[:notice] = 'Your Feedback was successfully created.Thank you! We really appreciate you participation.'\n format.html { redirect_to feedback_url(@feedback) }\n format.xml { head :created, :location => feedback_url(@feedback) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feedback.errors.to_xml }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:content, :course_id)\n end",
"def create\n p @customer_feedback = params[:customer_feedback]\n p @child = @customer_feedback[:child]\n p @customer_feedback.delete(:child)\n p @investment = @customer_feedback[:investment]\n p @personal_assets = @customer_feedback[:personal_assets]\n p @planned = @customer_feedback[:planned]\n p @references = @customer_feedback[:reference]\n p @customer_feedback.delete(:investment)\n p @customer_feedback.delete(:personal_assets)\n p @customer_feedback.delete(:planned)\n p @customer_feedback.delete(:reference)\n\n p @customer_feedback = CustomerFeedback.new(@customer_feedback)\n p @child = @customer_feedback.children.build(@child)\n p @personal_assets = @customer_feedback.personal_assets.build(@personal_assets)\n p @planned = @customer_feedback.planneds.build(@planned)\n p @reference = @customer_feedback.references.build(@reference)\n p @investment = @customer_feedback.investments.build(@investment)\n\n respond_to do |format|\n if @customer_feedback.save\n format.html { redirect_to @customer_feedback, notice: 'Customer feedback was successfully created.' }\n format.json { render json: @customer_feedback, status: :created, location: @customer_feedback }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:text, :email)\n end",
"def load_feedbacks\n feedbacks = Walmart.get_feedbacks_for self.name\n\n feedbacks.each do |f|\n self.reviews.create! :text => f\n end\n end",
"def create\n @feedback_form = FeedbackForm.new(params[:feedback_form])\n\n respond_to do |format|\n if @feedback_form.save\n format.html { redirect_to @feedback_form, notice: 'Feedback form was successfully created.' }\n format.json { render json: @feedback_form, status: :created, location: @feedback_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feedback_params\n params.fetch(:feedback, {})\n end",
"def new\n @feedback = Feedback.new\n @topics = Topic.all.shuffle\n @p_range = -5..5\n priority = 0\n for topic in @topics do\n priority = priority + 1\n @feedback.feedback_items.build(:topic => topic, :position => priority, :percentage => 0) \n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new_feedback\n\n end",
"def feedback_form\n @feedback = Feedback.new(params[:feedback])\n @feedback.save if params[:feedback]\n end",
"def user_feedback_params\n params.require(:user_feedback).permit(:email, :feedback)\n end",
"def index\n @user_feedbacks = UserFeedback.all\n end",
"def create\n @feedback_item = FeedbackItem.new(params[:feedback_item])\n\n respond_to do |format|\n if @feedback_item.save\n format.html { redirect_to @feedback_item, notice: 'Feedback item was successfully created.' }\n format.json { render json: @feedback_item, status: :created, location: @feedback_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedback_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n if signed_in?\n @feedback.user_id = current_user.id\n end\n respond_to do |format|\n if @feedback.save\n if(UserMailer.feedback_request(@feedback).deliver)\n # flash[:success] = \"Your Request is send for Quote.\"\n else\n flash[:error] = \"Error sending email.\"\n end \n format.html { redirect_to @feedback, notice: \"Thanks, we'll get back to you shortly.\" }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @feedback_items = FeedbackItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedback_items }\n end\n end",
"def feedback_params\n params.require(:feedback).permit(:content) # 获取填写的意见反馈内容。\n end",
"def feedback_params\n params.require(:feedback).permit( :name, :email, :phone_number, :company, :location, :description )\n end",
"def feedback\n\t\t@submission = Submission.find(params[:submissionFeedback][:id])\n\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t# if the assessment exists\n\t\tif @assessment\n\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\tend\n\t\[email protected]_feedback(params[:submissionFeedback][:Feedback], @creator, @assessment)\n\t\tredirect_to '/submissions/'+params[:submissionFeedback][:id]\n\t\tflash[:info] = 'Feedback was successfully sent.'\n\tend",
"def feedback_params\n params.require(:feedback).permit(:user_id, :from_user_id, :from_user_name, :from_user_email, :status_id, :date, :from_user_role, :project)\n end"
] |
[
"0.74067223",
"0.7115278",
"0.71128494",
"0.7037425",
"0.7037425",
"0.70201325",
"0.70042884",
"0.69460565",
"0.69074863",
"0.6882927",
"0.6880752",
"0.68361783",
"0.68150926",
"0.6783977",
"0.67001534",
"0.66902465",
"0.6678681",
"0.6675885",
"0.6674073",
"0.66555536",
"0.6643796",
"0.66232604",
"0.66160715",
"0.65950966",
"0.65828425",
"0.65722656",
"0.65632874",
"0.65484357",
"0.65366393",
"0.6534845",
"0.65114766",
"0.6498749",
"0.64918345",
"0.64902043",
"0.64850444",
"0.6484852",
"0.6483884",
"0.6462957",
"0.6455338",
"0.64401454",
"0.6427584",
"0.6410311",
"0.6380851",
"0.63781685",
"0.6373281",
"0.6357708",
"0.6351551",
"0.634685",
"0.6331811",
"0.63295513",
"0.6320206",
"0.6317398",
"0.6317398",
"0.6317398",
"0.6317398",
"0.6317398",
"0.6317398",
"0.6317398",
"0.6317398",
"0.63097364",
"0.63077444",
"0.6303115",
"0.6299352",
"0.6299352",
"0.6299352",
"0.62925875",
"0.62837255",
"0.6272722",
"0.6271627",
"0.627006",
"0.6266941",
"0.6250065",
"0.6241407",
"0.6197778",
"0.61973286",
"0.6195104",
"0.6193143",
"0.61848134",
"0.61836135",
"0.61774457",
"0.6161983",
"0.6156506",
"0.6150392",
"0.61408913",
"0.6136258",
"0.6134136",
"0.613086",
"0.6130763",
"0.60949814",
"0.6094776",
"0.607147",
"0.60587734",
"0.60484374",
"0.60457706",
"0.601264",
"0.5997289",
"0.59930813",
"0.59915864",
"0.5991387",
"0.59911865"
] |
0.66641
|
19
|
Thank you page Directed to thank you page after creating a feedback
|
def thank_you
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def thankyou\n end",
"def thankyou\n end",
"def send_feedback\n feedback = FeedbackItem.new(:user_id=>current_user.id, :url=>params[:url], :page=>params[\"feedback-form-select\"], :description=>params[:description])\n if @saved = feedback.save\n flash[:success_message] = \"Thank you for your feedback. We will inform you when this issue has been resolved.\"\n else\n flash[:error_message] = \"We're sorry, but we could not complete this request. Please send an email to [email protected] with a description of the problem.\"\n end\n render 'feedback_items/feedback_submit.js.erb'\n end",
"def thanks\n RequestMailer.thanks\n end",
"def thanks\n ContactMailer.thanks\n end",
"def ask\n if @help_request.valid?\n MyousicaMailer.deliver_help_request(@help_request)\n flash[:notice] = \"Thanks for contacting us! Your question has been sent to our help desk, you'll receive a reply in few hours.\"\n else\n flash[:error] = \"Your help request could not be sent. Please correct the errors and try again!\"\n end \n\n params[:return_to] ? redirect_to(:action => 'show', :id => params[:return_to]) : redirect_to(:action => 'index')\n end",
"def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end",
"def feedback\n NotebookMailer.feedback\n end",
"def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end",
"def thank_you\n # debugger\n @order_date = DateTime.now\n @shipping = 20000\n @total = order_subtotal + @shipping\n order = {\n \"total\" => @total,\n \"shipping\" => @shipping,\n \"items\" => session[:purchase]\n }\n # debugger\n OrderMailer.order_confirmation(session[:address], order).deliver_now\n end",
"def thanks\n \t@suggested_article = SuggestedArticle.new(name: 'Emanuel', email: '[email protected]', body: 'Sugestão de artigo')\n SuggestedArticleMailer.thanks(@suggested_article)\n end",
"def feedback\n NewsletterMailer.feedback\n end",
"def thank_email(user, thanker, item, item_type)\n # @user = user\n # @thanker = thanker\n # @item = item\n\n # Text and linkback URL of the email depends on if the thanked item was a post or a comment\n if item_type == \"Post\"\n\n if !item.title.blank?\n str = item.title\n str = str.split[0...3].join(' ')\n else\n str = item.text\n str = str.split[0...3].join(' ')\n end\n\n @str = \"Your post on \\\"\" + str + \"...\\\" was helpful to \" +thanker.first_name+ \". Thanks!\"\n\n # URL to link them back depends on if the item was on a user or a group\n if item.postable_type == \"User\"\n @url = 'http://www.projecthelp.co/users/' + item.postable_id.to_s\n else\n @url = 'http://www.projecthelp.co/groups/' + item.postable_id.to_s\n end\n\n # Text and linkback URL of the email depends on if the thanked item was a post or a comment\n else\n str = item.text.split[0...3].join(' ')\n\n @str = \"Your comment on \\\"\" + str + \"...\\\" was helpful to \" +thanker.first_name+ \". Thanks!\"\n \n # URL to link them back depends on if the item was on a user or a group\n post = Post.find(item.post_id)\n if post.postable_type == \"User\"\n @url = 'http://www.projecthelp.co/users/' + post.postable_id.to_s\n else\n @url = 'http://www.projecthelp.co/groups/' + post.postable_id.to_s\n end\n end\n\n mail :to => user.email,\n :subject => \"Thanks for being helpful!\"\n end",
"def send_feedback\n @message = params[:message]\n @subject = params[:subject]\n if Staff.feedback_email(current_user, @subject, @message).deliver\n redirect_to root_path, notice: t(\"flash.feedback_sent\")\n else\n render action: \"feedback\", alert: t(\"flash.feedback_failed\")\n end\n end",
"def thanks\n end",
"def feedback\n SystemMailer.user_feedback(current_user, params[:type], params[:message]).deliver!\n return_message(200, :ok)\n end",
"def feedback\n end",
"def create_thanks \n end",
"def return\n flash[:success] = \"Thanks for supporting us! We will activate your plan upon payment confirmation! The time this takes depends on PayPal.\"\n redirect_to root_path\n end",
"def user_send_feedback\n\t\t# send feed back to the admin\n\t\tif UserMailer.feedback(current_user,params[:feedback_text]).deliver_now\n\t\t# response to the JSON\n \t render json: { success: true, message: \"Feedback has sent successfully\" },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"problem with sending feedback\" },:status=> 203\n\t end\t\n\tend",
"def feedback(bike)\n @bike = bike\n\n mail to: \"[email protected]\", subject: \"trouducul\"\n end",
"def send_thank_you_mail\n IslayShop::OrderMailer.thank_you(self).deliver\n end",
"def thankyou_email(user)\n @user = user\n @url = `http://Sock-o-Rama.com/`\n mail(to: @user.email, subject: `Thank you for shopping at Sock-o-Rama`)\n # mail - The actual email message, we are passing the :to and :subject headers in\n end",
"def feedback\n\t\t@submission = Submission.find(params[:submissionFeedback][:id])\n\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t# if the assessment exists\n\t\tif @assessment\n\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\tend\n\t\[email protected]_feedback(params[:submissionFeedback][:Feedback], @creator, @assessment)\n\t\tredirect_to '/submissions/'+params[:submissionFeedback][:id]\n\t\tflash[:info] = 'Feedback was successfully sent.'\n\tend",
"def create\n @feedback = Feedback.new(params[:feedback])\n respond_with(@feedback) do\n redirect_to \"/feedbacks/thank_you\" if @feedback.save\n end\n end",
"def notice_post\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def response(enquiry)\n @greeting = \"Hi\"\n @enquiry = enquiry\n mail(to:@enquiry.email, subject:\"Thankyou for your enquiry\")\n end",
"def new_feedback(user)\n @user = user\n mail to: user.email, subject: \"New Feedback is added\"\n end",
"def notify\n render :text => 'Ok, thank you.'\n end",
"def new_feedback\n UserMailer.new_feedback\n end",
"def claim_your_reward\n InviteMailer.claim_your_reward\n end",
"def item_feedback\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Item Feedback <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"Item Feedback [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def feedback(feedback, url)\n @notebook = feedback.notebook\n @url = url.chomp('/')\n @submitter = feedback.user\n @feedback = feedback\n @email_needs_to_be_simplified = need_to_simplify_email?(@notebook, @feedback)\n mail(\n bcc: @notebook.owner_email + [@submitter.email],\n subject: \"You have feedback on a Jupyter notebook\"\n )\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n if @feedback.save\n flash[:success] = \"Feedback was successfully submitted. Thank you. :)\"\n AppMailer.feedback(@feedback).deliver\n redirect_to \"/\"\n else\n flash[:error] = \"Please try again.\"\n redirect_to \"/feedback\"\n end\n end",
"def thanks_email( user_email )\n @greeting = \"Thanks for contacting us!\"\n\n mail to: user_email\n end",
"def send_feedback(email,name,text)\n @email = email\n @name = name\n @text = text\n mail to: \"[email protected]\", :subject => \"Feedback from email: #{email}, name: #{name}\"\n end",
"def confirm\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def contact_us\n if ContactMailer.deliver_contact_us_email(params[:name], params[:email], params[:subject], params[:message])\n flash[:notice] = \"Thank you for your submission\"\n else\n flash[:notice] = \"Oops! You didn't prove that you are a human!\"\n end\n return redirect_to :controller => 'main', :action => 'contact'\n end",
"def feedback\n render 'feedback_items/feedback_form'\n end",
"def user_new_item_confirmation\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\", subject: \"Item Confirmation\"\n end",
"def mail\n flash[:notice] = \"Sorry, that page is not available.\"\n redirect_to alerts_path\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def feedback_email(visitor)\n @name=visitor[:name]\n mail(to: visitor[:email], subject: \"Contato\")\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n @feedback.course = Course.current\n if @feedback.save\n send_email(@feedback)\n redirect_to :root, notice: 'Feedback was successfully created.'\n else\n render action: 'new'\n end\n end",
"def thank_user( from_email, to_email )\n subject = \"Thank you for requesting an invite\"\n mail(\n to: to_email,\n from: from_email,\n subject: subject\n )\n end",
"def send_home_form_email(lead)\n @lead = lead\n mail( :to => @lead.email,\n :subject => \"The answer you seek\" )\n end",
"def cust_success_redeemed(smb, customer, friend, campaign, sent)\n @smb = smb\n @customer = customer\n @friend = friend\n @campaign = campaign\n @sent = sent\n mail(:to => customer.email, :subject => \"Thanks for coming to #{smb.full_name}\", :from => \"#{smb.full_name} <#{smb.email}>\")\n end",
"def submitted(talk)\n @talk = talk\n @greeting = \"your talk has been subitted\"\n\n mail to: \"[email protected]\", subject: @greeting\n end",
"def new_pledge\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def received_feedback(feedback)\n @feedback = feedback\n\n mail :to => \"[email protected]\", :reply_to => feedback.email_address || (feedback.user ? feedback.user.email : nil)\n end",
"def response_sent_advisee(user, message)\n @user = user\n @message = message\n mail to: @user.email, subject: \"New response message from Advisor\"\n end",
"def partner_help_notice(partner_help_id)\n ActsAsTenant.current_tenant = nil\n @partner_help = PartnerHelp.find(partner_help_id)\n mail(subject: 'YesTrak Partner Help Form', to: @partner_help.email, bcc: \"#{APP_CONFIG['admin_emails']}\")\n end",
"def new_feedback(feedback, community)\n subject = t(\"feedback.feedback_subject\", service_name: community.name(I18n.locale))\n\n premailer_mail(\n :to => mail_feedback_to(community, APP_CONFIG.feedback_mailer_recipients),\n :from => community_specific_sender(community),\n :subject => subject,\n :reply_to => feedback.email) do |format|\n format.html {\n render locals: {\n author_name_and_email: feedback_author_name_and_email(feedback.author, feedback.email, community),\n community_name: community.name(I18n.locale),\n content: feedback.content\n }\n }\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n if signed_in?\n @feedback.user_id = current_user.id\n end\n respond_to do |format|\n if @feedback.save\n if(UserMailer.feedback_request(@feedback).deliver)\n # flash[:success] = \"Your Request is send for Quote.\"\n else\n flash[:error] = \"Error sending email.\"\n end \n format.html { redirect_to @feedback, notice: \"Thanks, we'll get back to you shortly.\" }\n format.json { render action: 'show', status: :created, location: @feedback }\n else\n format.html { render action: 'new' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_order_notice(enquiry)\n @enquiry = enquiry\n @customer = @enquiry.customer\n mail(subject: \"[team] New Order #{@enquiry.id}\")\n end",
"def withdraw_note(addresses, publication_title) \n #send note to publication creator that the pub has been withdrawn\n #they can checkout the comments to see if there is more info about the withdraw\n \n @publication_title= publication_title \n\n mail(:to => addresses, :subject => publication_title + \" has been withdrawn.\")\n \n end",
"def record_submit(content)\n @greeting = content\n\n mail to: \"[email protected]\", :subject => 'New Submit Arrived'\n end",
"def profile_completion_thankyou(user_id)\n @user = User.find(user_id)\n\n mail :to => recipient(@user.email), :subject => \"25c Profile Completed!\"\n end",
"def post_processing\n if params['redirect_status'] == 'succeeded'\n flash[:success] =\n 'Payment submitted. Thank you! Please wait a moment and refresh to see your dues updated.'\n else\n flash[:error] =\n 'Payment could not be submitted. Please contact a director for further help.'\n end\n redirect_to(root_url)\n end",
"def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end",
"def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def contact\n # These error messages are injected into the contact form alert via JS.\n if !current_user && !check_captcha # the captcha is not used if there is a logged-in user\n render plain: \"Incorrect math question response.\", status: :bad_request\n return\n elsif params[:comment]&.blank? # name and email are optional, but comment is required\n render plain: \"Please enter a comment.\", status: :bad_request\n return\n end\n feedback_email = current_institution&.feedback_email ||\n Setting.string(Setting::Key::FEEDBACK_EMAIL)\n begin\n IdealsMailer.contact(page_url: params[:page_url],\n from_name: params[:name],\n from_email: params[:email],\n comment: params[:comment],\n to_email: feedback_email).deliver_now\n rescue => e\n LOGGER.error(\"#{e}\")\n render plain: \"An error occurred on the server. If this error \" +\n \"persists, please email us at: \" + feedback_email,\n status: :internal_server_error\n else\n render plain: \"OK\"\n end\n end",
"def new_contact_reply(contact_us_id)\n @contact_us = ContactUs.find contact_us_id\n mail({\n to: @contact_us.email,\n subject: \"Thank you for contacting us\"\n })\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 random_thank_you\n [\n \"Thanks for sharing. I'll post your secret anonymously soon. \" +\n \"You might want to unfollow me - I'll unfollow you, too.\",\n \"I'll post your message soon. For secrecy, you might want to unfollow me.\",\n \"Thank you! I'll post your secret soon.\"\n ].sample\n end",
"def new_message_sent_advisee(user)\n @user = user\n mail to: @user.email, subject: \"New message sent to Advisor\"\n end",
"def response(email)\n @greeting = \"Hi\"\n\n mail(to:email, subject:\"You received a payment\")\n end",
"def recap_loan_confirm\n to = params['emailAddress']\n from = '[email protected]'\n confirm_bcc = APP_CONFIG[:recap_loan][:confirm_bcc]\n recap_subject = 'Offsite Pick-Up Confirmation'\n recap_subject += \" [#{params['titleIdentifier']}]\" if params['titleIdentifier']\n recap_subject += \" (#{Rails.env})\" if Rails.env != 'valet_prod'\n subject = recap_subject\n # Make params available within template by using an instance variable\n @params = params\n mail_params = {to: to, from: from, subject: subject}\n mail_params[:bcc] = confirm_bcc if confirm_bcc\n mail(mail_params)\n end",
"def inquiry_created_email(inquiry)\n @inquiry = inquiry\n mail(to: '[email protected]',\n subject: 'New Message from your Website',\n reply_to: @inquiry.email) do |format|\n format.html { render layout: 'email' }\n end\n end",
"def confirmation\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n if @feedback.save\n if admin? && @feedback.parent\n Mailer.reply_feedback(@feedback).deliver\n redirect_to(@feedback, :notice => 'Successfully sent!')\n else\n Mailer.send_feedback(@feedback).deliver\n redirect_to(contact_us_path, :notice => 'Successfully sent to support!')\n end\n else\n render :action => \"new\"\n end\n end",
"def thank_you\n user = session[:user]\n user.zip = params[:zip]\n \n start_date = Date.today\n start_date += 61\n \n response = create_autorrecuring_subscription(start_date, user, params[:card_number], params[:month], params[:year], \n params[:cvc], params[:card_type], params[:city], params[:state],\n params[:billing_address_1], params[:billing_address_2])\n if response.success?\n session[:errors] = nil\n session[:user] = nil\n user.arb_subscription_id = response.subscription_id\n user.arb_status = AuthorizeNet::ARB::Subscription::Status::ACTIVE\n user.billing_information_id = user.add_billing_information(params[:fullname], params[:billing_address_1] ,\n params[:billing_address_2], params[:city], params[:state],\n params[:zip]).id\n user.save\n else\n puts \"Failed to make purchase. \" + response.response_reason_code + \" - \" + response.response_reason_text\n user.errors.clear()\n user.errors.add(:transaction, response.response_reason_text)\n session[:errors] = user.errors\n redirect_to admin_signup_step3_path\n end \n\n \n end",
"def success\n authorize! :view_sofort_thankyou_page, @order\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/show' if @order.confirmed?\n transaction = ::Sofort::FinishTransaction.new(@order)\n transaction.run do\n @order.status = :paid\n @order.confirm\n return render 'signup/orders/show'\n end\n # customer opens success-page, but transaction is not complete\n flash.now[:notice] = t(:transaction_no_confirmation)\n render 'signup/orders/show'\n end",
"def payment_upcoming\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def splash_page_confirmation(useremail)\n @useremail = useremail\n @greeting = \"Hi\"\n\n mail(:to => useremail, :bcc => [\"[email protected], [email protected]\"], :subject => \"SpectaFresh - New Splash Page User\")\n end",
"def notice(cust)\n @greeting = \"Hi\"\n @name = cust.custname\n\n mail(:subject => \"新着メール\", :to => cust.email)\n end",
"def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n 恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n 展览时间:
2015-06-25 至 2015-06-28 <br/>\n 展览地点:
深圳会展中心(1、9号馆)
<br/>\n 如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点:
深圳会展中心(1、9号馆)
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end",
"def thankyou\n\t@user_detail = UserDetail.find(params[:id])\nend",
"def create\n @feedback = Feedback.new(params[:feedback])\n\n if @feedback.save && @feedback.deliver\n redirect_to feedback_path(@feedback), :notice => \"Cool, I'll check it out and email you back.\"\n else\n raise\n end\n\n rescue\n error_msg = \" \"\n @feedback.errors.each do |field, msg|\n error_msg << \"<br/>\"\n error_msg << msg\n end\n redirect_to :back, :notice => \"Blarf. Something messed up while sending. Try again? #{error_msg}\" and return\n end",
"def registration_confirmation(customer)\n @customer = customer\n @url = 'www.shizencyokuhan.com'\n @greeting = \"おめでとうございます! あなたのアカウントが登録されました!\"\n mail(to: @customer.email, bcc:'[email protected]', subject: 'アカウント登録完了のお知らせ' )\n \n end",
"def user_feedback(user, type, message)\n @user = user\n @type = type\n @message = message\n\n mail(:subject => \"User Feedback (#{type})\")\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def sent_volunteer_inquiry(contact)\n @contact = contact\n mail(:to => @contact.email, :subject => \"Your volunteer inquiry has been sent to Feya Candle\")\n end",
"def contact_us\n #\n if request.get?\n @page_title = \"Contact Us\"\n @page = Page.find_by_title(@page_title)\n end\n\t \n if request.post?\n # TODO\n pass = true\n error = \"Please check the name, email and note fields are not empty.\"\n\t \n name = params[:contact][:name] \n email = params[:contact][:email]\n phone = params[:contact][:phone]\n note = params[:contact][:note]\n\t \n pass = false if name.blank?\n pass = false if email.blank?\n pass = false if note.blank?\n\t \n\t \n #email = OrderMailer.create_sent(params[:contact][:name],params[:contact][:email],params[:contact][:phone],params[:contact][:note])\n #email.set_content_type(\"text/html\")\n \n if pass\n OrderMailer.deliver_formmessage(name,email,phone,note)\n flash[:notice] = \"Thank you! Your message has been sent, we will contact you shortly.\"\n redirect_to :action=>'contact_us', :controller=>'go'\n else\n flash[:notice] = error\n redirect_to :action=>'contact_us', :controller=>'go'\n end \n end \n render(:file => \"#{RAILS_ROOT}/app/views/templates/#{Shop.def_template_name}/frontend/#{action_name}.html.erb\", \n :layout => true)\n end",
"def booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify\n ActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :cc => \"[email protected]\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def succesfull_submission(offer)\n @greeting = \"Χαίρετε\"\n @user = User.find(offer.user_id)\n @offer = offer\n @procurement = Procurement.find(offer.procurement_id)\n\n mail to: @user.email, subject: '[E-Proc] Tender Submitted Succesfully'\n end",
"def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end",
"def signup_received(customer)\n @customer = customer\n\n mail :to => customer.email, :subject => \"Thank you\"\n end",
"def volunteer_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"[email protected]\", :subject => \"Volunteer inquiry\")\n end",
"def send_feedback_to_slack\n send_request_to_slack(make_positive_response)\n end",
"def contact_confirmation(contact)\n @contact = contact\n\n mail to: \"[email protected]\", subject: \"New Contact Submission\"\n end",
"def welcome_email(payment)\n @payment = payment\n @url = generate_url(User.find_by_email(@payment.email))\n loaner_email = User.find(@payment.user_id).email\n\n mail(:to => @payment.email, :subject => \"Yo, you owe some money!\", :cc => loaner_email)\n end",
"def thanks(email, name)\n @name = name\n @email = email\n mail to: email, subject: \"Uva Guayacanes\"\n end",
"def continue_bot_questions\n flash[:notice] = \"This feature has been disabled. Please contact to administrator\"\n return redirect_to home_path\n end",
"def new_feedback(name, email, hear, can_publish, held, message)\n\t\t@name = name\n\t\t@email = email\n\t\t@message = message\n\t\t@hear = hear\n\t\t@can_publish = can_publish\n\t\t@held = held\n\t\t# Mail it to/from/subject\n\t\tmail(to: '[email protected]', from: @email, subject: 'Message from ' + @name)\n\tend"
] |
[
"0.75734913",
"0.75734913",
"0.7233791",
"0.7076913",
"0.69815683",
"0.68772644",
"0.6871658",
"0.6826509",
"0.6819372",
"0.6752845",
"0.6726881",
"0.67083573",
"0.66840214",
"0.66618514",
"0.6641294",
"0.6628791",
"0.6554005",
"0.655179",
"0.65516657",
"0.6535636",
"0.6512729",
"0.65098834",
"0.6472471",
"0.6435958",
"0.64177704",
"0.640908",
"0.6391309",
"0.63656443",
"0.6355779",
"0.63058096",
"0.62539047",
"0.624028",
"0.6208086",
"0.620277",
"0.62005496",
"0.6190819",
"0.61866486",
"0.6180125",
"0.61691314",
"0.6163427",
"0.6158505",
"0.6137801",
"0.6135312",
"0.61302793",
"0.6130254",
"0.61251867",
"0.6110312",
"0.61056644",
"0.60987103",
"0.6094842",
"0.6092038",
"0.6082881",
"0.60828596",
"0.607953",
"0.6077564",
"0.6058507",
"0.60495126",
"0.6041529",
"0.60405",
"0.60318905",
"0.603155",
"0.6029378",
"0.6021988",
"0.60181373",
"0.6016776",
"0.6004329",
"0.5991127",
"0.5991041",
"0.59825444",
"0.59653056",
"0.5965093",
"0.5961247",
"0.59612286",
"0.5955616",
"0.594222",
"0.5939414",
"0.5936708",
"0.5935042",
"0.5933103",
"0.5932427",
"0.5930281",
"0.59284353",
"0.59201354",
"0.5906371",
"0.59042096",
"0.5899084",
"0.58943784",
"0.58943397",
"0.58918166",
"0.5884896",
"0.5877958",
"0.58751124",
"0.5866656",
"0.5855079",
"0.585398",
"0.58538353",
"0.58523643",
"0.58514804"
] |
0.75838184
|
2
|
DELETE /feedbacks/1 DELETE /feedbacks/1.json Admin only destroy feedback
|
def destroy
@feedback = Feedback.find(params[:id])
@feedback.destroy
redirect_to feedbacks_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n # only admins can delete feedback\n redirect_to(root_path) unless current_user.admin\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @feedback\n @feedback.idea.feedbackers.delete(@feedback.user.id.to_s)\n @feedback.idea.save!\n\n DestroyRecordJob.perform_later(@feedback)\n render json: { message: 'Feedback deleted', deleted: true }\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_feedbacks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to '/admin/feedback' }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to user_services_url, notice: 'Feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to contest_entry_url(@contest, @entry) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_request.destroy\n respond_to do |format|\n format.html { redirect_to feedback_requests_url, notice: 'Feedback request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to(feedbacks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to(feedbacks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n respond_with(@feedback)\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n respond_with(@feedback)\n end",
"def destroy\n @user_feedback.destroy\n respond_to do |format|\n format.html { redirect_to user_feedbacks_url, notice: 'User feedback was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n\r\n if params[:id].is_a?(Array)\r\n @success = DevFeedback.destroy(params[:id])\r\n else\r\n @dev_feedback = DevFeedback.find_by_id(params[:id])\r\n @dev_feedback.destroy unless @dev_feedback.nil?\r\n @success = @dev_feedback && @dev_feedback.destroyed?\r\n end\r\n if @success\r\n flash[:notice] = _(\"%{model} %{name} successfully deleted.\") % {:model => _(\"Dev Feedback\"), :name => @dev_feedback.disp_name}\r\n else\r\n flash[:warning] = _(\"%{model} %{name} could not be deleted.\") % {:model => _(\"Dev Feedback\"), :name => params[:name]}\r\n end\r\n if params[:format] != \"json\"\r\n if request.xhr?\r\n render :action => 'ajax_update', :layout => false\r\n else\r\n if params[:go_to].blank?\r\n redirect_to :action => :index\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end\r\n else\r\n resp = {}\r\n if @success\r\n resp[:success] = true\r\n else\r\n resp[:success] = false\r\n resp[:error] = flash[:warning]\r\n end\r\n render :json => resp.to_json, :layout => false\r\n end\r\n end",
"def destroy\n @feedback_user.destroy\n respond_to do |format|\n format.html { redirect_to feedback_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_feedback = CustomerFeedback.find(params[:id])\n @customer_feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_feedback = CustomerFeedback.find(params[:id])\n @customer_feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n \n respond_to do |format|\n format.html { redirect_to line_item_url(@line_item) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feedback_reply.destroy\n# respond_to do |format|\n# format.html { redirect_to feedback_replies_url }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @purchase_feedback = PurchaseFeedback.find(params[:id])\n @purchase_feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_form = FeedbackForm.find(params[:id])\n @feedback_form.destroy\n\n respond_to do |format|\n format.html { redirect_to feedback_forms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resume_feedback = ResumeFeedback.find(params[:id])\n @resume_feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to resume_feedbacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_item = FeedbackItem.find(params[:id])\n @feedback_item.destroy\n\n respond_to do |format|\n format.html { redirect_to feedback_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n authorize @feedback\n @volunteer = Volunteer.find_by_user_id_and_document_id( @feedback.user_id, @feedback.document_id )\n @volunteer.update_attributes( :invited => false ) if @volunteer\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_form.destroy\n respond_to do |format|\n format.html { redirect_to feedback_forms_url, notice: 'Feedback form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audit_feedback_category.destroy\n respond_to do |format|\n format.html { redirect_to audit_feedback_categories_url, notice: 'Audit feedback category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_short = FeedbackShort.find(params[:id])\n @feedback_short.destroy\n\n respond_to do |format|\n format.html { redirect_to feedback_shorts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.key= params[:key]\n @feedback.destroy\n flash[:notice] = 'The Feedback was successfully deleted!'\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t#@post=Post.find(params[:post_id])\n\t\t#@[email protected](params[:id])\n\t\t#@feedback.destroy\n\t\t#redirect_to post_path(@post)\n\t\[email protected]\n\t\tredirect_to feedbacks_path\n\tend",
"def destroy\n\n pitch = Feedback.find_by(id: params[:id]).pitch.id\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to \"/pitches/#{pitch}\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @peer_review_feedback = PeerReviewFeedback.find(params[:id])\n @peer_review_feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to(peer_review_feedbacks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_feedback_note.destroy\n respond_to do |format|\n format.html { redirect_to user_feedback_notes_url, notice: 'User feedback note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_item = FeedbackItem.find(params[:id])\n @feedback_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(feedback_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feedback_mail = FeedbackMail.find(params[:id])\n @feedback_mail.destroy\n\n respond_to do |format|\n format.html { redirect_to(feedback_mails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_faq.destroy\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @topic_answer.destroy\n respond_to do |format|\n format.html { redirect_to topics_url, notice: 'Topic answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frequently_asked.destroy\n respond_to do |format|\n format.html { redirect_to frequently_askeds_url, notice: 'Frequently asked was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ask.destroy\n respond_to do |format|\n format.html { redirect_to asks_path }\n format.json { head :no_ask }\n end\n end",
"def destroy\n @ask.destroy\n respond_to do |format|\n format.html { redirect_to asks_url, notice: 'Ask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_page = FeedbackPage.find(params[:id])\n @feedback_page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n feedback_file = record\n\n if feedback_file.destroy\n # Successfully deleted the Feedback file; render success\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok\n else\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: :internal_server_error\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission or feedback file\n render 'shared/http_status', locals: { code: '404', message:\n e }, status: :not_found\n end",
"def destroy\n authorize! :destroy, @admin_question\n\n @admin_question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chef_att_deb.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_debs_url, notice: 'Chef att deb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n Partextra.where(participant_id: @participant.id).destroy_all\n Badge.where(participant_id: @participant.id).destroy_all\n end",
"def destroy\n @discuss.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 @faq = Helpdesk::Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recommended.destroy\n respond_to do |format|\n format.html { redirect_to recommendeds_url, notice: 'Recommended was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end",
"def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attempt_question.destroy\n respond_to do |format|\n format.html { redirect_to attempt_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expert.destroy\n respond_to do |format|\n format.html { redirect_to experts_url, notice: 'Expert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expert.destroy\n respond_to do |format|\n format.html { redirect_to experts_url, notice: 'Expert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq = Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admins_message.destroy\n respond_to do |format|\n format.html { redirect_to admins_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asked_to_answer.destroy\n respond_to do |format|\n format.html { redirect_to asked_to_answers_url, notice: 'Asked to answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discipline.topics.delete_all\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @featured_topic.destroy\n head :ok\n end",
"def destroy\n @mdl_forum_discussion.destroy\n respond_to do |format|\n format.html { redirect_to mdl_forum_discussions_url, notice: 'Mdl forum discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disclaimer_quiz_default.destroy\n respond_to do |format|\n format.html { redirect_to disclaimer_quiz_defaults_url, notice: 'Disclaimer quiz default was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subtopics_question.destroy\n respond_to do |format|\n format.html { redirect_to subtopics_questions_url, notice: 'Subtopics question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n unless current_user.try(:admin?)\n flash[:alert] = \"Account unable to access requested loction.\"\n redirect_to help_path\n end\n @assist_message.destroy\n respond_to do |format|\n format.html { redirect_to assist_messages_url, notice: 'Assist message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq_category.destroy\n respond_to do |format|\n format.html { redirect_to(admin_faqs_path, notice: \"The category was deleted.\") }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted FAQ Category: #{@faq_category.name}\")\n end",
"def destroy\n answer = Answer.find params[:id]\n \n if can? :delete, answer\n answer.destroy\n render json: { status: 200 }, status: 200\n else\n render json: { status: 403 }, status: 403\n end\n end",
"def destroy\n @seab_topic.destroy\n respond_to do |format|\n format.html { redirect_to seab_topics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forum_topic.destroy\n respond_to do |format|\n format.html { redirect_to forum_topics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно удалена' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating_reason.destroy\n respond_to do |format|\n format.html { redirect_to rating_reasons_url, notice: 'Rating reason was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @topic.destroy\n render json: {success: true}\n else\n render json: @topic.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @attention.destroy\n respond_to do |format|\n format.html { redirect_to attentions_url, notice: 'Attention was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attention.destroy\n respond_to do |format|\n format.html { redirect_to attentions_url, notice: 'Attention was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.active = [email protected]\n\n questions_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, questions_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully deleted\"\n redirect_to questions_path\n end",
"def destroy\n @answer = Admin::Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question_category = QuestionCategory.find(params[:id])\n @question_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_question_categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @questionstatu.destroy\n respond_to do |format|\n format.html { redirect_to questionstatus_index_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n admin = Admin.find_by(id: cookies[:admin_id])\n @reply.destroy_with_access admin\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_question.destroy\n respond_to do |format|\n format.html { redirect_to template_questions_url, notice: 'Template question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @topic = Topic.find(params[:id])\n @topic.destroy\n\n respond_to do |format|\n format.html { redirect_to pool_topics_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @topic = Topic.find(params[:id])\n @topic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_topics_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to @reply.post.course.forum_path, notice: (t 'replies.flash.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faqcat.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Faqcat was successfully destroyed.' }\n #format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.852357",
"0.8267735",
"0.8261452",
"0.8261452",
"0.8261452",
"0.8261452",
"0.8261452",
"0.82124066",
"0.819386",
"0.8177167",
"0.8177167",
"0.8177167",
"0.8158311",
"0.8100385",
"0.8100385",
"0.8100385",
"0.8100385",
"0.8100385",
"0.8100385",
"0.7958626",
"0.7944245",
"0.7905799",
"0.7902467",
"0.7902335",
"0.7847982",
"0.7847982",
"0.78104746",
"0.7794062",
"0.7746895",
"0.77332777",
"0.77332777",
"0.76560646",
"0.7537463",
"0.74730015",
"0.74722093",
"0.7450613",
"0.7446843",
"0.74360305",
"0.7422428",
"0.74018145",
"0.739984",
"0.7362328",
"0.73161554",
"0.72526276",
"0.7247488",
"0.72285366",
"0.7180188",
"0.7019527",
"0.69902736",
"0.6919444",
"0.686024",
"0.6854012",
"0.68200046",
"0.68065757",
"0.6763466",
"0.6750718",
"0.67451686",
"0.67379856",
"0.6721103",
"0.6716087",
"0.67100424",
"0.6708708",
"0.66888076",
"0.6675839",
"0.66754335",
"0.6641735",
"0.6639259",
"0.6638631",
"0.6638631",
"0.6635441",
"0.66353977",
"0.6623303",
"0.6623202",
"0.6617073",
"0.6613688",
"0.6612869",
"0.6609299",
"0.66069144",
"0.6601746",
"0.65937597",
"0.65902203",
"0.65842384",
"0.6577577",
"0.6577003",
"0.657533",
"0.65661263",
"0.65661263",
"0.6565924",
"0.656584",
"0.65635675",
"0.65605044",
"0.6556652",
"0.65539265",
"0.65467674",
"0.6539886",
"0.6538645",
"0.6537309",
"0.65319335",
"0.65308166",
"0.65282404"
] |
0.8009949
|
19
|
method called by admin on feedback index page to change whether the feedback is shown on the home page Admin only
|
def changeShow
@feedback = Feedback.find(params[:id])
@feedback.show = [email protected]
@feedback.save
redirect_to feedbacks_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def admin?() false end",
"def admin?; false end",
"def show\n is_admin?\n end",
"def show\n is_admin?\n end",
"def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end",
"def determine_active_admin_layout\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ACTIVE_ADMIN_ACTIONS.include?(params[:action].to_sym) ? false : 'active_admin'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n end",
"def is_admin?\n if !is_admin\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end",
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def index?\n is_user_activity_admin_or_admin?\n end",
"def admin_only\n false\n end",
"def admin?\n !current_user.AdminScreen?\n end",
"def show\n isadmin\n end",
"def make_admin\n flash[:success] = \"This feature is currently Disabled\"\n redirect_to users_url\n end",
"def tip?\n admin.nobody?\n end",
"def help\r\n\r\n @user_actions = Access.where(:table_sid => \"dev_feedbacks\", :action_sid => [\"index\", \"list\", \"new\", \"create\", \"show\", \"edit\", \"update\", \"destroy\", \"search\", \"download\", \"feed\", \"help\", \"adv_search\"]).includes([:user_accesses, :profile_accesses]).reject{|a| @current_user.can_run?(a) }\r\n render(:layout => !request.xhr?)\r\n end",
"def admin_only\n unless current_user.admin\n redirect_to home_path, notice: \n \"You must be an admin to perform that function!\"\n end\n end",
"def admin_access?\n admin?\n end",
"def admin?\n false\n end",
"def admin_stat\n admin? ? 'on' : 'off'\n end",
"def admin?\n current_layout == 'admin' || (params[:controller] == 'static' && params[:action] == 'admin_home')\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def index?\n not admin.nobody?\n end",
"def new\n @feedback = Feedback.new\n if current_user.admin?\n flash[:success] = \"Here is your feedback\"\n @feedbacks = Feedback.all\n render 'feedbacks/show_feedback'\n else\n render 'static_pages/feedback'\n end\n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end",
"def admin_access\n if current_user.access? :admin\n return true\n elsif current_user\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to nationalities_path\n else\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to login_path\n end\n end",
"def admin_only\n\t\t\tif logged_in?\n\t\t\t\tif User.find_by(id: current_user.id.to_i).admin != true\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu musisz być adminem\"\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def is_admin\n unless admin?\n flash[:danger]= t 'h.sessions.requireadmin'\n redirect_to(root_url)\n end\n end",
"def index?\n # @current_user.admin?\n end",
"def admin_logic\n end",
"def show\n if !session[:is_admin]\n redirect_to root_url\n end\n end",
"def appHelper_ifAdmin\n if session[:user_admin]\n return true\n end\n return false\n end",
"def show\n\t\trequire_admin!\n\tend",
"def admin_index\n return unless (user_is_allowed_to 'view', 'rets_properties') \n render :layout => 'caboose/admin' \n end",
"def comments_admin?\n admin?\n end",
"def super_check\n if self.user_name == 'profbill'\n self.admin = true\n self.suspended = false\n self.icon = \"hand-peace-o\"\n end\n end",
"def is_admin\n\t\tself.admin == true\n\tend",
"def show?\n @current_user.admin?\n end",
"def admin?\n\t self.profile == \"admin\"\n\tend",
"def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def is_admin\n if !is_admin?\n flash[:danger] = \"Unauthorized. You are not an admin\"\n redirect_to home_path\n end\n end",
"def admin_mode?\n\t\tsession[:admin_session] == \"true\"\n\tend",
"def hide_admin\n admin? ? '' : 'hide'\n end",
"def show\n redirect_to :admin_emails_templates , notice: 'Emails Template was not updated. Please try again'\n end",
"def show\n current_email = current_user.email\n if !current_user.admin? && current_email.gsub(\".\",\"-dot-\") != params[:id]\n flash.keep[:notice] = 'You must be an administrator to access that feature.'\n redirect_to '/'\n end\n super\n end",
"def is_admin?\n unless (current_user && current_user.admin)\n flash[:notice] = \"You must be admin in to access this section\"\n redirect_to tasks_url\n end\n end",
"def index\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n if @current_user.is_admin\n @feedbacks = Feedback.all\n else\n @feedbacks = Feedback.where('email=?', @current_user.email)\n end\n else\n flash[:notice] = \"Please login to view your feedback.\"\n redirect_to login_path\n end\n \n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to messages_url\n end\n end",
"def is_admin_access\n if session[:is_admin] == \"true\"\n return true\n else\n if current_user.present?\n admin_status = User::ADMIN_ACCESS.include?(current_user.email)\n if admin_status\n session[:is_admin] = \"true\"\n return true\n else\n flash[:notice] = \"You don't have admin access. You cannot access this page.\"\n redirect_to root_path\n end\n else\n flash[:notice] = \"You don't have admin access. You cannot access this page.\"\n redirect_to root_path\n end\n end\n end",
"def is_admin?\n redirect_to home_index_path, alert: '请以管理员身份登陆后进行操作!' unless user_signed_in?&¤t_user.admin?\n end",
"def is_admin?\n redirect_to home_index_path, alert: '请以管理员身份登陆后进行操作!' unless user_signed_in?&¤t_user.admin?\n end",
"def index?\n @current_user.admin?\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def admin?\n admin\n end",
"def set_defaults\n self.is_admin == false\n end",
"def admin_user\n redirect_to(news_index_path) unless is_admin?\n end",
"def admin_message\n redirect_to root_path unless admin_user?\n end",
"def frontend?\n self.display_on != \"back_end\"\n end",
"def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end",
"def admin\n object.site_admin?\n end",
"def feedback\n end",
"def show\n checkadmin\n end",
"def checkAdmin\n if !admin_signed_in?\n # if current user is not an admin then can't access the page like add teacher,department,college and new subject\n redirect_to root_path, notice: \"Only Admin Can Access This Page\"\n end\n end",
"def admin?\n\t\t\t\tsession[:admin] == true\n\t\t\tend",
"def admin_required\n if current_user && admin?\n session[:redirect_to] = request.fullpath\n return true\n end\n\n flash[:info] = 'Admin rights required to view the settings page.'\n redirect_last\n end",
"def update_super_admin\n unless current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n @admin=current_admin\n @admin_=current_admin\n end",
"def show\n\t\t\tputs current_user.is_admin?\n\tend",
"def is_admin?\n self.is_admin == \"true\"\n end",
"def admin_use\n redirect_to(root_url) unless current_use.admin?\n end",
"def admin\n self.is_admin_for?\n end",
"def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end",
"def is_admin_request?\n !(@_admin_menus.nil?)\n end",
"def isAdmin\n \n end",
"def check_admin\n if !current_user.admin?\n flash[:error] = \"You dont have access to this Page!!!!!\"\n redirect_to root_path\n end\n end",
"def admin_user?\n self.admin ==true\n end",
"def isAdmin?\n redirect_to new_session_path, flash: {:error => \"Warning! Only Admin privileges\"} unless logged_in? \n !!@current_user.admin\n end",
"def any_action?\n admin?\n end",
"def feedback\n @feedback ||= APND::Settings::Feedback.new\n end",
"def admin?\n\t\t\tsession[:admin]\n\t\tend",
"def set_admin\n \t@is_admin = session[:is_admin]\n end",
"def admin_user?\n \treturn self.user_category == \"admin\"\n end",
"def verify_super_admin\n redirect_to admin_path unless current_user.user_level == \"super_admin_access\"\n\n end",
"def admin?\n return self.admin == true\n end",
"def check_admin\n redirect_to new_admin_session_path unless is_admin?\n end",
"def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end",
"def is_admin?\n redirect_to regulate_admin_regulate_pages_path if !@is_admin\n end",
"def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\n end\n end",
"def check_is_admin\n unless is_admin?\n bounce_chumps \"You're not an admin.\"\n end\n end",
"def index\n if current_user.userable_type.to_str == \"Admin\"\n @feedbacks = Feedback.all\n elsif current_user.userable_type.to_str == \"Student\"\n @feedbacks = Feedback.where(student_id: current_user.userable.id)\n else current_user.userable_type.to_str == \"Teacher\"\n @feedbacks = Feedback.where(teacher_id: current_user.userable.id)\n end\n end",
"def admin?\n\t\tuser_session.admin?\n\tend",
"def moderation_state_visible_to_all?\n if Thredded.content_visible_while_pending_moderation\n !blocked?\n else\n approved?\n end\n end",
"def admin?\n self.admin\n end",
"def frontend?\n self.display_on != \"back_end\" && !none?\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_required\n current_user.is_admin? || access_denied\n end"
] |
[
"0.647743",
"0.64446986",
"0.64273584",
"0.64202046",
"0.6408131",
"0.63850063",
"0.6369391",
"0.63389",
"0.6331391",
"0.63211125",
"0.62790716",
"0.6274252",
"0.62531286",
"0.62461543",
"0.623278",
"0.6230182",
"0.6221224",
"0.6220922",
"0.6186508",
"0.61774427",
"0.6167678",
"0.6167678",
"0.6167678",
"0.6151581",
"0.61422795",
"0.61319464",
"0.61290103",
"0.6128263",
"0.61234283",
"0.6120691",
"0.6118788",
"0.6118663",
"0.61172324",
"0.61052054",
"0.6103116",
"0.610066",
"0.6092353",
"0.608361",
"0.60814095",
"0.60776323",
"0.60773504",
"0.60734594",
"0.60561347",
"0.60530174",
"0.604365",
"0.6042892",
"0.6032684",
"0.60279393",
"0.60211766",
"0.6015891",
"0.6013947",
"0.60133404",
"0.60110664",
"0.60108715",
"0.6010311",
"0.6010311",
"0.6007756",
"0.5999321",
"0.5999244",
"0.599671",
"0.59962267",
"0.5993006",
"0.5981901",
"0.5977845",
"0.5977679",
"0.5977379",
"0.59763986",
"0.59698445",
"0.59577984",
"0.5945328",
"0.5942885",
"0.5940552",
"0.59395355",
"0.59353685",
"0.5932102",
"0.5914196",
"0.59128803",
"0.5911382",
"0.5904149",
"0.5901447",
"0.59005183",
"0.58975625",
"0.5896046",
"0.5895707",
"0.58903795",
"0.5888826",
"0.58876425",
"0.58831763",
"0.5882701",
"0.5880776",
"0.58766603",
"0.5869258",
"0.586333",
"0.5863211",
"0.58618724",
"0.58589077",
"0.585815",
"0.58581257",
"0.585603",
"0.585127"
] |
0.6036619
|
46
|
check_for_admin called by before_filter
|
def check_for_admin
unless user_signed_in? && current_user.admin?
redirect_to root_path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_if_should_be_admin\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def check_if_admin\n unless current_user.admin\n redirect_to \"/login\"\n end\n end",
"def verify_admin\n admin_is_logged_in? || not_found\n end",
"def check_if_admin\n unless current_user.is_admin?\n render json: {\"errors\" => [\"Inaccessible Resource\"]},\n status: :unauthorized\n return\n end\n end",
"def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end",
"def check_if_admin\n redirect_to(root_path) unless @current_user.is_admin?\n end",
"def check_is_admin\n unless is_admin?\n bounce_chumps \"You're not an admin.\"\n end\n end",
"def check_admin\n redirect_to new_admin_session_path unless is_admin?\n end",
"def check_admin\n redirect_to :root unless current_user.admin?\n end",
"def check_admin\n if not ensure_admin\n redirect_to root_url, alert: \"you are not authorized\"\n end # end if\n end",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end",
"def is_admin\n render status: :unauthorized unless current_user.admin\n end",
"def check_Admin\n\t\tif current_user.role != \"admin\"\n\t\t\tredirect_to('/')\n\t\tend\n\tend",
"def verify_admin\n render_401 unless current_user.is_admin?\n end",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin')\n end",
"def check_if_admin\n if !current_user.admin?\n flash[:alert] = 'Sorry, only admins allowed!'\n redirect_to root_path\n end\n end",
"def is_in_admin_view\n !request.path.match(\"/admin\").nil?\n end",
"def is_in_admin_view\n !request.path.match(\"/admin\").nil?\n end",
"def check_admin\n # using the function above by grabbing the id\n @current_user = find_current_user\n # cross checking to see if user is also an admin\n unless @current_user.present? and @current_user.is_admin?\n #they're find so no additional code needed\n #if they're not admin\n redirect_to root_path\n end\n end",
"def check_admin\n @user = find_current_user\n\n unless @user.present? and @user.is_admin?\n redirect_to root_path\n end\n end",
"def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\n end\n end",
"def check_if_admin\n redirect_to root_path unless @current_user.present? && @current_user.admin?\n end",
"def check_admin\n return redirect_to user_dashboard_path unless current_user.is_admin?\n end",
"def require_admin\n unless view_context.admin?\n redirect_to root_url\n end\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def checkAdmin\n current_user.present? && current_user.isAdmin\n end",
"def admin_access?\n admin?\n end",
"def must_be_admin!\n access_denied! unless current_admin?\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def ensure_admin!\n # D: Send admin status to log\n logger.debug \"current_user.admin? => #{current_user.admin?}\"\n unless current_user.admin?\n flash[:notice] = 'You do not have sufficient privileges.'\n redirect_to root_path\n return false\n end \n end",
"def check_admin\n if authenticate_user! && current_user.admin\n return true\n else\n redirect_to \"/kopis/new\"\n end\n end",
"def verify_is_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def check_admin\n if !current_user.admin?\n flash[:error] = \"You dont have access to this Page!!!!!\"\n redirect_to root_path\n end\n end",
"def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend",
"def check_for_admin\n\t\tif current_user.nil? || !current_user.is_admin?\n\t\t\tredirect_to root_path, alert:\"You must be an admin to access this path\"\n\t\tend\n\tend",
"def is_admin?\n redirect_to regulate_admin_regulate_pages_path if !@is_admin\n end",
"def check_admin\n redirect_to houses_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_if_admin\n if(is_admin?)\n return true\n else\n flash[:notice] = 'You need to be signed in to perform that action'\n redirect_to :back\n end\n end",
"def check_admin\n redirect_to root_path unless current_user.has_role? :admin\n end",
"def require_admin\n end",
"def admin_required\n current_user.is_admin? || access_denied\n end",
"def check_admin_of\n redirect_to root_path if current_user &&\n @user != current_user &&\n !current_user.admin_of?(@user, \"can_manage_users\")\n end",
"def admin_authorize\n unless admin?\n unauthorized_access\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def admin_required\n if current_user && current_user.admin\n return\n end\n redirect_to \"/login\", notice: 'Logga in som administratör.'\n end",
"def is_admin_request?\n !(@_admin_menus.nil?)\n end",
"def checkAdmin\n if !admin_signed_in?\n # if current user is not an admin then can't access the page like add teacher,department,college and new subject\n redirect_to root_path, notice: \"Only Admin Can Access This Page\"\n end\n end",
"def admin?() false end",
"def isAdmin\n \n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end",
"def verify_super_admin\n redirect_to admin_path unless current_user.user_level == \"super_admin_access\"\n\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end",
"def verify_super_admin\r\n redirect_to admin_path unless current_user.user_level == \"super_admin_access\"\r\n end",
"def verify_admin?\n return if current_user.admin?\n\n flash[:alert] = \"Sorry, only admins allowed to view the dashboard.\"\n redirect_to :root\n end",
"def is_admin\n admin?\n end",
"def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end",
"def is_admin?\n unless current_user.admin?\n flash[:alert] = \"You dont have permissions\"\n redirect_to root_path\n end\n end",
"def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend",
"def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end",
"def ensure_admin\n unless current_user && current_user.admin\n flash[:notice] = \"You are not authorized to perform this action\"\n redirect_back(fallback_location: root_path)\n end\n\n end",
"def is_in_admin_view?\n !request.path.match(\"admin\").nil?\n end",
"def require_admin\n redirect_to(root_path) unless current_user.admin?\n end",
"def is_admin?\n is_admin == 1\n end",
"def show\n is_admin?\n end",
"def is_admin?\n admin\n end",
"def is_admin?\n admin\n end",
"def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end",
"def is_admin?\n admin?\n end",
"def only_authorize_admin!\n authorize!(is?(:admin))\n end",
"def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end",
"def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end",
"def admin?\n false\n end",
"def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end",
"def is_admin?\n unless current_user.admin?\n flash[:alert] = \"You don't have permissions\"\n redirect_to root_path\n end\n end",
"def check_admin_rights\n unless logged_in? and current_user.is_admin?\n flash[:error] = \"Permiso denegado\"\n redirect_to '/'\n end\n end",
"def handle_admin_permissions()\n if !session[:debater].is_admin\n redirect_to(:controller => :debater, :action => :login_form, :message => \"must login as admin to make specified request\")\n return false\n end\n return true\n end",
"def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end",
"def authenticate_admin!\n render_404 unless current_user.try(:admin?) && current_user\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end",
"def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend",
"def require_admin\n if Rails.env.production? && is_market? && Rails.configuration.admin_hostname != request.host\n render plain: \"ADMIN_HOSTNAME setting does not match your host header.\"\n else\n unless is_admin?\n flash[:alert] = \"Access not authorized. Need to be logged in first.\"\n redirect_to admin_new_session_path\n end\n end\n end",
"def require_admin\n redirect_to root_path unless @current_user.admin?\n end",
"def admin?; false end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def require_admin\n\t\tif !logged_in? || (logged_in? && !current_user.admin?)\n\t\t\tflash[:danger] = \"Only Admins can perform that action\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def check_if_admin_access\n if request.path == \"/admin\" && current_user.permission_level <= 2\n redirect_to :back\n end\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end"
] |
[
"0.80556935",
"0.78866667",
"0.77844906",
"0.76927286",
"0.7562618",
"0.75464356",
"0.75464356",
"0.75140536",
"0.7513962",
"0.75067276",
"0.74892306",
"0.7464292",
"0.7452952",
"0.7445053",
"0.74262816",
"0.7422698",
"0.7413248",
"0.7405049",
"0.7405049",
"0.73890924",
"0.73862684",
"0.7377568",
"0.7369892",
"0.7360492",
"0.73597896",
"0.73520374",
"0.73520374",
"0.7343912",
"0.7343912",
"0.7343912",
"0.7340678",
"0.7339747",
"0.7336669",
"0.7327836",
"0.732556",
"0.732556",
"0.73049825",
"0.729864",
"0.72945064",
"0.7293715",
"0.72896695",
"0.72773826",
"0.72723836",
"0.7264226",
"0.7263778",
"0.7262757",
"0.72473437",
"0.7225686",
"0.7211708",
"0.7211123",
"0.7208193",
"0.7208193",
"0.719288",
"0.71844506",
"0.71837527",
"0.71795875",
"0.71750784",
"0.7170788",
"0.7169905",
"0.71684426",
"0.71661735",
"0.7165819",
"0.7162995",
"0.7155512",
"0.7155038",
"0.71547097",
"0.71504456",
"0.714879",
"0.71381074",
"0.7124643",
"0.71191925",
"0.7109374",
"0.71019393",
"0.70993334",
"0.70993334",
"0.7097833",
"0.7091697",
"0.709083",
"0.7085561",
"0.70807254",
"0.708043",
"0.7074911",
"0.70726717",
"0.70726395",
"0.70569205",
"0.70496714",
"0.70490825",
"0.704618",
"0.70451874",
"0.7040079",
"0.7040014",
"0.70361423",
"0.70343107",
"0.70329213",
"0.7029445",
"0.7024919",
"0.7023396"
] |
0.73743427
|
25
|
Method to add a new record based on a hash
|
def create_record(r, defaults)
rec = Record.new(defaults.merge(r))
rec.save
puts notice(rec)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add(hash); end",
"def create(record_hash = {})\n record = new(record_hash)\n record.save\n end",
"def addRecord(rec); @records[rec.key] = rec end",
"def create_record!(hash, inventory_object)\n record = inventory_collection.model_class.create!(hash.except(:id))\n inventory_collection.store_created_records(record)\n\n inventory_object.id = record.id\n end",
"def insert(id, hash)\n @conn.execute(*@builder.insert(id, hash))\n end",
"def create!( hash )\n doc = new( hash )\n doc.save!\n end",
"def create(hash={})\n model = self.new(hash)\n model.save\n model\n end",
"def add(hash)\n\t\tarr = []\n\t\thash.each do |k, v|\n\t\t\tcolumn = check_column(k.to_s)\n\t\t\tif(column[:unique])\n\t\t\t\tif(exists_with({k => v}))\n\t\t\t\t\traise \"#{k} #{v} already exists\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tarr << [k, v]\n\t\tend\n\n\t\tsql = \"INSERT INTO #{@table} (\"\n\t\tarr.each do |a|\n\t\t\tsql += \"#{a[0]},\"\n\t\tend\n\n\t\tsql.chop! # Remove trailing ','\n\t\tsql += ' VALUES ('\n\t\tarr.each do |a|\n\t\t\tsql += \"#{a[1]},\"\n\t\tend\n\n\t\tsql.chop! # Remove trailing ','\n\t\tsql += ');'\n\t\[email protected](sql)\n\tend",
"def store(hash)\n store_for_id(@id, hash)\n end",
"def add_hash(id, hash, source)\n @hashes[id] = {:deletehash => hash, :source => source, :stamp => Time.now}\n end",
"def add_user_hash(h, collection)\n if !h[:login] && !h[:studentnumber]\n raise ArgumentError.new(\"New user has neither login nor student number\")\n end\n \n user = nil\n user = User.find_by_login(h[:login]) if h[:login]\n user ||= User.find_by_studentnumber(h[:studentnumber]) if h[:studentnumber]\n\n if user\n # Existing user\n collection << user unless collection.include?(user)\n else\n # New user\n user = User.new\n user.studentnumber = h[:studentnumber]\n user.firstname = h[:firstname]\n user.lastname = h[:lastname]\n user.email = h[:email]\n user.password = h[:password]\n user.login = h[:login]\n \n user.save! # raise an exception if something fails\n \n collection << user\n end\n\n end",
"def create_row(hash)\n raise ORM::TableError, \"Something went wrong.\" unless hash[:id].present?\n\n update_counter(hash[:id])\n result_table = table << hash\n File.write(@table_path, JSON.generate(result_table))\n end",
"def add_movie_to_database(hash)\n movie_object = Movie.find_or_create_by(title: hash[\"Title\"], #check for a movie given the extracted details, create if not found\n release_year: hash[\"Released\"],\n genre: hash[\"Genre\"],\n director: hash[\"Director\"])\n add_movie_to_mylist(movie_object) #Allow the user to add the movie object to (through) their list\n end",
"def add(values_hash = {}) #values_hash = {}\n table_name = self.to_s.pluralize.underscore\n\n columns = values_hash.keys\n values = values_hash.values\n binding.pry\n CONNECTION.execute(\"INSERT INTO #{table_name} (#{columns.join \", \"}) VALUES (#{values.to_s[1...-1]});\")\n\n id = CONNECTION.last_insert_row_id\n values_hash[\"id\"] = id\n \n self.new(values_hash)\n end",
"def add_item(hash, item, quantity)\r\n\thash.store(item, quantity)\r\n\thash\r\nend",
"def create(hash)\n NotImplementedError\n end",
"def add(hash, opts = {})\n uuid = opts[:id] || SecureRandom.uuid\n thash = Treet::Hash.new(hash)\n repos[uuid] = thash.to_repo(\"#{root}/#{uuid}\", opts.merge(:repotype => repotype))\n end",
"def makeEntry(hash, e)\n hash[e.id] = {\n name: e.public_name,\n createTimestamp: e.createTimestamp,\n }\n if e.banned?\n hash[e.id][:noLogin] = true\n else\n # Don't publish urls for banned logins\n unless e.urls.empty?\n # need to sort to avoid random changes which seem to occur for urls\n hash[e.id][:urls] = e.urls.sort\n end\n # only add entry if there is a fingerprint\n unless e.pgp_key_fingerprints.empty?\n # need to sort to avoid random changes which seem to occur for fingerprints\n hash[e.id][:key_fingerprints] = e.pgp_key_fingerprints.sort\n end\n end\nend",
"def add_to_hash(hash)\n super\n contact.add_to_hash(hash)\n hash['user_over_13'] = @user_over_13 || !@new_user\n hash['last_logged_in'] = fmt_date_time(@data_object.user_last_logged_in)\n hash['first_logged_in'] = fmt_date_time(@data_object.user_first_logged_in)\n# aff_opts = Affiliate.options\n\n hash\n end",
"def create_card_from_hash(c)\n card = set_card_details(Card.new, c)\n card.save!\n card\nend",
"def add_row(hash = {})\n row = vr_row(model.append)\n hash.each_pair { |key, val| row[key] = val }\n return row\n end",
"def create_or_update_record(hsh)\n\n hsh.merge!(config[:strong_default_attrs]) if config[:strong_default_attrs]\n @record ||= data_class.find(:first, :conditions => {data_class.primary_key => hsh.delete(data_class.primary_key)}) # only pick up the record specified in the params if it was not provided in the configuration\n success = true\n\n @record = data_class.new if @record.nil?\n\n hsh.each_pair do |k,v|\n @record.set_value_for_attribute(fields[k.to_sym].nil? ? {:name => k} : fields[k.to_sym], v)\n end\n\n #hsh.each_pair do |k,v|\n #begin\n #@record.send(\"#{k}=\",v)\n #rescue StandardError => exc\n #flash :error => exc.message\n #success = false\n #break\n #end\n #end\n\n # did we have complete success?\n success && @record.save\n end",
"def add(r)\n db[r.name] = r\n end",
"def promise_create(record_hash = {})\n record = new(record_hash)\n record.promise_save\n end",
"def add_report(database, hash)\n sql = \"INSERT INTO reports(reporter_name, reporter_state, reporter_phone, hero_seen, suspect_name, powers_displayed) VALUES (?,?,?,?,?,?)\"\n\n database.execute(sql, [ hash[\"reporter_name\"], hash[\"reporter_state\"], hash[\"reporter_phone\"], hash[\"hero_seen\"], hash[\"suspect_name\"], hash[\"powers_displayed\"]])\nend",
"def hash_record_low_mem! set, rec, duplicate_type\n key = make_key rec, duplicate_type\n\n set << key\nend",
"def <<(hHash)\n @params.merge!(hHash) unless hHash.nil?\n end",
"def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end",
"def add_hash(obj, hash)\n return unless hash\n\n hash.each do |key, value|\n if value.class == Hash\n eval \"obj.#{key} = OpenStruct.new\"\n add_hash(eval(\"obj.#{key}\"), value)\n else\n eval \"obj.#{key.downcase} = value\"\n end\n end\n end",
"def add_item(hash, new_item, qty)\n hash[new_item] = qty\n hash \nend",
"def add(rf, start_time, uploader)\n hash = HistoryEntry.new.from_recording_format(rf)\n hash.add_time(start_time)\n hash.add_status(uploader.status)\n\n @history << hash\n hash[:id] = @_hdb.add(hash)\n end",
"def hash_record! ht, rec, duplicate_type\n case duplicate_type\n when 1 # whole header match\n unless ht.has_key? rec.header\n ht[rec.header] = rec\n end\n when 2 # header ID match\n unless ht.has_key? rec.id\n ht[rec.id] = rec\n end\n when 3 # whole seq match\n unless ht.has_key? rec.seq\n ht[rec.seq] = rec\n end\n when 4 # whole seq + whole header\n key = \"#{rec.header}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n when 5 # whole seq + hedaer ID\n key = \"#{rec.id}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n end\nend",
"def add(hash)\n batch << hash\n\n if batch.count % batch_size == 0\n solr_service_connection.add(batch, softCommit: soft_commit, commit: commit)\n batch.clear\n end\n end",
"def add_hash(hash, key, value)\n return hash[key] = value\nend",
"def add(params_data)\n @user_hash = get_user(params_data[:user_id])\n @user_hash[:user_name] = params_data[:user_name]\n @user_hash[:user_id] = params_data[:user_id]\n @user_hash[:text] = params_data[:text]\n @user_hash[:command] = params_data[:command]\n @user_hash[:team_id] = params_data[:team_id]\n @user_hash[:team_domain] = params_data[:team_domain]\n @user_hash[:channel_id] = params_data[:channel_id]\n @user_hash[:channel_name] = params_data[:channel_name]\n @user_hash[:slack_respurl] = params_data[:response_url]\n save_data(@filetag)\n end",
"def add_record(record)\n return unless @if_proc.call(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def add(item, quantity, hash)\n hash[item] = quantity\nend",
"def add(hash, item, qty)\n hash[item] = qty\n \nend",
"def new_or_update!(hash={}, options = {:hard_update => true})\n hash.symbolize_keys!\n if hash[:id].blank?\n self.new(hash)\n else\n rec = self.find(hash[:id])\n if options[:hard_update]\n rec.update_attributes!(hash.except(:id))\n else\n rec.update_attributes(hash.except(:id))\n end\n rec\n end\n end",
"def invoice_updateinsert(recordhash)\n\t\tif(invoice_recordexists(recordhash)) then\n\t\t\tinvoice_update(recordhash)\n\t\telse\n\t\t\tinvoice_insert(recordhash)\n\t\tend\n\tend",
"def add(hash, item, qty)\n hash[item] = qty\n\nend",
"def add_record(record)\n return unless allow_indexing?(record)\n\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record, record.id)\n\n @storage.add(atoms)\n end",
"def add_record param, strength\n\trecord = check_repeat(param)\n\trecord.add_record(strength)\nend",
"def add_commit_to_db(hash)\n #insert hash values into proper attribute in commits table\n @con.exec_prepared('commitInsert', hash.values_at(*@@GIT_LOG_PROPERTIES))\n \n create_commit_filepath(hash[\"filepaths\"], hash[:commit_hash])\n create_commit_bug(hash[:bug], hash[:commit_hash]) if hash[:bug]!=nil\n end",
"def add_student(school,new_student)\n new_student_hash = {}\n new_student_hash[:name] = new_student\n school[:students] << new_student_hash\nend",
"def add_item(hash, new_item, item_quantity)\n hash[new_item] = item_quantity\nend",
"def push_record(record)\n params = TogglRecord.new(record, config).push\n record[:id]\n end",
"def add(key, hash, value)\n @hash[key] = value\n @key_hash.add(key, hash)\n end",
"def add_item(hash,item)\n hash[:inventory].push(item)\nend",
"def save\n raise \"Unhashed entry during save\" unless @hash\n raise \"Entry without mime type during save\" unless @mimetype\n @data[:mimetype] = @mimetype\n @data[:ctime] = @ctime.utc.to_i\n @data[:mtime] = @mtime.utc.to_i\n @data[:name] = @name\n @data[:size] = @size\n @data[:tags] = @tags\n @data[:locations] ||= Array.new\n unless @data[:locations].include? @location\n @data[:locations] << @location\n end\n if ::Ordnung.database.read @hash\n ::Ordnung.database.update @hash, @data\n else\n ::Ordnung.database.create @hash, @data\n end\n @hash\n end",
"def create(key, contents)\n store.write do |data| \n \n data[:columns][column][key] = contents \n\n Record.new(column, key, contents)\n end\n end",
"def add(model)\n self[model.primary_key] = model\n end",
"def insert_hash_into_db(hash)\n with_transaction do\n hash.each do |collection, records|\n client[collection].insert_many(records)\n end\n end\n end",
"def create(record)\n raise Octothorpe::BadHash if record.nil?\n ot = Octothorpe.new(record)\n\n if id_ai\n ot = ot.reject{|k,_| k == id_fld}\n else\n raise(ArgumentError, \"ID field missing from record\") if ot[id_fld].nil?\n end\n\n sql, vals = sql_insert(ot)\n x = select sql_subst(sql, *vals.map{|v| quote v})\n x.first[id_fld]\n\n rescue Octothorpe::BadHash\n raise ArgumentError, \"Bad type for record parameter\"\n rescue\n handle_error $!\n end",
"def add( toAdd )\n if toAdd.is_a?(Hash) # if toAdd is a hash\n toAdd.each do |keyWord, value|\n @entries[ keyWord ] = value # add as hash\n end\n else\n @entries[ toAdd ] = nil # if toAdd is NOT a hash, use keyword, as toAdd, to add a nil value\n end\n end",
"def save!\n unless @hash['id']\n self.class.create @hash\n return true\n end\n values_to_set = @hash.each_with_object([]) { |(k, v), result| result << \"#{k} = '#{v}'\" }.join(',')\n DB.execute <<SQL\nUPDATE #{self.class.table}\nSET #{values_to_set}\nWHERE id = #{@hash['id']}\nSQL\n end",
"def create_from_hash(hash, opts={})\n create_opts = update_or_create_options(hash, opts)\n create { |instance| instance.set(create_opts) }\n end",
"def << (record)\n raise \"Obj should be a Record\" unless record.class == Record\n @entries << record\n end",
"def add_record(record)\n condensed_record = condense_record(record)\n load_atoms(condensed_record)\n add_occurences(condensed_record,record.id)\n @records_size += 1\n end",
"def create\n @hash_tag = HashTag.new(hash_tag_params)\n\n respond_to do |format|\n if @hash_tag.save\n format.html { redirect_to @hash_tag, notice: 'Hash tag was successfully created.' }\n format.json { render :show, status: :created, location: @hash_tag }\n else\n format.html { render :new }\n format.json { render json: @hash_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_show_to_table(show_hash)\n show = Show.find_by(api_id: show_hash[\"id\"])\n if show == nil\n Show.create(api_id: show_hash[\"id\"], name: show_hash[\"name\"], description: show_hash[\"description\"], genre: show_hash[\"genres\"][0], network: show_hash[\"network\"], start_date: show_hash[\"start_date\"], runtime: show_hash[\"runtime\"])\n end\nend",
"def add_to_database\n hash = self.attr_hash\n columns = hash.keys\n values = hash.values\n if self.valid?\n CONNECTION.execute(\"INSERT INTO #{tablename} (#{columns.join \", \"}) VALUES (#{values.to_s[1...-1]});\")\n @id = CONNECTION.last_insert_row_id\n else\n false\n end\n end",
"def add(data)\n create(data)\n end",
"def add(data)\n create(data)\n end",
"def store_event_in_db(event_hash)\n newEvent = Event.new(name: event_hash[\"name\"], date: event_hash[\"dates\"][\"start\"][\"localDate\"], city: event_hash[\"_embedded\"][\"venues\"][0][\"city\"][\"name\"], state: event_hash[\"_embedded\"][\"venues\"][0][\"state\"][\"name\"], venue_name: event_hash[\"_embedded\"][\"venues\"][0][\"name\"])\n newEvent.save \n newEvent\nend",
"def save!\n unless @hash[\"id\"]\n self.class.create\n return true\n end\n\n fields = @hash.map do |k, v|\n \"#{k}=#{self.class.to_sql(v)}\"\n end.join \",\"\n\n DB.execute <<SQL\nUPDATE #{self.class.table}\nSET #{fields}\nWHERE id = #{@hash[\"id\"]}\nSQL\n true\n end",
"def invoice_line_updateinsert(recordhash)\n\t\tif(invoice_recordexists(recordhash)) then\n\t\t\tline_item_update(recordhash)\n\t\telse\n\t\t\tline_item_insert(recordhash)\n\t\tend\n\tend",
"def update(hash); end",
"def assign_hash(hash)\n super hash\n create_if_exists hash, 'title', name: :p_title\n create_if_exists hash, 'titleDe', name: :p_title\n create_if_exists hash, 'short', name: :p_short\n create_if_exists hash, 'abstractDe', name: :p_short\n create_if_exists hash, 'researchAreas', 'researchArea', 'name', 'de', name: :p_research_area\n create_if_exists hash, 'financiers', 'financier', 'de', name: :p_financier\n create_if_not_exists hash, 'detail_url', 'https://tiss.tuwien.ac.at/fpl/project/index.xhtml?id=' + tiss_id, name: :detail_url\n end",
"def add_item(hash, item, quantity)\n\t hash[item] = quantity\n\t return hash\nend",
"def add_associate(hash)\n\n type = hash.delete(:type)\n\n doc = NSDocument.new(hash)\n doc.identifier = Noteshare::Identifier.new().string\n doc.root_ref = { 'id'=> 0, 'title' => ''}\n doc.author_id = self.author_id\n doc.author = self.author\n doc.author_credentials2 = self.author_credentials2\n\n doc2 = DocumentRepository.create doc\n\n doc2.associate_to(self, type)\n\n doc2\n\n end",
"def add(key, value); end",
"def add_item(hash, new_key, new_value)\n hash[new_key] = new_value\n p hash\nend",
"def add_item(hash,item,num)\r\n\t\r\n\th2 = { \"#{item}\" => num}\r\n\thash.merge!(h2) \r\n\treturn hash\r\nend",
"def add_item(hash, item, quantity)\n\n hash[item] = quantity.to_i \n\n return hash\nend",
"def create_from_hash hash\n values = values_from_hash hash\n unless obj = find(:first, :conditions => values)\n return nil if values[:id]\n obj = create!(values)\n raise ArgumentError, \"#{obj.errors.to_s}\" unless obj.errors.empty?\n end\n obj\n end",
"def add_or_find(hash)\n issue = IssueGraph::Issue.new(hash)\n\n if i = self[issue.name]\n return i\n else\n # load issue data from github so we have enough info for the graph string\n issue[:repo_name] = repository_name_from_id(issue[:repo_id])\n issue.load_from_gh(gh_client)\n self.add(issue)\n return issue\n end\n end",
"def add_details(details_hash)\n @user = details_hash[:user]\n @description_long = details_hash[:description_long]\n end",
"def insert(record, sync: true)\n record = klass.new(**record) if record.is_a?(Hash)\n row = record.to_row(header)\n ws.update_cells(*next_row_col, [row])\n ws.synchronize if sync\n record\n end",
"def new_from_hash_marketplace(h)\n self.url = h\n h=h.split('/')\n h=h[h.size-2]\n self.original_id = h\n return self\n end",
"def add_to_hash(storage_hash, name, new_name)\r\n storage_hash[name] = new_name\r\nend",
"def add_params(hash)\n @params.merge!(hash)\n end",
"def create_contact(name, phonenumber)\n contact = {\n name: \"#{name}\",\n phone: \"#{phonenumber}\",\n }\n @contact_book << contact\n #p @contact_book #print confirmation of adding to the hash \nend",
"def create\n values = attribute_hash\n DBConnection.execute(<<-SQL, values)\n INSERT INTO\n #{self.class.table_name} (#{values.keys.join(', ')})\n VALUES\n (:#{values.keys.join(', :')})\n SQL\n self.id = DBConnection.last_insert_row_id\n end",
"def add_to_hash hash = { }\n hash[self.class.value_name] = code\n if respond_to?(:uuid) \n hash[self.class.value_name_uuid] = initialize_uuid!\n end\n hash\n end",
"def add_new_record(h, ws)\n row_array = []\n @excel_row.each do |a|\n row_array.push(h[a])\n end\n ws.add_row row_array\nend",
"def add pid, title, description, cid, tracker\n\t\[email protected] Hash[\n\t\t\t'pid' => pid, \n\t\t\t'title' => title, \n\t\t\t'description' => description,\n\t\t\t'creator' => cid, \n\t\t\t'tracker' => tracker,\n\t\t\t'status' => 'new',\n\t\t\t'assigned' => '-1']\n\tend",
"def next_hash(hash)\n db.next_hash(hash)\n end",
"def add_new_student(school, name)\n\tschool[:students].push({:name => name})\nend",
"def write_db(entry_hash)\n formatted = format_hash(entry_hash)\n v_fname = formatted[\"fname\"] # prepare data from entry_hash for database insert\n v_lname = formatted[\"lname\"]\n v_addr = formatted[\"addr\"]\n v_city = formatted[\"city\"]\n v_state = formatted[\"state\"]\n v_zip = formatted[\"zip\"]\n v_mobile = formatted[\"mobile\"]\n v_home = formatted[\"home\"]\n v_work = formatted[\"work\"]\n begin\n conn = open_db() # open database for updating\n max_id = conn.exec(\"select max(id) from listings\")[0] # determine current max index (id) in details table\n max_id[\"max\"] == nil ? v_id = 1 : v_id = max_id[\"max\"].to_i + 1 # set index variable based on current max index value\n conn.prepare('q_statement',\n \"insert into listings (id, fname, lname, addr, city, state, zip, mobile, home, work)\n values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\") # bind parameters\n conn.exec_prepared('q_statement', [v_id, v_fname, v_lname, v_addr, v_city, v_state, v_zip, v_mobile, v_home, v_work])\n conn.exec(\"deallocate q_statement\")\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\n return formatted\nend",
"def add_hash_card(card)\n card[:type] = 'Simple' if card[:type].nil?\n @card = card\n @card\n end",
"def push_new_record(record)\n handle_couch_response do\n RestClient.post(local_couch_database_url, record, content_type: :json)\n end\n end",
"def addnew(mac)\n if not mac.kind_of?(MACAddress)\n raise \"Incorrect MAC address supplied\"\n end\n \n if get_record(mac)\n raise \"MAC address already registered\"\n end\n \n rec = HotRecord.new(mac)\n rec.token = gen_token()\n\n @data.records << rec\n reset_pending(rec) # see note below\n\n save_data()\n\n @log.info \"Added #{rec}\"\n rec\n end",
"def new_entry(key, key_hash, value)\n if key.kind_of?(String) and !key.frozen?\n key = key.dup\n key.freeze\n end\n\n @size += 1\n Entry.new key, key_hash, value\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize(student_hash)\n #for each student in hash, create a k/v pair via mass asign (.send)\n student_hash.each {|k,v| self.send((\"#{k}=\"), v)}\n self.save\n end",
"def add(key, value)\n @hash[key] = value\n self\n end",
"def add(class_name, object)\n @data = get_all()\n \n @data[class_name].push(object.to_hash())\n \n save()\n end",
"def add(item, quantity, hash)\n hash[item] = quantity\n puts hash\nend",
"def push_into_hash(hash, key, data)\n if hash[key.to_sym].nil?\n hash[key.to_sym] = [data]\n else # existing key\n hash[key.to_sym].push(data)\n end\n end",
"def initialize hash\n @hash = hash\n end"
] |
[
"0.7653652",
"0.7488804",
"0.73270947",
"0.70142984",
"0.69641143",
"0.69504595",
"0.6812263",
"0.6806295",
"0.6577319",
"0.6520014",
"0.64489734",
"0.64376134",
"0.6424322",
"0.6422087",
"0.6366283",
"0.63463324",
"0.6340782",
"0.6291044",
"0.62716955",
"0.6268501",
"0.62552035",
"0.6228936",
"0.6159242",
"0.6156066",
"0.6155896",
"0.61266035",
"0.61256015",
"0.61189914",
"0.6100785",
"0.6080793",
"0.6079041",
"0.60522187",
"0.60453653",
"0.60407615",
"0.60225755",
"0.60183305",
"0.6009168",
"0.6008724",
"0.60084563",
"0.60046995",
"0.5996127",
"0.59916973",
"0.59834146",
"0.59516144",
"0.5944764",
"0.5944393",
"0.5936082",
"0.5935577",
"0.5932324",
"0.5926431",
"0.59223926",
"0.5912985",
"0.59065604",
"0.5905557",
"0.590555",
"0.5890039",
"0.5878917",
"0.5878596",
"0.58772963",
"0.5860889",
"0.5860451",
"0.5851259",
"0.5839039",
"0.5839039",
"0.5830899",
"0.5830719",
"0.5812349",
"0.5809439",
"0.58068377",
"0.5803793",
"0.57991743",
"0.57991153",
"0.5791556",
"0.5788238",
"0.5771766",
"0.57694006",
"0.57492536",
"0.57361835",
"0.57294726",
"0.5725622",
"0.5723714",
"0.5721612",
"0.57208586",
"0.57166404",
"0.5716041",
"0.5707517",
"0.5701354",
"0.5700896",
"0.56924397",
"0.5689556",
"0.56871396",
"0.56852984",
"0.5679284",
"0.5668413",
"0.5662388",
"0.56608105",
"0.5660132",
"0.565909",
"0.5658511",
"0.565146",
"0.5633163"
] |
0.0
|
-1
|
Prints the record's details
|
def notice(r)
' | ' + r.name.to_s.ljust(30) +
' | ' + r.record_type.to_s.ljust(5) +
' | ' + r.aux.to_s.rjust(4) +
' | ' + r.data.to_s.ljust(34) +
' | '
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def record_display\n \"#{id}. Name: #{name}\\n Email: #{email}\\n Library: #{libraries_display}\"\n end",
"def print_details\n puts \"\"\n puts \"#{@fullname}\"\n puts \"---------\" ' '\n puts \"Date of Birth:#{@dob}\"\n \n puts \"\"\n puts \"Email addresses:\"\n @emails.each do |e|\n puts \"- \" + e.to_s\n end \n \n puts \"\"\n puts \"Phone Numbers:\"\n @phone_numbers.each do |n|\n puts \"- \" + n.to_s\n end\n end",
"def display_details()\n puts \"Customer id is #{@id} \"\n puts \"Customer name is #{@name} \"\n puts \"Customer address is #{@address} \"\n end",
"def display_details()\n puts \"Customer id #@cust_id\"\n puts \"Customer name #@cust_name\"\n puts \"Customer address #@cust_addr\"\n end",
"def display_details()\n puts \"Customer name: #@cust_name\"\n puts \"Customer ID: #@cust_id\"\n puts \"Customer address: #@cust_addr\"\n end",
"def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} stars\"\n\tend",
"def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end",
"def list_details\n puts \"Name: \" + @name\n puts \"Description: \" + @details\n puts \"Exercise Time: \" + @duration\n end",
"def print_record(msg)\n tag = '[ RECORD ]'\n print_formatted(tag,msg)\n end",
"def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"def show_detail(n)\n puts \"Here's the detail for contact ID #{n}\"\n puts \"================================\"\n puts \"Name: #{Contact.find(n).name}\"\n puts \"Email: #{Contact.find(n).email}\"\n puts Contact.find(n).phone_hash.to_yaml\n puts \"================================\"\n end",
"def print_details()\n\t$details.each {|k, v| puts \"#{k}: #{v}\"}\nend",
"def details\n puts \"#{@name}, #{@date}\"\n end",
"def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"def show\n puts \"\n ID: #{id}\n Last Name: #{last_name}\n First Name: #{first_name}\n Address: #{address}\n City: #{city}\n State: #{state}\"\n end",
"def display_details()\n\t\tputs \"------------------------------\"\n\t\tputs \"User Details\"\n\t\tputs \"#{@first_name} #{@surname} aged '#{@age}'\"\n\t\tputs \"------------------------------\"\n\tend",
"def show_details\n print @name.upcase + \": #{@name} has #{@moons} moons and a diameter of #{@diameter} miles.\"\n print \"It is #{@color} in color and associated with the #{@zodiac} zodiac sign.\"\n puts \"#{@name} is #{@distance} miles from the sun and has a solar rotation of #{@rotation} earth days!\"\n end",
"def print_details\n puts \"#{self.reader.name} subscribed to #{self.magazine.title} for $#{self.price}\"\n end",
"def print()\n printf \"\\nAuthor ID: %d affiliation: %s affiliation short: %s country: %s\\n\", self.article_author_id, self.name, self.short_name, self.country\n printf \"\\nAddress: %s, %s, %s, %s, %s\\n\", self.add_01, self.add_02, self.add_03,self.add_04, self.add_05\n end",
"def print_records(records)\n\tprint_status(\"Records found:\")\n\trecords.each do |r|\n\t\tprint_good(\"\\tHost: #{r[:host]}\")\n\t\tprint_good(\"\\tIP: #{r[:ip]}\")\n\t\tprint_good(\"\\tPort: #{r[:port]}\")\n\t\tprint_good(\"\\tService:#{r[:service]}\")\n\t\tprint_good(\"\\tText:#{r[:txt]}\")\n\t\tprint_good(\"\")\n\tend\nend",
"def print_details\n puts \"#{self.reader.name} subscribed to #{self.magazine.title} for $#{self.price}\"\n end",
"def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"def details\n\n end",
"def print_details(job)\n printf \"-----------------------------------------------------------------------------------\\n\"\n printf(\"\\nTitle: %<title>s\\n\", title: job.title.to_s)\n printf(\"Department: %<department>s\\n\", department: job.department.to_s)\n printf(\"Application Deadline: %<deadline>s\\n\", deadline: job.app_deadline.to_s)\n printf(\"Salary Range: %<salary>s\\n\", salary: job.salary_range.to_s)\n printf(\"Positions Available: %<avail>s\\n\", avail: job.pos_available.to_s)\n printf(\"Job Category: %<cat>s\\n\", cat: job.category.to_s)\n printf(\"Job Appointment (FTE): %<fte>s\\n\", fte: job.fte.to_s)\n printf(\"Full/Part Time: %<fullpart>s\\n\", fullpart: job.full_part.to_s)\n printf(\"Temporary or Regular: %<tempreg>s\\n\", tempreg: job.temp_reg.to_s)\n printf(\"Posting Start Date: %<date>s\\n\", date: job.start_date.to_s)\n printf(\"Positing End Date: %<date>s\\n\", date: job.end_date.to_s)\n printf(\"Department Contact Name: %<name>s\\n\", name: job.contact_name.to_s)\n printf(\"Department Contact Phone: %<phone>s\\n\", phone: job.contact_phone.to_s)\n printf(\"\\nSummary:\\n %<duties>s\\n\", duties: job.duties_summary.to_s)\n printf(\"\\nRequired Qualifications:\\n %<qual>s\\n\", qual: job.req_qualifications.to_s)\n printf(\"\\nDesired Qualifications:\\n %<qual>s\\n\", qual: job.des_qualifications.to_s)\n end",
"def details; end",
"def details\n return \" #{@description}, #{@lastname}, #{@date}. #{@start}, #{@hours}, #{@players}, #{@zone}. #{@cost}\"\n end",
"def print_basic_info\n \"Name:#{name}, Occupation:#{occupation}, Sex:#{sex}\"\n end",
"def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end",
"def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end",
"def details\n end",
"def details\r\n return @description + \": \" + \". \" + @basic_profile.details\r\n end",
"def print_person\n puts \"Name: #{name}\"\n puts \"Age: #{age} years old\"\n puts \"ID: VCN#{id}\"\n end",
"def display_account_details\n puts \"\"\n puts \"Account Details\"\n puts \"-------------------------\"\n puts \"Rank: #{rank}\"\n puts \"Name: #{name}\"\n puts \"Handle: @#{handle}\"\n puts \"Followers: #{followers}\"\n puts \"-------------------------\"\n end",
"def display_details()\r\n\t\tprintf(\"\\n**************************************************\")\r\n\t\tprintf(\"\\n***** MONTHLY PAY SLIP DETAILS *****\")\r\n\t\tprintf(\"\\n**************************************************\")\r\n\t\tprintf(\"\\nEmployee Name : %s\",@name)\r\n\t\t# Amounts are depicted with 2 decimal places.\r\n\t\tprintf(\"\\nGross Monthly Salary : $ %.2f\",@grossMonthlyIncome)\r\n\t\tprintf(\"\\nMonthly Tax : $ %.2f\",@monthlyIncomeTax)\r\n\t\tprintf(\"\\nNet Monthly Salary : $ %.2f\",@netMonthlyIncome)\r\n\t\tprintf(\"\\n**************************************************\")\r\n end",
"def get_info\n puts @name + ' [ID: ' + @id.to_s + ' @ '+ @@company + ']'\n end",
"def details\r\n return @description + \"; \" + @vPatients + \"; \" + @vProfiles + \": \" + @vAppointments\r\n end",
"def details\n\n puts \"\"\n puts \"Todays crypto update:\"\n puts \"Volume is the amount of the coin that has been traded with in a certain time frame...fyi\"\n puts \"----------------------------------------------------------------------\"\n puts \"| Coin (Symbol) | Volume (1 day) | Volume (7 day) | Volume (30 day) |\"\n puts \"----------------------------------------------------------------------\"\n puts \"\"\n\n @coins = TheCryptoUpdate::Coin.all[0..99]\n\n @coins.find do |coin|\n puts \" #{coin.name} (#{coin.symbol}) | $#{coin.volume_1d} | $#{coin.volume_7d} | $#{coin.volume_30d} |\"\n end\n\n end",
"def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end",
"def display()\n\t\tputs \"method: #{@method}\"\n\t\tputs \"identifier: #{@identifier}\"\n\t\tputs \"query: #{@query}\"\n\t\tputs \"version: #{@version}\"\n\t\tputs \"---------------- headers ----------------\"\n\t\tputs @headers\n\t\tputs \"---------------- body -------------------\"\n\t\tputs @body\n\tend",
"def show ( contact )\n puts \"#{contact[:name]}\"\n puts \"phone: #{contact[:phone]}\"\n puts \"email: #{contact[:email]}\"\n puts\nend",
"def print_trail_info\n puts \"Rating: #{self.rating}\"\n puts \"Distance: #{self.distance} mi\"\n puts \"Surface Type(s): #{self.surface}\"\n puts \"Brief Description: #{self.info}\\n\"\n puts \"--------------------------------------------------------------------------------\\n\"\n end",
"def showTable(db, flag)\n fieldNames = db.fields \n rows = db.data\n \n case(flag)\n when \"f\" then puts(\"*** Field Names #{fieldNames.length} *** \\n\", fieldNames, \"\\n\")\n when \"r\" then puts(\"*** Records *** \\n\", rows)\n when \"p\" then print(\"*** Records *** \\n\", rows) #debug\n end\nend",
"def display_contact\r\n\t\tputs \"ID: #{@id}\"\r\n\t\tputs \"First Name: #{@firstname}\" \r\n\t\tputs \"Last Name: #{@lastname}\"\r\n\t\tputs \"Email Address: #{@email}\"\r\n\t\tputs \"Notes on User: #{@notes}\" \r\n\tend",
"def display\n puts \"Title: #{@title}\"\n puts \"Author: #{@author}\"\n puts \"Price: #{@price}\"\n end",
"def inspect_details\n ''\n end",
"def print_database(artistProfile)\n artistProfile.each do |rapper|\n if rapper.name && rapper.name != \"\"\n puts \"Name: #{rapper.name}\"\n puts \" Hangul: #{rapper.hangul}\"\n if rapper.aka != \"\"\n puts \" As known As: #{rapper.aka}\"\n end\n puts \" Birth Name: #{rapper.full_name}\"\n puts \" Birthday: #{rapper.dob}\"\n puts \" Gender: #{rapper.gender}\"\n if rapper.hometown != \"\"\n puts \" Hometown: #{rapper.hometown}\"\n end\n if rapper.label != \"\"\n puts \" Label: #{rapper.label}\"\n end\n puts \" Position: #{rapper.position}\"\n if rapper.crew != \"\"\n puts \" Member of: #{rapper.crew}\"\n end\n puts \"---------\"\n end\n end\n end",
"def details\n return \"#{@description} : #{@extra_cost}, #{@basic_booking.details}\"\n end",
"def display_info\n \n puts \"\\nPlayer Name: #{self.name}\"\n puts \"Current Rank: #{self.rank}\"\n puts \"Position: #{self.position}\"\n puts \"School/Club: #{self.schoolclub}\"\n # binding.pry\n #if there is no class_year, nothing is displayed\n puts \"Year: #{self.class_year}\"\n #\n puts \"Height/Weight: #{self.height}, #{self.weight} \"\n puts \"Age: #{self.age}\"\n puts \"Last rank: #{self.last_rank}\"\n puts \"Scouting Report: #{self.blurb}\"\n puts \"------------------------------------\"\n end",
"def details\n data.details\n end",
"def details\n data()\n end",
"def showrecord(record, &pregrid)\n color, normal = getcolors(record)\n @grids.each do |grid|\n pregrid and pregrid.call( grid )\n rowstr = grid.rowstr { |col|\n value = ( record[col.shortname] || '' )\n value = value.gsub(/\\s+/, ' ').strip\n }\n puts [color, rowstr, normal].join\n end\n puts if @grids.length > 1\n return true\n end",
"def show_person( title, person )\n\n #puts \"#{title} #{person}\"\n puts \"#{title}\"\n show_field( 'ix', person.index, ' ' )\n show_field( 'cid', person.computing_id, ' ' )\n show_field( 'first_name', person.first_name, ' ' )\n show_field( 'last_name', person.last_name, ' ' )\n show_field( 'department', person.department, ' ' )\n show_field( 'institution', person.institution, ' ' )\n end",
"def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end",
"def details\n \"sugar: #{@sugar} | flour: #{@flour}\"\n end",
"def display_planet_details\n puts \"Name: #{@name}, Primary Export: #{@primary_export}, Year-Length: #{@year_length}\"\n end",
"def contact_details\n puts \"Contact name: #{self.contact_name}\"\n puts \"Phone number: #{self.phone}\"\n puts \"Email: #{self.email}\"\n end",
"def show_information_card\n puts \"------------------------------\"\n puts \"Name: #{@name}\"\n puts \"Address: #{@address}\"\n puts \"Email: #{@email}\"\n puts \"Random Fact: #{@random_fact}\"\n puts \"-----------------------------\"\n end",
"def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def show\n puts \"\n ID: #{id}\n Balance: #{balance}\n Date: #{open_date}\"\n end",
"def display_phone_number(emp)\n\t\tprint \"Name \t\t: #{emp.name}\t\\n\"\t\t\n\t\tprint \"Phone Number : #{emp.phone}\t\\n\"\n\tend",
"def print_fields\r\n\t\tputs \"name: #{@name}\"\r\n\t\tputs \"num_billcoins: #{@num_billcoins}\"\r\n\t\tputs \"\"\r\n\tend",
"def character_details(character)\n puts \"\"\n puts \" Name: #{character.name}\"\n puts \" Nickname: #{character.nickname}\"\n puts \"Occupation: #{character.occupation}\"\n puts \" Status: #{character.status}\"\n puts \" Portrayed: #{character.portrayed}\"\n puts \" Image URL: #{character.img}\"\n puts \"\"\n end",
"def print_fields\r\n\t\tputs \"from_address: #{@from_address}\"\r\n\t\tputs \"to_address: #{@to_address}\"\r\n\t\tputs \"num_billcoins: #{@num_billcoins}\"\r\n\t\tputs \"\"\r\n\tend",
"def show(account)\n matches = @db.find(account)\n if matches.size > 0 then\n matches.each_with_index do |match,i|\n hsay \"#{sprintf(\"%3d\",i + 1)}. #{match.title}\", :header\n max_name_length = match.max_field_length + 1\n match.each do |name,value|\n next if name == \"title\"\n next if value.length == 0\n\n name_out = name.rjust(max_name_length)\n @highline.say(\"<%= color(%Q{#{name_out}}, :name) %> <%= color(':',:separator) %> \")\n\n if match.private_field?(name) then\n @highline.ask(\n \"<%= color(%Q{#{value}},:private) %> <%= color('(press any key).', :prompt) %> \"\n ) do |q|\n q.overwrite = true\n q.echo = false\n q.character = true\n end\n\n @highline.say(\"<%= color(%Q{#{name_out}}, :name) %> <%= color(':',:separator) %> <%= color('#{'*' * 20}', :private) %>\")\n else\n hsay value, :value\n end\n end\n @stdout.puts\n end\n else\n hsay \"No matching records were found.\", :information\n end\n end",
"def show\n puts @name\n puts @quantity\n end",
"def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end",
"def details\n \"sugar: #{@sugar} / butter: #{@butter}\"\n end",
"def print_contents\n\t\tputs \"Artist: %s\" % [@artist]\n\t\tputs \"Album: %s\" % [@title]\n\t\tputs \"Released: %s\" % [@year]\n\n\t\tif @cd_count > 0\n\t\tputs \"CD(%d): %s\" % [@cd_count, @cd_id]\n\t\tend\n\n\t\tif @tape_count > 0\n\t\tputs \"Tape(%d): %s\" % [@tape_count, @tape_id]\n\t\tend\n\n\t\tif @vinyl_count > 0\n\t\tputs \"Vinyl(%d): %s\" % [@vinyl_count, @vinyl_id]\n\t\tend\n\n\tend",
"def printer\n puts \" \" + @bio\n end",
"def show\n send_record_data(TaliaCore::DataTypes::DataRecord.find(params[:id]))\n end",
"def detail\n output = []\n detail_fields.each do |field_name|\n output << [field_name.to_s, field(field_name).to_s]\n end\n\n output\n end",
"def print\n unless success?\n return nil\n end\n nlen = \"Name\".length\n clen = \"Craft\".length\n @data['people'].each do |p|\n nlen = p['name'].length > nlen ? p['name'].length : nlen\n clen = p['craft'].length > clen ? p['craft'].length : clen\n end\n\n print_header(nlen, clen)\n @data['people'].each do |p|\n print_line(nlen, p['name'], clen, p['craft'])\n end\n end",
"def details\n\t\"#{assigned_to} - #{status} - #{start_date} - #{description} - #{location} - #{Client.find(client_id).name}\"\nend",
"def print_info\n\n puts \"\\e[H\\e[2J\" # clear terminal screen\n\n # print the listing title\n print \"#{@@white}Job Title: #{@@green}#{self.title}\\n\"\n\n\n # print the time left to bid\n print \"\\t#{@@white}Time Left: #{@@green}#{self.time_left}\\n\"\n\n # print the budget for the job if valid\n if self.budget\n print \"\\t#{@@white}Budget: #{@@green}#{self.budget}\\n\"\n end\n\n # print the tags associated with the listing\n print \"\\t#{@@white}Tags: #{@@green}#{self.tags.join(',')}\\n\"\n\n # print the number of bids if valid\n if self.bids\n print \"\\n\\t#{@@white}Bids: #{@@green}#{self.bids}\\n\"\n end\n\n # print the average bid if valid\n if self.avg_bid\n print \"\\t#{@@white}Average Bid: #{@@green}#{self.avg_bid}\\n\"\n end\n\n # display the summary of bids at the momment\n print \"\\t#{@@white}Bid Summary: #{@@green}#{self.bid_summary}\\n\" if self.bid_summary\n\n # if we don't have the main description then print the short_description otherwise print the main description\n print \"\\t#{@@white}Description: \\n#{@@green}\"\n if self.description == nil\n # print \"#{self.short_description}\\n\\n\".green # put a .each_line block here and add \\t\\t to space it out properly\n desc = self.short_description\n else\n # print \"#{self.description}\\n\\n\".green\n desc = self.description\n end\n\n # fix the formating issues by indenting each line with tabs twice\n desc.each_line {|line| print \"\\t\\t#{@@green}#{line}\\n\"}\n\n print \"#{@@reset}\"\n end",
"def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end",
"def print_details\n puts \"#{@dog_walker.name} walked #{@dog.name} for #{length_in_minutes} minutes.\"\n end",
"def display_book\n\t\tputs \"Author: #@author, Title: #@title, Publisher: #@publisher, Year: #@year, Location: Shelf: #@shelf_num\"\n\tend",
"def display\n print(\"Card: #{@id} \")\n print(\"Number: #{@number} \")\n print(\"Color: #{@color} \")\n print(\"Shape: #{@shape} \")\n puts(\"Shade: #{@shade}\")\n end",
"def print_details\n\n# @stud = [@student_name, @student_about]\n# @coa = [@coach_name, @coach_bio]\n puts \"\\nWorkshop - #{self.date} - Venue: #{self.venue}\"\n puts \"\\nStudents\"\n # puts \"#{self.add_participant(@student_name)}\"\n @student_name.each do |mems|\n puts \"#{mems} - #{@student_about[0]}\"\n end\n #end\n # puts \"Coaches\"\n # @coach_name.each do |memc|\n # puts \"#{memc[0]} - #{memc[1]}\"\n # end\n end",
"def process(record)\n $stdout.puts record\n end",
"def details\n puts \"This is an Oreo cookie with #{sugar_amount}g of sugar, #{@flour_amount}g of flour and #{filling_type} filling.\"\n end",
"def inspect\n \"#<#{self.class}(layout: #{self.class.layout}) record_id: #{__record_id.inspect} #{inspect_attributes}>\"\n end",
"def record_edit_display\n \"1. Name: #{name}\\n\"\\\n \"2. Email: #{email}\\n\"\\\n \"3. Library: #{libraries_edit_display}\"\n end",
"def heading\n\t\t\"Details\"\n\tend",
"def print\n puts @subject\n puts @text\n end",
"def inspect\n \"(each_record at #{source_location})\"\n end",
"def inspect\n \"(each_record at #{source_location})\"\n end",
"def details\n @attributes[:details]\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_prescription.details\n end",
"def display_info_detailed(locations,products)\n puts \"\\n=======STORE INFO===========\"\n puts \"Store ID: #{@id}\"\n puts \"Store Name: #{@name}\"\n puts \"Description: #{@description}\"\n puts \"Location List: #{@location_list}\"\n #Detailed Breakdown\n show_store_inventory(locations,products)\n end",
"def get_detail\n return self.inspect\n end",
"def show\n \"\\t#{@line}: #{first_line}\"\n end",
"def details\n return @details\n end",
"def details\n return @details\n end",
"def details\n return @details\n end",
"def display_character_blah\n \n puts \"Name: #{name}\"\n puts \"Bio: #{description}\"\n end",
"def display\n puts self\n end",
"def printstore\n @output = \"\"\n @output << \"Store Name: #{name}\\n\"\n @output << \"Store Number: #{storenum}\\n\"\n @output << \"Store Location: #{loc}\\n\"\n @output << \"\\t Latitude: #{lat}\\n\"\n @output << \"\\t Longitude: #{long}\\n\"\n end",
"def details\n #\"#{title} #{active} x: #{ x },q: #{ q },z: #{ z },r: #{ r },y: #{ y }\"\n \"#{title} #{active} , q: #{ q },z: #{ z },r: #{ r } \"\n end",
"def detailed\n if (@data.length > 0)\n mygrade = grade || \"\"\n puts \"#{@type}: #{mygrade}\"\n for datum in @data\n puts \"\\t#{datum}\"\n end \n return true\n end\n end"
] |
[
"0.7590206",
"0.7385059",
"0.7381572",
"0.73185515",
"0.7259663",
"0.7201984",
"0.7184323",
"0.7173403",
"0.715688",
"0.71248543",
"0.7067355",
"0.70450807",
"0.702733",
"0.69798493",
"0.6913411",
"0.68935263",
"0.68643063",
"0.68583214",
"0.6857899",
"0.6818568",
"0.6794095",
"0.6761",
"0.67450565",
"0.67409",
"0.6706088",
"0.67057157",
"0.6693665",
"0.66838795",
"0.66652626",
"0.66652626",
"0.6645145",
"0.66322446",
"0.6619612",
"0.6612587",
"0.66068894",
"0.6581518",
"0.6530017",
"0.65235096",
"0.6498269",
"0.6495788",
"0.6490643",
"0.6489029",
"0.6482014",
"0.6470569",
"0.6470484",
"0.6463658",
"0.64623654",
"0.6454958",
"0.643984",
"0.64202654",
"0.64188856",
"0.64162105",
"0.6394936",
"0.63852674",
"0.6382675",
"0.63657516",
"0.63541275",
"0.6343674",
"0.6342633",
"0.63356185",
"0.63285303",
"0.63051736",
"0.6301763",
"0.62982947",
"0.62939674",
"0.6283488",
"0.62753206",
"0.6275004",
"0.6263187",
"0.62466806",
"0.6242732",
"0.6234091",
"0.6226483",
"0.62260795",
"0.6223372",
"0.6218398",
"0.6212942",
"0.62106824",
"0.61902225",
"0.61892384",
"0.6187569",
"0.6187222",
"0.6184657",
"0.6183537",
"0.6183355",
"0.6183148",
"0.6182655",
"0.6182655",
"0.6169295",
"0.6164739",
"0.615808",
"0.6156337",
"0.6155689",
"0.615302",
"0.615302",
"0.615302",
"0.61492056",
"0.6146284",
"0.61447936",
"0.612518",
"0.6120605"
] |
0.0
|
-1
|
Validates the size of an uploaded picture.
|
def picture_size
if picture.size > 5.megabytes
errors.add(:picture, "should be less than 5MB")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n errors.add(:picture, 'should be less than 10MB') if picture.size > 10.megabytes\n end",
"def picture_size\n errors.add(:picture, 'should be less than 5 MB') unless picture.size < 5.megabytes\n end",
"def picture_size\n if picture.size > 2.megabytes\n errors.add(:picture, \"should be less than 2MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes # or self.picture.size\n errors.add(\"File size cannot be bigger than 5MB\")\n end\n end",
"def picture_size\n errors.add :picture, t(\"upload_image_fail_msg\") if\n picture.size > Settings.limit_size_image.megabytes\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"Image file size should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, 'should be less than 5MB')\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\") #this never shows up\n end\n end",
"def check_file_size\n valid?\n errors[:image_file_size].blank?\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n errors.add(:picture, \"should be less than 5MB\") if picture.size > 5.megabytes\n end",
"def picture_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if attached_file.size > 200.kilobytes\n errors.add(:attached_file, 'should be less than 200 KB')\n end\n end",
"def picture_size\n if picture.size > 15.megabytes\n errors.add(:picture, \"should be less than 15MB\")\n end\n end",
"def picture_size\n #errors.add(:image, 'should be less than 1MB') if image.size > 1.megabytes\n end",
"def picture_size\n if picture.size > 2.megabytes\n errors.add(:picture, \"should be less than 2MB\")\n end\n end",
"def picture_size\r\n if picture.size > 5.megabytes\r\n errors.add(:picture, \"should be less than 5MB\")\r\n end\r\n end",
"def picture_size\n errors.add(:picture, \"Settings.review.picture_size\") if\n picture.size > Settings.review.picture.megabytes\n end",
"def picture_size\n \t\tif picture.size > 5.megabytes\n \terrors.add(:picture, \"should be less than 5MB\")\n \t\tend\n \tend",
"def picture_size\n if picture.size > 10.megabytes\n errors.add(:picture, \"should be less than 10MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n\tif picture.size > 5.megabytes\n\terrors.add(:picture, \"should be less than 5MB\")\n\tend\nend",
"def picture_size\n \tif picture.size > 5.megabytes\n \t\terrors.add(:picture, \"should be less than 5MB\")\n \tend\n \tend",
"def picture_size\n if picture.size > 10.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n \tif picture != nil\n \t\tif picture.size > 20.megabytes\n \t\terrors.add(:picture, \"I like HD, 4K stuff too but sheesh, photo's should be less than 20MB\")\n \t\tend\n \t\tend\n end",
"def picture_size\n if picture.size > 20.megabytes\n errors.add(:picture, \"I like HD, 4K stuff too but sheesh, photo's should be less than 20MB\")\n end\n end",
"def picture_size\n if picture.size > 8.megabytes\n errors.add(:picture, \"should be less than 8MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5Mb\")\n end\n end",
"def picture_size\n if picture.size && picture.size > 3.megabytes\n errors.add(:picture, \"should be less than 3MB\")\n end\n end",
"def picture_size\n \tif picture.size > 5.megabytes\n \t\terrors.add(:picture, \"should be less than 5MB\")\n \tend\n end",
"def picture_size\n if picture.size > 15.megabytes\n errors.add(:picture, \"should be less than 15MB\")\n end\n end",
"def picture_size\n if picture.size > 3.megabytes\n errors.add(:picture, \"should be less than 3MB\")\n end\n end",
"def picture_size\n if picture.size > 3.megabytes\n errors.add(:picture, \"should be less than 3MB\")\n end\n end",
"def picture_size\n \t\tif picture.size > 5.megabytes\n \t\t\terrors.add(:picture, \"should be less than 5MB\")\n \t\tend\n \tend",
"def picture_size\n \t\tif picture.size > 5.megabytes\n \t\t\terrors.add(:picture, \"should be less than 5MB\")\n \t\tend\n \tend",
"def image_size\n if picture.size > 1.megabytes\n errors.add(:picture, \"should be less than 1MB\")\n end\n if background.size > 2.megabytes\n errors.add(:background, \"should be less than 2MB\")\n end\n end",
"def image_size\n if picture.size > 1.megabytes\n errors.add(:picture, \"should be less than 1MB\")\n end\n if background.size > 2.megabytes\n errors.add(:background, \"should be less than 2MB\")\n end\n end",
"def picture_size\n if(picture.size > Settings.picture.default.megabytes)\n errors.add(:picture, Settings.picture.errors)\n end\n end",
"def picture_size\n\t\tif picture.size > 5.megabytes\n\t\t\terrors.add(:picture, \"should be less than 5MB\")\n\t\tend\n\tend",
"def picture_size\n if picture.size > 3500.kilobytes\n errors.add(:picture, \"should be less than 3.5MB\")\n end\n \n end",
"def picture_size\n\tif picture.size > 5.megabytes\n\terrors.add(:picture, \"should be less than 5MB\")\n\tend\n\tend",
"def picture_size\n if avatar.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture_status.size > 5.megabytes\n errors.add(:picture_status, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if photo_url.size > 5.megabytes\n errors.add(:photo_url, \"should be less than 5MB\")\n end\n end",
"def picture_size\n return if picture.size <= 5.megabytes\n errors.add(:picture, t(\"model.micropost.picture_size.error\"))\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def validate_photo_dimensions\n dimensions = Paperclip::Geometry.from_file(photo.to_file(:original))\n errors.add(:photo, \"Image dimensions were #{dimensions.width.to_i}x#{dimensions.height.to_i}, they must be exactly #{self.photo_dimensions_string}\") unless dimensions.width >= PHOTO_WIDTH && dimensions.height >= PHOTO_HEIGHT\n end",
"def picture_size\n if image.size > 5.megabytes\n errors.add(:image, \"Dung lượng file vượt quá 5MB\")\n end\n end",
"def picture_size\n if picture.size > 1.megabytes\n errors.add(:picture, \"1MB未満にする必要があります\")\n end\n end",
"def validate_image_length\n if upload_length || save_to_temp_file\n if upload_length > MO.image_upload_max_size\n errors.add(:image,\n :validate_image_file_too_big.t(\n size: upload_length,\n max: MO.image_upload_max_size.to_s.sub(/\\d{6}$/, \"Mb\")\n ))\n result = false\n else\n result = true\n end\n end\n result\n end",
"def picture_size\n if picture.size > Settings.image.upload_micropost_size .megabytes\n errors.add :picture,\n I18n.t(\"micropost.flash.danger_image_upload_too_large_size\",\n size: Settings.image.upload_micropost_size)\n end\n end",
"def validate_size\n if attachment.present? && attachment.file.size > MAX_ATTACHMENT_SIZE\n errors.add(:attachment, :too_large)\n end\n end"
] |
[
"0.8246438",
"0.8246069",
"0.8203719",
"0.8203224",
"0.8199266",
"0.8188133",
"0.8187386",
"0.8179088",
"0.81592035",
"0.81588674",
"0.8158672",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.8143774",
"0.81267804",
"0.8125886",
"0.81034553",
"0.8086152",
"0.80746686",
"0.80457693",
"0.80301785",
"0.8022583",
"0.8019067",
"0.80163944",
"0.8009867",
"0.8007317",
"0.8006194",
"0.7984142",
"0.7978438",
"0.79706424",
"0.7967986",
"0.7965878",
"0.7963293",
"0.7956712",
"0.7943698",
"0.7943698",
"0.7934009",
"0.7934009",
"0.7930718",
"0.7930718",
"0.792467",
"0.79197633",
"0.7896614",
"0.7889941",
"0.78728646",
"0.7856828",
"0.7842421",
"0.7837988",
"0.777825",
"0.777825",
"0.775091",
"0.7719146",
"0.77065873",
"0.7705815",
"0.7695335",
"0.76792264"
] |
0.8011205
|
64
|
This is done just for displaying to the seller Armor will charge in their backend
|
def calculate_store_additional_armor_fee(armor_order)
amount = armor_order.unit_price * armor_order.count
armor_fee = calculate_armor_payments_fee(armor_order, amount)
toadlane_fee_percentage = Fee.find_by(:module_name => "Armor Payments").value
toadlane_fee = amount * toadlane_fee_percentage / 100
seller_charged_fee = armor_fee + toadlane_fee
# armor_order.amount is the order amount
amount_after_fee_to_seller = armor_order.amount - seller_charged_fee
armor_order.update_attributes({
seller_charged_fee: seller_charged_fee,
amount_after_fee_to_seller: amount_after_fee_to_seller
})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def card_buy\n @page_title = _('Buy_Card')\n @page_icon = 'money.png'\n\n @email = params[:email]\n @real_price = @card.balance + @cg.get_tax.count_tax_amount(@card.balance)\n @send_invoice = params[:send_invoice]\n @total_tax_name = Confline.get_value('Total_tax_name')\n @description = params[:description].to_s\n end",
"def info_premium\n render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200\n end",
"def new_charge\n end",
"def sell_pending\n end",
"def attemp_buying\n\n end",
"def buyer\n @line_item = current_member.line_items.find(params[:id])\n @current_item = \"my_purchases\"\n @active_tab = \"shop_tab\"\n shop_navigation\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @line_item.to_xml }\n end\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n @products = website.products\n render_template\n end",
"def show\n # DEMO_EMAILS allows interal salespeople to continue using the same voucher and keep pushing the 'redeem button' during demos\n if @voucher.customer.demo_account\n render :show\n elsif @voucher.redeemed\n if @voucher.within_redemtion_period?\n # Not sure why the time is 8hrs ahead on Heroku's servers. Something with timezone for sure\n @redemtion_expiration = @voucher.redeemed.localtime + Voucher::REDEMPTION_PERIOD + 1.hour\n render :good\n else\n render :no_good\n end\n else\n render :show\n end\n end",
"def buyer\n starter\n end",
"def buy_product\n products = @seller.show_product_info \n product_buy = @view.buy_product(products)\n @total_price = @seller.save_buy_a_product(product_buy)\n @view.buy_status(@total_price)\n input = @view.menu(\"2\")\n seller_actions(input) \n end",
"def bought?\n # paym\n end",
"def pre_pay_offered\n end",
"def purchase\n if user_signed_in?\n \n card = current_user.card\n #テーブルからpayjpの顧客IDを検索\n @user = User.find(@item.seller_id)\n unless @item.seller_id == @item.buyer_id\n redirect_to root_path\n else\n end\n \n if card.blank?\n #登録された情報がない場合にカード登録画面に移動\n redirect_to controller: \"card\", action: \"new\"\n else\n Payjp.api_key = ENV[\"PAYJP_PRIVATE_KEY\"]\n #保管した顧客IDでpayjpから情報取得\n customer = Payjp::Customer.retrieve(card[\"customer_id\"])\n #保管したカードIDでpayjpから情報取得、カード情報表示のためインスタンス変数に代入\n @default_card_information = customer.cards.retrieve(card.card_id)\n @card_brand = @default_card_information.brand\n @card_src = \"Visa.png\"\n end\n\n else\n redirect_to new_user_session_path\n end\n\n end",
"def offer_display( hotel_name, offer_available , normal_rate, normal_tax )\n o_from, o_to, o_rate = offer_available.start, offer_available.end , offer_available.rate.to_i \n visit_time_period = ( @to - @from ).to_i + 1\n puts \"\\n\\n****Amazing choice, you are walking in during a special season**** \n '#{offer_available.name.upcase}' from #{o_from.strftime(\"%m/%d/%Y\")} till #{o_to.strftime(\"%m/%d/%Y\")} at #{hotel_name}\"\n bill = calculate_bill( hotel_name, visit_time_period, o_to, o_from, o_rate, normal_rate, normal_tax )\n puts \"\\nStay at #{hotel_name} \\n From : #{from.strftime(\"%m/%d/%Y\")} \\t\\t\\t To : #{to.strftime(\"%m/%d/%Y\")} (including offer)\\n TOTAL : #{bill.to_i}\"\n end",
"def cost\n purchase_cost\n end",
"def cost\n purchase_cost\n end",
"def successful_purchase_response\n end",
"def receipt\n end",
"def receipt\n end",
"def new \n @stripe_btn_data = {\n key: \"#{ Rails.configuration.stripe[:publishable_key] }\",\n description: \"Premium Membership - #{current_user.name}\",\n amount: amount_for_upgrade\n }\n end",
"def price action\n result = api_customers_command\n exchange_rate = result[:exchange_rate]\n exchange_rate.to_f\n end",
"def show\n if @deal.profile.boxberry_office_id.present? && @deal.weight.present? && @deal.sell.present?\n @cost = shipping_cost(@deal.profile.boxberry_office_id.to_i, @deal.weight.to_i, 1, 0, @deal.sell.to_i)\n else\n @cost = 0\n end\n end",
"def show\n #mostra o nome ao inves do id\n @supplier = Supplier.find(@payment.supplier_id)\n end",
"def reserved(item, buyer)\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: @buyer.email\n end",
"def needs_handling_charge?\n true\n end",
"def invoice!\n if self.chosen_presenter && self.rate \n Xero.invoice_booking(self)\n end\n end",
"def pay_with_credits\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n current_user.update_attributes(credits: [email protected])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def show\n @sale = Sale.find(params[:id])\n gateway = ActiveMerchant::Billing::LitleGateway.new\n \n amount = @sale.amount\n \n\n options = { \n\t\t:billToAddress => {\n\t\t\t \t :name => [@sale.firstname, @sale.lastname].compact.join(' '),\n\t\t\t\t :address1 => @sale.address1,\n\t\t\t\t :city => @sale.city,\n\t\t\t\t :state => @sale.state,\n\t\t\t\t :country => ('US' or @sale.country),\n\t\t\t\t :zip => @sale.zip,\n\t\t\t\t :email => @sale.email}\t\n\t\t}\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :first_name => @sale.firstname,\n :last_name => @sale.lastname,\n :number => @sale.cardnumber,\n :month => @sale.cardmonth,\n :year => @sale.cardyear,\n :verification_value => @sale.cvv)\n\n \nif credit_card.valid?\n response = gateway.purchase(amount,credit_card,options)\n\n if response.success?\n @post = \"Successfully charged an amount of $#{sprintf(\"%.2f\", amount.to_f / 100)} to the credit card #{credit_card.display_number}\"\n @litletxnid = response.params['litleOnlineResponse'].saleResponse.litleTxnId \n else\n @message=response.message\n render :action => 'error2'\n end\nelse\nrender :action => 'error1' \nend\nend",
"def place_order\n \n @job = Job.find(params[:job_id])\n fetch_decrypted(@job)\n \n if @logged_user.credits > 0\n render(:action => \"confirm_order\")\n return\n else\n #place order will have our paypal buttons\n render(:action => \"place_order\")\n return\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"Buying credits for fun?\"\n redirect_to :action => \"profile\"\n end",
"def share_seller\n if price == 0.0\n 100.0\n else\n cost_price / price * 100\n end\n end",
"def franchisee_royalty_pay_slip\n \n end",
"def chargeable? listing\n listing.seller?(@user) && listing.new? \n end",
"def product_info_seller\n products = @seller.show_product_info \n choice = @view.display_info_product(products)\n choice == \"1\" ? buy_product : input = @view.menu(\"2\") \n seller_actions(input)\n end",
"def show\n pr params\n pr payu_verify_return\n # IF payed, push to queue - onl once\n # todo\n end",
"def receipt\r\n if self.qty >= 1\r\n puts \"#{self.drink} x#{self.qty} @ $#{'%.2f' % self.price} each: $#{'%.2f' % self.total_cost}\"\r\n end\r\n end",
"def action(**args)\n\t\t\targs[:player].decide(:consider_purchase, property: self) if args[:player].balance >= cost unless @owner\n\t\t\tsuper\n\t\tend",
"def sold\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: @buyer.email\n end",
"def create\n @title = \"Bakery Market | Purchase Credits\"\n @google_fonts = \"Josefin+Slab|Dancing+Script|Lato\"\n @stylesheet = \"users\"\n @order = Order.new(params[:order])\n if params[:id] < 4.to_s\n @service_plan = ServicePlan.find(params[:id])\n else\n @service_plan = ServicePlan.find(3)\n end\n @order.service_plan_id = @service_plan.id\n @order.ip_address = request.remote_ip\n @order.user_id = current_user.id\n if @order.save\n if @order.purchase(@service_plan.id)\n @meals_remaining = current_user.meals_remaining + @service_plan.meals_included\n @total_credits_purchased = current_user.total_credits_purchased + @service_plan.meals_included\n current_user.update_attributes(:meals_remaining => @meals_remaining, :total_credits_purchased => @total_credits_purchased)\n flash[:notice] = \"Thanks for your order. You're all set.\"\n redirect_to root_url\n UserMailer.purchase_complete(current_user, @service_plan).deliver\n else\n render :action => \"failure\"\n end\n else\n render :action => \"new\"\n end\n end",
"def after_redeem() end",
"def reserve_product\n \n method = params[:method]\n type = params[:type]\n \n #send out our reserve product notice.\n #find our object description\n if type == 'resource'\n object = Resource.find(params[:id])\n\t\n elsif type =='manifestation'\n object = Manifestation.find(params[:id])\n else\n logger.debug(\"DEBUG: RESERVE: reserve object type not recognised!\")\n return false\n end\n \n if !object.blank? && !method.blank? && !type.blank?\n logger.debug(\"DEBUG: RESERVE: About to send email\")\n \n\tusername = @login.username\n\tusername = @login.username.to_s + \"<[email protected]>\" unless username.to_s=~/\\@/\n\t\n\tHireNotice.deliver_email_hire_notice(username, @login.id, type, object.id, object.frbr_ui_desc, '', method)\n else\n\tlogger.debug(\"DEBUG: RESERVE: ERROR \")\n end\n \nend",
"def chargeable?; true; end",
"def market\n end",
"def show\n @order = Spree::Order.find(params[:order_id])\n @gateway = @order.available_payment_methods.find{|x| x.id == params[:gateway_id].to_i }\n\n if @order.blank? || @gateway.blank?\n flash[:error] = I18n.t(\"invalid_arguments\")\n redirect_to :back\n else\n\t\t\t@pay_type = @gateway.options[:pay_type]\n\t\t\t@price = sprintf(\"%.2f\",@order.total.to_f).to_f\n\t\t\t@currency = @gateway.options[:currency]\n\t\t\t@convert_currency = @gateway.options[:convert_currency] ? 'yes':'no'\n\t\t\t@price_final = @gateway.options[:price_final] ? 'yes':'no'\n\t\t\t@user_email = @order.email\n\t\t\t@md5 = Digest::MD5.hexdigest([@gateway.options[:pay_type],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\"%.1f\",@order.total.to_f).to_f,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@currency,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\[email protected],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@convert_currency,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\[email protected][:priv_code]].join(';'))\n\n render :action => :show\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n @binder = Binder.find(@subscription.binder_id)\n \n authorize! :subscribe, Binder.find(@subscription.binder_id)\n \n @standardPlan = Stripe::Plan.retrieve('standard')\n @total = 0.0\n \n if not @subscription.customer_id.nil?\n @customer = Stripe::Customer.retrieve(@subscription.customer_id)\n @card = @customer.default_card.nil? ? nil : @customer.cards.retrieve(@customer.default_card)\n @subtotal = @customer.subscription.plan.amount\n @discount = 0.0\n \n if not @customer.discount.nil?\n @discount = @customer.discount.coupon.amount_off.nil? ?\n @subtotal * (@customer.discount.coupon.percent_off / 100.00) \n : @customer.discount.coupon.amount_off\n end \n @total = @subtotal - @discount\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end",
"def charge!(cents, idempotency_key)\n # we are not charging anything - customer pays via bank transfer\n { paymentmethod: payment_info }\n end",
"def charge\n subtotal * 0\n end",
"def buyer_invoices\n logger.info(\"Will send email of BUYER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"[email protected]\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_buyer_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def purchase_sub_existing_choose\n @plan = params[:sec][:plan] #now this is an integer, my_plan_id\n @planobject = Plan.find_by_my_plan_id(@plan)\n @events_number = @planobject.events_number \n # if user is a stripe customer (even though no acticve sub), want to allow him to use existing card\n if !current_user.customer_id.blank? \n c = Stripe::Customer.retrieve(current_user.customer_id)\n @last4 = c.cards.data.first.last4\n @cardtype = c.cards.data.first.type\n end \n\nend",
"def thank_you\n user = session[:user]\n user.zip = params[:zip]\n \n start_date = Date.today\n start_date += 61\n \n response = create_autorrecuring_subscription(start_date, user, params[:card_number], params[:month], params[:year], \n params[:cvc], params[:card_type], params[:city], params[:state],\n params[:billing_address_1], params[:billing_address_2])\n if response.success?\n session[:errors] = nil\n session[:user] = nil\n user.arb_subscription_id = response.subscription_id\n user.arb_status = AuthorizeNet::ARB::Subscription::Status::ACTIVE\n user.billing_information_id = user.add_billing_information(params[:fullname], params[:billing_address_1] ,\n params[:billing_address_2], params[:city], params[:state],\n params[:zip]).id\n user.save\n else\n puts \"Failed to make purchase. \" + response.response_reason_code + \" - \" + response.response_reason_text\n user.errors.clear()\n user.errors.add(:transaction, response.response_reason_text)\n session[:errors] = user.errors\n redirect_to admin_signup_step3_path\n end \n\n \n end",
"def payment_term; end",
"def existing_user_purchase_select\n @number = params[:peu][:number].to_i\n if(params[:coupon])\n @coupon = params[:coupon]\n @coupon_object = Coupon.find_by_free_page_name(@coupon)\n end\n @coupon_object = session[:coupon] if session[:coupon]\n @coupon = session[:coupon].free_page_name if session[:coupon]\n\n # if user is a stripe customer, want to allow him to use existing card\n if !current_user.customer_id.blank? \n c = Stripe::Customer.retrieve(current_user.customer_id)\n @last4 = c.cards.data.first.last4\n @cardtype = c.cards.data.first.type\n end \n\n\n if @number.to_i <= tier_one_limit \n @cost = @number.to_i*tier_one_price*100 #in cents\n @price = \"$#{tier_one_price}\"\n \n end \n if @number.to_i > tier_one_limit && @number.to_i <= tier_two_limit \n @cost = @number.to_i*tier_two_price*100 #in cents\n @price = \"$#{tier_two_price}\"\n\n end \n if @number.to_i > tier_two_limit\n @cost = @number.to_i*tier_three_price*100 #in cents\n @price = \"$#{tier_three_price}\"\n\n end \n\n\n if is_valid_percent_off_coupon(@coupon)\n @old_cost = @cost #in cents\n @new_price = (@cost.to_f * (100 - @coupon_object.percent_off)/100) #in cents\n @cost = @new_price # in cents\n flash.now[:success] = \"Your promo code has been applied!\"\n #redirect_to existing_user_purchase_select_path( { :peu => { :number => @number }}, :coupon => @coupon)\n \n else #could not find that coupon\n #preserve the values (applies if someone tries to change the number of event pages after applying the code)\n @coupon = nil \n # redirect_to existing_user_purchase_select_path( { :peu => { :number => @number }})\n\n end\n\nend",
"def charge(opts)\n\n amount = opts[:amount]\n currency = opts[:currency]\n\n end",
"def buyer_waitlisted(shop, product, buyer)\n @shop = shop\n @product = product\n @buyer = buyer\n mail to: buyer.email, subject: \"[#{shop.name}] You're in line for #{product.title}\"\n end",
"def show\n @subscriptions = @bundle.subscriptions\n @prebundled_cost = @bundle.prebundled_cost_in_cents/100.0\n end",
"def sell_confirmed\n end",
"def purchase_show\n if params[:product_id] == '0'\n @items = session[:cart]\n else\n @items = []\n @items << { 'product' => params[:product_id], 'quantity' => session[:quantity] }\n end\n @sum = 0\n @count = 0\n @items.each do |item|\n product = Product.find(item['product'])\n @sum += product.price * item['quantity'].to_i\n @count += item['quantity'].to_i\n end\n @address = BillAddress.find(params[:bill_address_id])\n @user = current_user\n end",
"def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n :description => 'Prlayvous Ticket',\n :currency => 'usd'\n )\n\n #After paying with Stripe, consumers are prompt to confirm their shipping address.\n redirect_to edit_consumer_order_path(current_consumer, @order)\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to charges_path\n end",
"def settle_item_purchase(seller, buyer, item)\n seller.credits += item.price + Integer((item.price * SELL_BONUS).ceil)\n buyer.credits -= item.price\n end",
"def display_price\n Spree::Money.new(new_amount, {currency: currency})\n end",
"def buyer\n # the user posting the request\n offer.posting.user\n end",
"def seller_invoices\n logger.info(\"Will send email of SELLER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"[email protected]\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_seller_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def book_hotel\r\n # prices in stripe are defined in cents, hence 500 => $5.00\r\n # TODO: change hard-coded price to price of specific hotel room\r\n @amount=500\r\n\r\n begin\r\n # for now, creates a new customer and (transparently) unique customer id per transaction\r\n # TODO: store customer.id in User model (this associates user with payment credentials stored by stripe)\r\n customer = Stripe::Customer.create(\r\n :email => params[:stripeEmail],\r\n :source => params[:stripeToken] # this token corresponds to the entered card details\r\n )\r\n\r\n # creates one-time charge for hotel booking\r\n charge = Stripe::Charge.create(\r\n :customer => customer.id,\r\n :amount => @amount,\r\n :description => 'Rails Stripe customer',\r\n :currency => 'usd'\r\n )\r\n redirect_to booking_complete_path\r\n\r\n rescue Stripe::CardError => e\r\n flash[:error] = e.message\r\n redirect_to hotel_booking_path\r\n end\r\n end",
"def buy!(buyer_planet, amount)\n raise GameLogicError.new(\"Cannot buy 0 or less! Wanted: #{amount}\") \\\n if amount <= 0\n amount = from_amount if amount > from_amount\n \n cost = (amount * to_rate).ceil\n buyer_source, bs_attr = self.class.resolve_kind(buyer_planet, to_kind)\n buyer_target, bt_attr = self.class.resolve_kind(buyer_planet, from_kind)\n if system?\n seller_target = nil\n else\n seller_target, _ = self.class.resolve_kind(planet, to_kind)\n end\n \n stats = CredStats.buy_offer(buyer_planet.player, cost) \\\n if seller_target.nil? && to_kind == KIND_CREDS\n \n buyer_has = buyer_source.send(bs_attr)\n raise GameLogicError.new(\"Not enough funds for #{buyer_source\n }! Wanted #{cost} #{bs_attr} but it only had #{buyer_has}.\"\n ) if buyer_has < cost\n \n # Used to determine whether to send notification or not.\n original_amount = from_amount\n \n # Subtract resource that buyer is paying with from him.\n buyer_source.send(:\"#{bs_attr}=\", buyer_has - cost)\n # Add resource that buyer has bought from seller.\n buyer_target.send(:\"#{bt_attr}=\", \n buyer_target.send(bt_attr) + amount)\n # Add resource that buyer is paying with to seller. Unless:\n # * its a system offer\n # * or #to_kind is creds and planet currently does not have an owner\n seller_target.send(\n :\"#{bs_attr}=\", seller_target.send(bs_attr) + cost\n ) unless seller_target.nil?\n # Reduce bought amount from offer.\n self.from_amount -= amount\n \n objects = [buyer_source, buyer_target]\n # We might not have seller target. See above.\n objects.push seller_target unless seller_target.nil?\n objects.uniq.each { |obj| self.class.save_obj_with_event(obj) }\n\n if from_amount == 0\n # Schedule creation of new system offer.\n CallbackManager.register(\n without_locking { galaxy },\n CALLBACK_MAPPINGS[from_kind],\n Cfg.market_bot_random_resource_cooldown_date\n ) if system?\n destroy!\n else\n save!\n end\n percentage_bought = amount.to_f / original_amount\n\n MarketRate.subtract_amount(galaxy_id, from_kind, to_kind, amount)\n\n # Create notification if:\n # * It's not a system notification\n # * Enough of the percentage was bought\n # * Sellers planet currently has a player.\n Notification.create_for_market_offer_bought(\n self, buyer_planet.player, amount, cost\n ) if ! system? &&\n percentage_bought >= CONFIG['market.buy.notification.threshold'] &&\n ! planet.player_id.nil?\n\n stats.save! unless stats.nil?\n\n amount\n end",
"def payer_purse\n params['LMI_PAYER_PURSE']\n end",
"def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #UserMailer.ordered(\"google.com\", response.params.to_s, User.find(cart.user_id), cart).deliver\n cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def display_resource(buyer)\n buyer.full_name\n end",
"def ask_price_quote\n if @order.is_reorder?\n AdministrativeMailer.delay.printer_quote(current_user, @order.number_of_books, @order.order_bw_pages, @order.order_color_pages, @order.ship_zip, @cookbook.book_binding)\n else\n AdministrativeMailer.delay.printer_quote(current_user, @order.number_of_books, @cookbook.num_bw_pages, @cookbook.num_color_pages, @order.ship_zip, @cookbook.book_binding)\n end\n end",
"def sell\n \t\t\n \tend",
"def create\n @order = Order.new(order_params)\n charge_error = nil\n\n @listing = Listing.friendly.find(params[:listing_id])\n @seller = @listing.user\n\n @order.listing_id = @listing.id\n @order.listingsku = @listing.sku\n @order.listingimage = @listing.image.url(:thumb)\n @order.listingname = @listing.name\n @order.buyer_id = current_user.id\n @order.seller_id = @seller.id\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n if @order.valid?\n if @listing.saleprice.blank? #price\n @order.price_sold = @listing.price\n @order.seller_payment = (((@listing.price * 97.1) - 30) * (@seller.sellershare * 0.0001)) #.008 to convert back to dollars\n\n begin\n charge = Stripe::Charge.create(\n :amount => (@listing.price * 100).floor,\n :currency => \"usd\",\n :card => token,\n :description => \"Charge from OutfitAdditions\"\n )\n\n rescue Stripe::CardError => e\n charge_error = e.message\n end\n if charge_error\n flash[:error] = charge_error\n render :new\n else\n @order.save\n redirect_to thankyou_path(:id => @order.id)\n AutoNotifier.orderconf_email(current_user, @order).deliver \n AutoNotifier.sellerconf_email(current_user, @seller, @order).deliver \n if [email protected]? and @seller.name != \"Outfit Additions\"\n transfer = Stripe::Transfer.create(\n :amount => (((@listing.price * 97.1) - 30) * (@seller.sellershare * 0.01)).floor, # 0.8 to convert to cents per stripe requirement. 80 percent in cents goes to seller.\n :currency => \"usd\",\n :recipient => @seller.recipient,\n :description => \"Transfer from OutfitAdditions\"\n )\n end #end transfer if saleprice is blank\n end \n else #saleprice\n @order.price_sold = @listing.saleprice\n @order.seller_payment = (((@listing.saleprice * 97.1) - 30) * (@seller.sellershare * 0.0001)) #.008 to convert back to dollars\n\n begin\n charge = Stripe::Charge.create(\n :amount => (@listing.saleprice * 100).floor,\n :currency => \"usd\",\n :card => token,\n :description => \"Charge from OutfitAdditions\"\n )\n\n rescue Stripe::CardError => e\n charge_error = e.message\n end\n if charge_error\n flash[:error] = charge_error\n render :new\n else\n @order.save\n redirect_to thankyou_path(:id => @order.id)\n AutoNotifier.orderconf_email(current_user, @order).deliver \n AutoNotifier.sellerconf_email(current_user, @seller, @order).deliver \n if [email protected]? and @seller.name != \"Outfit Additions\"\n transfer = Stripe::Transfer.create(\n :amount => (((@listing.saleprice * 97.1) - 30) * (@seller.sellershare * 0.01)).floor, #0.8 to convert to cents per stripe requirement. 80 percent in cents goes to seller.\n :currency => \"usd\",\n :recipient => @seller.recipient,\n :description => \"Transfer from OutfitAdditions\"\n )\n end #end transfer if saleprice is blank\n end\n end #if @listing.saleprice.blank\n else\n render :new\n end # end order.valid\n\n ActionController::Base.new.expire_fragment(\"homepage_p#{params[:page]}_s_#{params[:sort]}\", options = nil)\nend",
"def subscriber_notice_awaiting_payment\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'awaiting_payment'\n )\n end",
"def change_beer_view\n if params[:artisan] == \"all\"\n @artisan = params[:artisan].downcase\n else\n @artisan = params[:artisan]\n end\n if params[:style] == \"all\"\n @style = params[:style].downcase\n else\n @style = params[:style].to_i\n end\n \n if user_signed_in?\n # determine if account has multiple users and add appropriate CSS class tags\n @user = current_user\n \n # need account users for projected rating partial\n @account_users = User.where(account_id: @user.account_id)\n @account_users_count = @account_users.count\n \n # check if user has already chosen drinks\n if current_user.subscription_status == \"subscribed\"\n @next_delivery = Delivery.where(account_id: current_user.account_id, status: [\"user review\", \"admin prep next\"]).order(delivery_date: :asc).first\n @customer_drink_order = AccountDelivery.where(account_id: current_user.account_id, delivery_id: @next_delivery.id)\n @current_subscriber = true\n #set class for order dropdown button\n @customer_change_quantity = \"subscriber-change-quantity\"\n gon.page_source = \"stock\"\n else\n # find if user has an order in process\n @order_prep = OrderPrep.where(account_id: @user.account_id, status: \"order in process\").first\n if !@order_prep.blank?\n @customer_drink_order = OrderDrinkPrep.where(user_id: current_user.id, order_prep_id: @order_prep.id)\n else\n @customer_drink_order = nil\n end\n @current_subscriber = false\n @customer_change_quantity = \"nonsubscriber-change-quantity\"\n end\n end\n \n # check if user has already chosen drinks\n @customer_order = nil\n \n # get currently available drink info\n if @artisan == \"all\" && @style == \"all\"\n \n # get currently available beers to show in inventory\n @currently_available_beers = Beer.current_inventory_beers\n \n # get current inventory breweries for dropdown\n @currently_available_makers = Brewery.current_inventory_breweries\n # get currently available styles for dropdown filter\n @current_inventory_drink_style_ids = Beer.drink_style(@currently_available_beers)\n @currently_available_styles = BeerStyle.where(id:@current_inventory_drink_style_ids)\n #Rails.logger.debug(\"Styles: #{@currently_available_styles.inspect}\")\n \n # set view\n @drink_count = @currently_available_beers.count\n @artisan_count = @currently_available_makers.count\n \n # get inventory beer ids\n @inventory_beer_ids = @currently_available_beers.pluck(:beer_id)\n \n elsif @artisan != \"all\" && @style == \"all\"\n # get info about chosen artisan\n @current_artisan = Brewery.friendly.find(@artisan)\n \n # get currently available beers to show in inventory\n @currently_available_beers = Beer.current_inventory_beers.where(brewery_id: @current_artisan.id)\n \n # get current inventory breweries for dropdown\n @currently_available_makers = Brewery.current_inventory_breweries\n # get currently available styles to show in dropdown\n @current_inventory_drink_style_ids = Beer.drink_style(@currently_available_beers)\n @currently_available_styles = BeerStyle.where(id:@current_inventory_drink_style_ids)\n \n @drink_count = @currently_available_beers.count\n @artisan_count = 1\n \n # get inventory beer ids\n @inventory_beer_ids = @currently_available_beers.pluck(:beer_id)\n \n elsif @artisan == \"all\" && @style != \"all\"\n # get info about chosen style\n @current_style = BeerStyle.find_by_id(@style)\n \n # get currently available beers to show in inventory\n @currently_available_beers = Beer.current_inventory_beers\n \n # get current inventory breweries for dropdown\n @currently_available_makers = Brewery.current_inventory_breweries_based_on_style(@style)\n # get currently available styles to show in dropdown\n @current_inventory_drink_style_ids = Beer.drink_style(@currently_available_beers)\n @currently_available_styles = BeerStyle.where(id:@current_inventory_drink_style_ids)\n \n # get all related drink types\n @all_related_types = Array.new\n @all_related_types << BeerType.related_drink_type(@style)\n @all_related_types << BeerTypeRelationship.related_drink_type_one(@style)\n @all_related_types << BeerTypeRelationship.related_drink_type_two(@style)\n @all_related_types = @all_related_types.flatten.uniq\n \n # get currently available beers to show in inventory\n @currently_available_beers = Beer.current_inventory_beers.where(beer_type_id: @all_related_types)\n @current_makers = @currently_available_beers.pluck(:brewery_id).uniq\n \n @drink_count = @currently_available_beers.count\n @artisan_count = @current_makers.count\n \n # get inventory beer ids\n @inventory_beer_ids = @currently_available_beers.pluck(:beer_id)\n\n else\n # get info about chosen style and artisan\n @current_artisan = Brewery.friendly.find(@artisan) \n @current_style = BeerStyle.find_by_id(@style)\n \n # get currently available beers to show in inventory\n @currently_available_beers = Beer.current_inventory_beers.where(brewery_id: @current_artisan.id)\n \n # get current inventory breweries for dropdown\n @currently_available_makers = Brewery.current_inventory_breweries_based_on_style(@style)\n # get currently available styles to show in dropdown\n @current_inventory_drink_style_ids = Beer.drink_style(@currently_available_beers)\n @currently_available_styles = BeerStyle.where(id:@current_inventory_drink_style_ids)\n \n # get all related drink types\n @all_related_types = Array.new\n @all_related_types << BeerType.related_drink_type(@style)\n @all_related_types << BeerTypeRelationship.related_drink_type_one(@style)\n @all_related_types << BeerTypeRelationship.related_drink_type_two(@style)\n @all_related_types = @all_related_types.flatten.uniq\n \n # get currently available beers to show in inventory\n @currently_available_beers = Beer.current_inventory_beers.where(brewery_id: @current_artisan.id, beer_type_id: @all_related_types)\n \n @drink_count = @currently_available_beers.count\n @artisan_count = 1\n \n # get inventory beer ids\n @inventory_beer_ids = @currently_available_beers.pluck(:beer_id)\n \n end\n \n if user_signed_in?\n # get related user drink recommendations\n @drink_recommendations = ProjectedRating.where(user_id: @user.id, beer_id: @inventory_beer_ids).order(projected_rating: :desc).paginate(:page => params[:page], :per_page => 12)\n #Rails.logger.debug(\"Drink recommendations: #{@drink_recommendations.inspect}\")\n else\n # get related user drink recommendations\n @drink_recommendations = Inventory.where(beer_id: @inventory_beer_ids).includes(:beer).order('beers.beer_rating_one desc').uniq.paginate(:page => params[:page], :per_page => 12)\n #Rails.logger.debug(\"Drink recommendations: #{@drink_recommendations.inspect}\")\n end\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n \n end",
"def renew_account_as_agent\n @account = Account.find(params[:account_id])\n @contact = @account.contact\n @price_plans = Country.get_paid_plans_for_country(@account.country_short)\n @order_kind = 'renewal'\n\n respond_to do |format|\n format.html {render(layout: 'management')}\n end\n end",
"def redeem\n #TO BE IMPLEMENTED\n end",
"def final_price(order)\n @greeting = \"Hi\"\n @order = order;\n\n mail to: order.email\n end",
"def claim_your_reward\n InviteMailer.claim_your_reward\n end",
"def offer\n end",
"def offer\n end",
"def offer\n end",
"def investor\n end",
"def redeem_admin\n # @voucher set from the filter\n @voucher.status = params[:status]\n if Voucher::REDEEMED == params[:status]\n @voucher.redemption_date = Time.zone.now\n else\n # Unusual if another status, so record\n @voucher.notes += \"\\nStatus changed to #{params[:status]} on #{Time.zone.now.try(:strftime, ApplicationHelper::DATE_FORMAT)}\"\n end\n \n if @voucher.save\n flash[:notice] = I18n.t('voucher_success')\n \n # Send survey on redemption, and a notice on unredemption (saying they can still use the voucher)\n # Do nothing on return; presumably the customer has handed it in\n if Voucher::REDEEMED == @voucher.status\n UserMailer.delay.survey_email(@voucher.order)\n elsif Voucher::AVAILABLE == @voucher.status\n UserMailer.delay.unredeem_email(@voucher)\n elsif Voucher::RETURNED == @voucher.status\n # Credit Macho Bucks\n bucks = @voucher.build_macho_buck(:user_id => @voucher.order.user.id, :amount => @voucher.order.amount, :notes => params[:notes])\n if !bucks.save\n flash[:alert] = 'Unable to credit macho bucks!'\n end\n UserMailer.delay.macho_bucks_voucher_email(bucks)\n end\n else\n flash[:alert] = I18n.t('voucher_failure')\n end\n \n @vouchers = []\n # Calculate gift certificates that they have given\n @pending_gifts = GiftCertificate.pending.where('user_id = ?', current_user.id)\n @redeemed_gifts = GiftCertificate.redeemed.where('user_id = ?', current_user.id)\n \n render 'index'\n end",
"def perform\n @previousMonth = (Date.today - 1.months).strftime(\"%Y-%m\")\n\n \t# Only exec with subscription status is active\n # Subscription subscription_type == 1 is free trial\n # If user upgrade subscription, and then subscription_type update to 2 is invidual account\n # Update subscription_type == 2 on production, because in test we manual modify account\n\t\tSubscription.where(status: 1).each do |subscription|\n\n\t\t\t# Find user\n\t\t\t@user = User.find(subscription.user_id)\n\n # Get bandwidth & storage usage on previous month\n if @user.bandwidths.present? && @user.bandwidths.find_by(monthly: @previousMonth).present?\n bwdUsage = @user.bandwidths.find_by(monthly: @previousMonth).bandwidth_usage * 1000.00\n else\n bwdUsage = 0\n end\n\n if @user.storages.present? && @user.storages.find_by(monthly: @previousMonth).present?\n stgUsage = @user.storages.find_by(monthly: @previousMonth).storage_usage * 1000.00\n else\n stgUsage = 0\n end\n\n # Calculator usage pricing\n @totalPrice = (@user.subscription.stg_price * (stgUsage / 1000000000.00)) + (@user.subscription.bwd_price * (bwdUsage / 1000000000.00))\n\n @description = \"Delivery Appliance running in global: #{ApplicationController::FormatNumber.new(bwdUsage).formatHumanSize()}, and File Appliance in global: #{ApplicationController::FormatNumber.new(stgUsage).formatHumanSize()} (Source:#{Package.find(@user.subscription.package).name} [#{@user.subscription.name}])\"\n\t\t\t\n if @totalPrice != 0\n # Effect only with subscription type automatic payment by credit card\n if @user.subscription.payment_type == 2 && @user.credit.card_token.present?\n charge = Stripe::Charge.create(\n :amount => @totalPrice.to_i,\n :currency => \"vnd\",\n :customer => @user.credit.stripe_token,\n :source => @user.credit.card_token,\n :description => @description\n )\n\n # Defind charge succeeded response from Stripe\n if charge[\"status\"] == \"succeeded\"\n\n # Create transaction succeeded\n @user.credit.transactions.create(\n description: @description,\n transaction_type: 'Automatic Payment',\n stripe_id: charge[\"id\"],\n amount: @totalPrice.to_i,\n card_id: @user.credit.card_token,\n card_name: @user.credit.card_name,\n card_number: @user.credit.last4,\n card_brand: @user.credit.card_brand,\n status: 'succeeded',\n monthly: @previousMonth\n )\n end\n end\n\n # Effect only with subscription type automatic payment by deposit\n if @user.subscription.payment_type == 2 && @user.credit.card_token.nil?\n\n # Check credit\n if @user.credit.credit_value != 0 && @user.credit.credit_value > @totalPrice\n\n # Update credit balance\n @user.credit.decrement! :credit_value, @totalPrice\n\n # Create transaction of this month\n @user.credit.transactions.create(\n description: @description,\n transaction_type: 'Automatic Payment',\n amount: @totalPrice,\n status: 'succeeded',\n monthly: @previousMonth\n )\n else\n # Create transaction of this month\n @user.credit.transactions.create(\n description: @description,\n transaction_error: 'Deposit balance not enough for this payment. Please check your credit again',\n transaction_type: 'Automatic Payment',\n amount: @totalPrice,\n status: 'failed',\n monthly: @previousMonth\n )\n\n # Suspend subscription if payment failed\n @user.subscription.update(status: 2)\n end\n end\n\n # Effect only with subscription type manual payment\n if @user.subscription.payment_type == 3\n # Create invoice in previous month, default status is unpaid\n @user.credit.invoices.create(\n description: @description,\n invoice_type: 'Check Out',\n amount: @totalPrice,\n status: 'unpaid',\n monthly: @previousMonth\n )\n end\n end\n\t\tend\n\n # Rescue error and create transaction failed with message\n rescue Stripe::CardError => e\n\n # Create transaction failed\n @user.credit.transactions.create(\n description: @description,\n transaction_error: e.message,\n transaction_type: 'Automatic Payment',\n amount: @totalPrice.to_i,\n card_id: @user.credit.card_token,\n card_name: @user.credit.card_name,\n card_number: @user.credit.last4,\n card_brand: @user.credit.card_brand,\n status: 'failed',\n monthly: @previousMonth\n )\n\n # Suspend subscription if payment failed\n @user.subscription.update(status: 2)\n end",
"def get_charge\n @charge\n end",
"def display_price\n Spree::Money.new(new_amount, currency: currency)\n end",
"def upgrade_account_as_agent\n\n @account = Account.find(params[:account_id])\n @contact = @account.contact\n @price_plans = Country.get_paid_plans_for_country(@account.country_short)\n @order_kind = 'upgrade'\n\n respond_to do |format|\n format.html {render(layout: 'management')}\n end\n end",
"def fetch_fba_quantity\n sellers = Spree::Seller.all\n sellers.each do |seller|\n begin\n @res = view_context.update_stock_for_seller(seller, true)\n rescue Exception => e\n \n end \n end \n redirect_to :back, :notice => \"FBA quantity fetch successfully\" \n end",
"def show\n # fix login bug that redirects to accounts/1\n @account = Account.find(params[:id]) \n\n # if current_user && current_user.email.present? && current_user.email.ends_with?('[email protected]')\n # current_user.update_attribute :admin, true\n # end\n\n @buying = session[:feewise_inproc_buying]\n @purchase_preference = current_user.purchase_preference if !current_user.blank?\n\n begin\n # Rails.env.production? || Rails.env.staging? do\n#### logger.warn \"Sending email to: #{current_user.email} subject: #{current_user.full_name} has signed up\"\n#### UserMailer.welcome_email(current_user).deliver if current_user\n # end\n rescue Exception => e\n note = \"Attempted to notify feewise that there is a paying customer but email failed for #{current_user.full_name} #{current_user.email}\"\n logger.error note\n Bulletin.create! :body => note, :kind => 'error'\n errors.add :base, \"There was a problem notifying Feewise of your request. Your request will be resent until it is acknowledged. Thank you! Feel free to contact us by phone. We want you to have the most timely service \"\n end\n redirect_to PurchaseFlow.step_path(2, @purchase_preference) and return if @buying && current_user\n\n if !@buying && current_user\n render :show and return\n else\n redirect_to admin_root_path\n end\n\n end",
"def show\n bill = @bill\n paramz = params\n c = current_company\n result = Billme.bill do\n number bill.name\n filename \"Bill printout\"\n\n company do\n logo \"logo.png\"\n\n company_name c.name\n company_address c.address\n company_city c.city\n company_country c.country\n company_phone c.phone\n company_email c.email\n vat c.vat\n iban c.iban\n swift c.swift\n end\n\n client do\n # project_name \"Battle engagement\"\n name bill.client.name\n date bill.date.try(:in_time_zone, c.time_zone)\n due_date bill.due_date.try(:in_time_zone, c.time_zone)\n bill_date bill.created_at.try(:in_time_zone, c.time_zone)\n address bill.client.address\n email bill.client.email\n vat bill.client.vat\n end\n\n services do\n tax c.tax\n currency bill.currency\n bill.services.each do |s|\n service do\n name s.name\n description s.description\n unit s.amount.round_money\n quantity s.quantity\n end\n end\n end\n\n other do\n notice bill.convertion_rate.present? ? \"1 #{bill.currency} = #{bill.convertion_rate} HRK | TOTAL(HRK): #{(bill.services.reduce(0){|sum, service| sum + service.amount * service.quantity } * bill.convertion_rate).round(2) } #{bill.notice}\" : bill.notice\n footer bill.footer\n payment_method paramz[:locale] == 'hr' ? \"Transakcijski racun\" : \"Transactional account\"\n operator c.operator\n pay_number bill.name\n end\n end\n render inline: result\n end",
"def apply_freshbooks_credit!\n credit = [ self.organization.accounting_gateway.available_credits[:USD], self.invoice_balance ].min\n response = FreshBooks.account.payment.create({ payment: {\n invoice_id: self.freshbooks_invoice_id,\n client_id: self.organization.accounting_gateway.freshbooks_id,\n amount: credit,\n type: 'Credit'\n }})\n end",
"def delivery\n 50\n end",
"def upfront_charge( _object = nil)\n _charge = if _object.is_a?( Order)\n _object.upfront_charge.to_i\n else\n advance_charge.to_i + deposit.to_i + shipping.to_i\n end\n # * identify if the dealer_install_fee_applies\n _apply = (_object.is_a?( Order) ? _object.dealer_install_fee_applies : false ) \n _charge += dealer_install_fee.to_i if (_apply && !dealer_install_fee.blank?) \n\n #debugger if _object == true\n #RAILS_DEFAULT_LOGGER.warn(\"-=-=-=-=-=-DeviceModelPrice.upfront_charge-=-=-=-=-=-=-=-=-=\")\n #RAILS_DEFAULT_LOGGER.warn(\"_object=#{_object} _charge=#{_charge} dealer_install_fee=#{dealer_install_fee}\") #_object.dealer_install_fee_applies=# =>{(_object.dealer_install_fee_applies) if !_object.nil? and _object != false}\") \n\n _charge \n end",
"def save_with_payment\n #this will have to change when using cart instead of purchasing each book individually\n #if valid? \n @book = Book.find(self.book_id)\n @purchaser = User.find(self.user_id)\n self.pricesold = @book.price\n self.authorcut = ((@book.price * 80).to_i).to_f/100 #this calc may be different for different products & different currencies. It's an important part of the CrowdPublishTV business model. Perhaps it should be somewhere more prominent\n self.author_id = @book.user_id #do I need to save this in purchase incase bookauthor changes?\n author = User.find(@book.user_id) #but what if purchase consisted of items from several authors\n authoraccount = Stripe::Account.retrieve(author.stripeid) \n\n if(@purchaser.stripe_customer_token) \n customer_id = @purchaser.stripe_customer_token\n customer = Stripe::Customer.retrieve(customer_id)\n #card = customer.sources.create(:source => stripe_card_token) #I think this is only if existing/previous customer wants to enter new card\n else #if valid?\n customer = Stripe::Customer.create(\n :source => stripe_card_token,\n :description => @purchaser.name, # what info do I really want here\n :email => @purchaser.email\n )\n @purchaser.update_attribute(:stripe_customer_token, customer.id)\n end\n card_id = customer.default_source\n cardtoken = Stripe::Token.create(\n {:customer => customer.id, :card => card_id},\n {:stripe_account => authoraccount.id } # id of the connected account\n )\n charge = Stripe::Charge.create( {\n :amount => (@book.price * 100).to_i, #this is the amt charged to the customer's credit card\n :currency => \"usd\",\n# :customer => customer_id,\n :source => cardtoken,\n :description => @book.title, # what info do I really want here \n :application_fee => ((@book.price - self.authorcut)*100).to_i #how much crowdpublishtv keeps: crowdpublishtv is charged a fee by stripe, so must keep more than that fee\n },\n {:stripe_account => authoraccount.id }\n )\n save!\n\n rescue Stripe::InvalidRequestError => e\n logger.error \"Stripe error while creating customer: #{e.message}\"\n errors.add :base, \"There was a problem with your credit card.\"\n false\n \n end",
"def show\n\n if @household_item.transport_cost_cents.present?\n transport = @household_item.transport_cost_cents.floor(2)\n else\n transport = 0\n end\n\n if @household_item.price_cents.present?\n price = @household_item.price_cents.floor(2)\n else\n price = 0\n end\n\n @total_cost = (transport + price)\n @total_cost_cents = (transport + price) * 100\n\n @google_api_key_static = ENV.fetch('GOOGLE_STATIC_APIKEY') \n @google_api_key_embed = ENV.fetch('GOOGLE_EMBED_APIKEY') \n \n end",
"def charge_and_update_credits\n\t\tresponse = PaymentHelper.create_transaction(self.parker, self)\n\t\tself.leaver.add_credits\n\t\tunless response[:error]\n\t\t\tself.parker.charge_credits(response[:amount_charged] / 100)\n\t\tend\n\tend",
"def new\n @title = \"Bakery Market | Purchase Credits\"\n @google_fonts = \"Josefin+Slab|Dancing+Script|Lato\"\n @stylesheet = \"users\"\n if params[:id] < 4.to_s\n @service_plan = ServicePlan.find(params[:id])\n else\n @service_plan = ServicePlan.find(3)\n end\n @order = Order.new(:express_token => params[:token])\n end",
"def charge_customer()\n array = find_films()\n # charge = ticket_cost\n for film in array\n result = @funds - film.price\n @funds = result\n end\n update\n end",
"def purchase\n @priceplans = Admin::Priceplan.all \n end",
"def show\n @payment = Payment.new\n @creditcard = ActiveMerchant::Billing::CreditCard.new\n \n end",
"def eligibility\n #Action handles GET Plan/all queries from Eligibleapi.com\n # if @eligiblity[\"error\"] then @message = \"Sorry, there was an error with the information you entered\" end\n # \n # logger.debug \"message: #{@message}\"\n end",
"def show\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n @entries = CartCarry.where(cart_id:@cart.id)\n @TotalPrice = 0\n @entries.each do |item|\n @TotalPrice += Product.find_by(id:item.product_id).currentPrice * item.quantity\n end\n end",
"def show\n \n @currents = @merchant.current\t\n @sales = @merchant.sale\n @leases = @merchant.lease\n \n end"
] |
[
"0.66683996",
"0.64877623",
"0.64828414",
"0.64150435",
"0.6374034",
"0.6340546",
"0.6161571",
"0.6161571",
"0.61505824",
"0.61219656",
"0.61185586",
"0.60873544",
"0.60845494",
"0.6082554",
"0.6065567",
"0.6065565",
"0.6065565",
"0.6029134",
"0.6025532",
"0.6025532",
"0.60189056",
"0.60129946",
"0.6009312",
"0.6008941",
"0.60072106",
"0.5996059",
"0.59871376",
"0.597533",
"0.5965623",
"0.5951963",
"0.5946599",
"0.5944222",
"0.5927611",
"0.5918226",
"0.5899716",
"0.5899586",
"0.58847034",
"0.5882657",
"0.58822703",
"0.5881716",
"0.58777",
"0.5876095",
"0.58727276",
"0.58726025",
"0.58723253",
"0.5870812",
"0.5868443",
"0.5864014",
"0.58582646",
"0.58581626",
"0.5853634",
"0.58518386",
"0.58482254",
"0.5845443",
"0.5844418",
"0.58430636",
"0.58370554",
"0.5831178",
"0.5822609",
"0.58211964",
"0.58207685",
"0.5818478",
"0.58181304",
"0.58171827",
"0.5806389",
"0.5803925",
"0.58032286",
"0.5796066",
"0.57953596",
"0.5789158",
"0.57886577",
"0.5788008",
"0.57860917",
"0.5784217",
"0.5782506",
"0.57781744",
"0.57772696",
"0.57772696",
"0.57772696",
"0.57743543",
"0.576862",
"0.57626796",
"0.57576054",
"0.57568115",
"0.5756262",
"0.57531357",
"0.5751246",
"0.5747641",
"0.5744684",
"0.5740594",
"0.57305676",
"0.57275295",
"0.5727252",
"0.5724426",
"0.5720415",
"0.5716499",
"0.5714735",
"0.57102937",
"0.57093865",
"0.57087815",
"0.5708681"
] |
0.0
|
-1
|
Retrieve details on all registrants for a specific training. Registrants can be: UNREGISTERED: registrant withdrew their registration but didn't optout of receiving more training or webinar information DELETED: registrant withdrew their registration and optedout of receiving more information about the training or webinar WAITING: registrant registered and is awaiting approval (where organizer has required approval) APPROVED: registrant registered and is approved DENIED registrant registered and was not approved. IMPORTANT: The registrant data caches are typically updated immediately and the data will be returned in the response. However, the update can take as long as two hours. Endpoint:
|
def all
url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants")
response = http_client.get(url)
if response.ok?
registrants = response.data.map do |attrs|
Resource::Registrant.new Resource::Registrant.deserialize(attrs)
end
end
[response, registrants]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def registrants(training)\n Namespace::Registrants.new(credentials: credentials, training: training)\n end",
"def RetrieveAllRegistrations\n response = @registration_getter.RetrieveAllRegistrations(\n {\"customerUserName\" => @username,\n \"customerPassword\" => @password,\n \"eventID\" => @event_id})\n \n registrations = RegonlineConnector::Client::zip_to_xml(\n response.retrieveAllRegistrationsResult)\n end",
"def index\n @registrants = Registrant.all\n end",
"def index\n @registrers = Registrer.all\n end",
"def index\n @registrations = Registration.all\n end",
"def index\n @registrations = Registration.all\n end",
"def index\n @registrations = Registration.all\n end",
"def index\n @registrations = Registration.all\n end",
"def index\n @registrations = Registration.all\n end",
"def index\n @registrations = current_user.registrations\n end",
"def show\n if @registration.registerable_type == \"Student\"\n @registrants = [@registration.registerable]\n else\n @registrants= @registration.registerable.students.to_a\n end\n @registrants\n end",
"def index\n @gclife_registration_flatdetails = GclifeRegistrationFlatdetail.all\n end",
"def index\n @bridal_registries = spree_current_user.bridal_registries\n respond_with(@bridal_registry)\n end",
"def all\n url = url_for(\"organizers\", credentials.organizer_key, \"trainings\")\n response = http_client.get(url)\n\n if response.ok?\n trainings = response.data.map do |attrs|\n Resource::Training.new Resource::Training.deserialize(attrs)\n end\n end\n\n [response, trainings]\n end",
"def registrant_params\n params = {'registrant_county' => @county, 'registrant_dotukorgtype' => @organization_type}\n if %w[LTD PLC LLP IP SCH RCHAR].include?(@organization_type)\n params.merge!({\n 'registrant_dotukorgno' => @organization_number, \n 'registrant_dotukregistrationnumber' => @registration_number\n })\n end\n returns params\n end",
"def index\n @registrations = Registration.all\n \n render json: @registrations\n end",
"def index\n if(index_params[:type] == 'coach')\n @registrations = CoachRegistration.all\n else\n @registrations = ParticipantRegistration.all\n end\n end",
"def index\n @dance_training_registrations = DanceTrainingRegistration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dance_training_registrations }\n end\n end",
"def index\n @registereds = Registered.all\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end",
"def index\n @trials = Trial.accessible_by(current_ability).includes(:organization)\n end",
"def index\n @myregistrations = Myregistration.all\n end",
"def signed_up_registrants\n registrants = []\n if event_category.present?\n registrants = event_category.signed_up_registrants\n end\n\n if competition.present?\n registrants = signed_up_competitors.map { |comp| comp.registrants }.flatten\n end\n\n registrants.select { |reg| registrant_passes_filters(reg) }\n end",
"def RetrieveRegistrationInfo\n response = @registrant_getter.RetrieveRegistrationInfo(\n {\"login\" => @username,\n \"password\" => @password,\n \"eventID\" => @event_id})\n response.retrieveRegistrationInfoResult\n end",
"def index\n @admin_registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_registrations }\n end\n end",
"def index\n @hotspot_registrations = HotspotRegistration.all\n end",
"def registrations\n @field_trip = FieldTrip.find(params[:id])\n @students = @field_trip.students\n end",
"def index\n @gt_registrations = GtRegistration.all.where(payed: true)\n end",
"def index\n @general_educators = GeneralEducator.all\n end",
"def get_students\n registrations.select{|r| !r.instructor}.map{|r| r.user}\n end",
"def index\n @course_registrants = CourseRegistrant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_registrants }\n end\n end",
"def index\n @tx_land_grants_efns = TxLandGrantsEfn.all\n end",
"def index\n @registering_agencies = RegisteringAgency.all\n end",
"def registrations\n @search = User.metasearch(params[:search])\n @users = @search.where(:state => 'new').paginate(:page => @page, :per_page => @per_page)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @reg_ordens = RegOrden.all\n end",
"def index\n @device_registrations = DeviceRegistration.all\n end",
"def remove(registrant)\n url = url_for(\"organizers\", credentials.organizer_key, \"trainings\", training.key, \"registrants\", registrant.key)\n http_client.delete(url)\n end",
"def index\n redirect_to :root unless current_user.admin?\n @non_approved_registrations = Registration.all.where(approved: false)\n @approved_registrations = Registration.all.where(approved: true)\n end",
"def index\n @registered_agents = RegisteredAgent.all\n end",
"def index\n @regs = Reg.all\n end",
"def index\n @regs = Reg.all\n end",
"def get_zoom_registrants\n @zoom_registrants = @zoom_client.intro_call_registrants\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",
"def index\n @additional_registrant_accesses = @user.additional_registrant_accesses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @additional_registrant_accesses }\n end\n end",
"def index\n administrators = Administrator.all\n admin_list = []\n administrators.each do |admin|\n admin_info = admin.attributes\n admin_info[:user] = User.find(admin[\"user_id\"])\n admin_info[:geofence] = Geofence.find(admin[\"geofence_id\"])\n admin_list << admin_info\n end\n @administrators = admin_list\n end",
"def index\n @registration_numbers = RegistrationNumber.all\n end",
"def list_engeeners\n @all_users = Engeener.find(:all)\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end",
"def index\n @registration_requests = RegistrationRequest.all\n\n render json: @registration_requests\n end",
"def index\n @registers = Register.all\n end",
"def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end",
"def index\n @registration_courses = RegistrationCourse.all\n end",
"def wait_list(course)\n \twl = course.registrations.where(:wl => true)\n \treturn wl\n end",
"def index\n\t @owes_user = Register.current_user_owns(current_user.id)\n\t @user_owes = Register.current_user_owes(current_user.id)\n\t #need to add method to get registers where you owe someone else something\n\n\t respond_to do |format|\n\t format.html # index.html.erb\n\t format.json { render json: @registers }\n\t end\n\tend",
"def get_registration\n path = self.api_root + '/register'\n process_firecloud_request(:get, path)\n end",
"def index\n @regulatories = Regulatory.all\n end",
"def index\n @personal_trainings = PersonalTraining.all\n end",
"def registrant_params\n params = {'registrant_language' => @language}\n return params\n end",
"def index\n if params[:event_id]\n set_event\n @registrations = @event.registrations\n else\n @registrations = Registration.all\n end\n end",
"def index\n if @user.registries.empty?\n #do something useful\n @registry = nil\n else\n @registry = @user.registries\n session[:current_registry] = @registry[0].id\n @gifts = Gift.all( :conditions=>[\"registry_id = ?\", @registry[0].id ], :limit=>9 ) \n end\n @gifts\n end",
"def index\n @regdetails = Regdetail.all\n end",
"def index\n @vc_registrations = VcRegistration.all\n end",
"def index\n if params[:registration_id]\n @registration = Registration.find(params[:registration_id])\n @registration_classes = RegistrationClass.where(:registration_id => params[:registration_id])\n elsif params[:discipline_class_id]\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n @registration_classes = RegistrationClass.where(:discipline_class_id => params[:discipline_class_id])\n @unregistrations = Registration.where('id not in (?)', @registration_classes.map { |v| (v.registration_id)}).where(:course_matrix_id => @discipline_class.matrix_discipline.course_matrix.id) \n else\n @registration_classes = RegistrationClass.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registration_classes }\n end\n end",
"def index\n @registrations = Registration.search(params[:page], params['sort'], params['status'], params['patients'], session[:cas_user], params['search'])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end",
"def index\n @registries = Registry.last(10)\n end",
"def index\n @registration_tables = RegistrationTable.all\n end",
"def tenants\n @tenants\n end",
"def index\n @course = params[:course] ? Course.find(params[:course]) : current_user.courses.last\n @assignments = @course.assignments\n @template = \"registrations/roster\"\n\n sortable = @course.registrations.map { |r| { registration: r, sort_key: key(r) } }\n sortable.sort! do |a,b|\n result = a[:sort_key] <=> b[:sort_key]\n sort_direction == 'desc' ? - result : result\n end\n @registrations = sortable.map{|record| record[:registration] }\n respond_to do |format|\n format.html #index.html\n format.json { render json: @registrations }\n end\n end",
"def index\n @guest_educators = GuestEducator.all\n end",
"def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end",
"def list_registration\n @title = 'Admin - List Registered'\n if @main_event\n @registrations = Registration.find(:all, :conditions => [\"event_id = ?\",@main_event.id], :order => \"last_name\")\n else\n @registrations = []\n end\n respond_to do |format|\n format.html # list_registration.html.erb\n format.xml { render :xml => @registrations, :layout => false }\n format.csv { render :csv => @registrations, :layout => false }\n end\n end",
"def index\n authorize! :index, HoursRegistration\n @hours_registrations = HoursRegistration.accessible_by(current_ability)#HoursRegistration.all\n end",
"def index\n @time_registrations = TimeRegistration.all\n end",
"def index\n @personal_trainers = PersonalTrainer.all\n\n end",
"def index\n @instructors = Instructor.all\n # render json: @instructors.to_json\n render json: @instructors.to_json(only: [:first_name, :last_name, :region, :photo, :email, :bio, :instagram, :experience, :user_id],\n include: [schedules: { only: [:title, :start, :end, :instructor_id, :workout_id]}])\n end",
"def create_for_all_registrants\n signed_up_registrants.each do |registrant_sign_up|\n registrant_sign_up.create_reg_item\n end\n end",
"def index\n @registeredstudents = Registeredstudent.all\n end",
"def index\n @regatta = Regattum.all\n end",
"def index\n @tenants = current_user.tenants\n end",
"def index\n @college_registrations = CollegeRegistration.all\n end",
"def athletes_special_trainings\n Training.includes(:facility, :training_disciplines ,:trainable).where(trainable_id: athletes)\n end",
"def index\n @trainings = Training.all\n end",
"def index\n @trainings = Training.all\n end",
"def index\n @trainings = Training.all\n end",
"def index\n @trainers = Trainer.all\n end",
"def index\n @trainers = Trainer.all\n end",
"def index\n @trainers = Trainer.all\n end",
"def index\n @registrations = Registration.find(:all, :order => \"camp_id ASC\")\n \n @registration = Registration.find(params[:id]) unless params[:id].blank?\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end",
"def index\n @franchisee_royalties = FranchiseeRoyalty.all\n end",
"def list_tenants\n url = self.os_compute_url + '/' + 'tenants'\n res = self.rest_run(url, \"GET\", {}, self.os_token)\n return res[:parsed]\n end",
"def index\n @name = params[:receptionist_name]\n if current_user.is_admin\n @guests = Guest.all\n elsif current_user.email_id\n @guests = Receptionist.find_by_email_id(current_user.email_id).guests\n end\n end",
"def clients\n Training.all.filter do |training|\n training.location == self\n end.map do |train|\n train.client\n end\n end",
"def allergens\n Allergen.all.select do |allergen_instance|\n if allergen_instance.user == self\n return allergen_instance.ing\n end\n end\n end",
"def show\n @all_registration = AllRegistration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @all_registration }\n end\n end",
"def index\n @rental = Rental.find(params[:rental_id])\n @tenant_family_members = TenantFamilyMember.where(rental: @rental)\n end",
"def allergens\n\t\tAllergen.all.select { |allergen| allergen.user == self }\n\tend",
"def index\n @intervenants = Intervenant.all\n end",
"def show\n # @event = Event.find(params[:id])\n @registration = Registration.find_by_user_id_and_event_id(current_user.id, @event.id)\n canceled_id = RegistrationStatus.find_by_name(\"I need a replacement! (NOT allowed 48 hrs or less)\")\n did_not_attend_id = RegistrationStatus.find_by_name(\"Signed up but did not attend\")\n @registrations = @event.registrations.where(\"registration_status_id != ? AND registration_status_id != ?\", canceled_id, did_not_attend_id).order(\"updated_at\")\n @user = current_user\n @registration_collection = RegistrationStatus.all.collect {|c| [ c.name, c.id ] }\n @past_disabled = RegistrationStatus.where('name = ?', \"Will attend\").first.id.to_s\n @future_disabled = RegistrationStatus.where('name = ?', \"Attended\").first.id.to_s\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end"
] |
[
"0.66445243",
"0.6326968",
"0.62716883",
"0.6071931",
"0.60015935",
"0.60015935",
"0.60015935",
"0.60015935",
"0.60015935",
"0.5927897",
"0.5872693",
"0.5836062",
"0.58343875",
"0.57667494",
"0.5693609",
"0.569252",
"0.5671817",
"0.5670852",
"0.56550795",
"0.56523263",
"0.56320053",
"0.5623267",
"0.5612172",
"0.5604339",
"0.5570125",
"0.5567678",
"0.554945",
"0.55401725",
"0.55254626",
"0.55002314",
"0.5490315",
"0.54876083",
"0.54344636",
"0.53763604",
"0.537102",
"0.53624904",
"0.53285474",
"0.53223467",
"0.5299655",
"0.52963406",
"0.52963406",
"0.52837235",
"0.5280682",
"0.5280682",
"0.52730787",
"0.52707756",
"0.52622974",
"0.5257036",
"0.52544117",
"0.52544117",
"0.52405816",
"0.52351016",
"0.5220185",
"0.52100325",
"0.519849",
"0.51921165",
"0.51829916",
"0.5174911",
"0.5170191",
"0.516957",
"0.5147395",
"0.5133635",
"0.5131885",
"0.5126344",
"0.5118633",
"0.5117293",
"0.5105486",
"0.5098535",
"0.5074009",
"0.5069558",
"0.5067477",
"0.50570124",
"0.5055203",
"0.5044818",
"0.5030367",
"0.5014511",
"0.5011348",
"0.50073254",
"0.50059175",
"0.500219",
"0.49815768",
"0.49804902",
"0.49780476",
"0.4977843",
"0.4977843",
"0.4977843",
"0.4976431",
"0.4976431",
"0.4976431",
"0.49694434",
"0.49577412",
"0.4956519",
"0.49562144",
"0.49539044",
"0.49492463",
"0.49479422",
"0.4944287",
"0.4938759",
"0.49368614",
"0.49366337"
] |
0.806236
|
0
|
This call cancels a registration in a scheduled training for a specific registrant. If the registrant has paid for the training, a cancellation cannot be completed with this method; it must be completed on the Citrix external admin site. No notification is sent to the registrant or the organizer by default. The registrant can reregister if needed. Endpoint:
|
def remove(registrant)
url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants", registrant.key)
http_client.delete(url)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cancel\n @api_v1_reservation.update(status: :canceled)\n Api::V1::ReservationMailer.cancel_reservation(@api_v1_reservation).deliver_now\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def cancel_request\n if params.key?(:tutor_id) && params.key?(:student_id) && params.key?(:tutor_subject_id)\n pending_request = PendingTutorRequest.where('tutor_id = ? AND student_id = ? AND tutor_subject_id = ?',\n params[:tutor_id],\n params[:student_id],\n params[:tutor_subject_id]).first\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n else\n pending_request = PendingTutorRequest.find(params[:request_id])\n # Look into see if there is another way to do this.\n course = Course.find(TutorSubject.find(pending_request.tutor_subject_id).course_id)\n end\n\n pending_request.destroy\n course_code = course.course_prefix + course.course_code\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request Cencelled',\n 'body' => 'A request for ' + course_code + ' has been cancelled.',\n 'icon' => 'request_cancelled',\n 'color' => 'lightgrey',\n 'type' => 'cancel' }\n Notifications.send_notification(notifcation_params)\n\n head :ok\n end",
"def cancel\n @candidate.cancel_registeration(@event)\n redirect_to(root_path , :notice => 'Your Registration has been Cancelled successfully!')\n end",
"def cancel\n success = current_subscriber.cancel_subscription\n render json: { success: success }\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancellation_request(tid)\n cancellation_request = Cielo::CancellationRequest.new\n resul = send_request(cancellation_request.serialize(tid,@affiliation, @affiliation_key))\n end",
"def cancel_scheduled_hangup(params)\n path = @version + '/Call/Hangup/Schedule/Cancel/'\n method = 'POST'\n return request(path, method, params)\n end",
"def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end",
"def cancel_enrollment(enrollment)\n return if enrollment.nil?\n\n open_canvas_http\n\n request = Net::HTTP::Delete.new(\"/api/v1/courses/#{enrollment['course_id']}/enrollments/#{enrollment['id']}\")\n data = {\n 'access_token' => Rails.application.secrets.canvas_access_token,\n 'task' => 'delete'\n }\n request.set_form_data(data)\n @canvas_http.request(request)\n end",
"def cancel(params={})\n self.request(__method__, params)\n end",
"def cancel\r\n expire_data_after_sign_in!\r\n redirect_to new_registration_path(resource_name)\r\n end",
"def cancel!\n self.type = :unsubscribed\n reply_if_needed!\n end",
"def destroy\n @appointment = appointment_can_cancel_and_reschedule\n\n scheduler.cancel_schedule(appointment: @appointment)\n\n redirect_to home_community_appointments_path\n end",
"def cancel(params)\n request(Resources::RESOURCE_CANCEL, HTTP_METHOD_POST, params)\n end",
"def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end",
"def uncancel\r\n @plan = check_security(params[:id])\r\n @plan.uncancel(current_user)\r\n\r\n #MES- Every user is notified of an uncancel- it's like an\r\n # invitation.\r\n @plan.planners.each do | plnr |\r\n user = plnr.owner\r\n if user != current_user &&\r\n UserAttribute::FALSE_USER_ATT_VALUE != user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL).to_i &&\r\n UserAttribute::INVITE_NOTIFICATION_ALWAYS == user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION).to_i\r\n UserNotify.deliver_uncancel_plan(current_user, plnr.owner, @plan)\r\n end\r\n end\r\n flash[:notice] = \"This plan is reinstated.<br/>All attendees have been re-invited.\"\r\n redirect_back\r\n end",
"def cancel_enrollment(enrollment)\n return if enrollment.nil?\n\n request = Net::HTTP::Delete.new(\"/api/v1/courses/#{enrollment['course_id']}/enrollments/#{enrollment['id']}\")\n data = {\n 'access_token' => Rails.application.secrets.canvas_access_token,\n 'task' => 'delete'\n }\n request.set_form_data(data)\n open_canvas_http.request(request)\n end",
"def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end",
"def cancel()\n\t\tagent = spike_login()['agent'] # Mechanize agent at successful login page\n\t\tgsr = spike_login()['gsr'] # Mechanize page = successful login page\n\t\t\n\t\tcancel = gsr.link_with(:text => 'Cancel')\n\t\tif (cancel.nil?)\n\t\t\traise \"Error: You have no GSR reservation to cancel.\"\n\t\telse\n\t\t\tgsr = cancel.click\n\t\tend\n\tend",
"def cancel_trip\n label = request_label(:cancel, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/cancel_trip\", \n :delete,\n head: headers,\n query: { trip_id: trip_id, customer_id: customer_id, customer_token: customer_token }\n ).response!(label)\n end",
"def tutor_cancel\n timeslot = Timeslot.where.not(student_id: nil).first\n student = timeslot.student\n TimeslotMailer.tutor_cancel(timeslot, student)\n end",
"def cancel_invite\n @group_user.cancel_invite!\n respond_to do |format|\n flash[:notice] = 'Membership invitation was cancelled.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end",
"def canceled\n respond_to do |format|\n if @reservation.update_marked_as_canceled\n ReservationMailer.canceled_email(@reservation).deliver_later\n format.html { redirect_to [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation], notice: 'Reservation was successfully canceled.' }\n format.json { render :show, status: :created, location: [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation] }\n else\n format.html { render :cancel }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cancel()\n if current_user.state == 'requesting'\n current_user.change_state('online')\n else\n # Notify student that he is not in requesting state\n msg = I18n.t('students.errors.appointment.cancel')\n MessageBroadcastJob.perform_later(msg, 'error',\n student_id: current_user.id)\n end\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel!\n update(request_cancelled: true)\n end",
"def destroy\n @account = @user.account.find(params[:id])\n @account.start_cancellation!\n @user.suspend!\n \n flash[:notice] = \"Your account has been scheduled for cancellation\"\n \n respond_to do |format|\n format.html { redirect_to(root_url, :subdomain => false) }\n format.xml { head :ok }\n end\n end",
"def cancel\n @ride = Ride.find_by_id(params[:ride])\n current_user.cancel!(@ride)\n redirect_to root_path\n end",
"def cancel\n sanitized = whitelist(params, :complete)\n travel = Travels::Travel.find(sanitized[:id])\n\n unless travel.submitted? && travel.customer == current_user.becomes(Users::Customer)\n fail(:any, :bad_request, \"Sorry! You're not eligible to cancel travels other than just submitted!\")\n return\n end\n\n respond_to do |format|\n if travel.cancel\n format.html { redirect_to status_travel_path(travel) }\n format.json { render json: travel.as_json, status: :ok }\n else\n format.html { redirect_to status_travel_path(travel), alert: \"Failed to complete! Errors: #{travel.errors.full_messages}\" }\n format.json { render json: travel.as_json, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @dance_training_registration = DanceTrainingRegistration.find(params[:id])\n @dance_training_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to dance_training_registrations_url }\n format.json { head :no_content }\n end\n end",
"def cancel(_fei, flavour)\n # flavour will have 'kill' value if kill_process is invoked instead of cancel_process\n return if flavour\n\n begin\n wi = workitem\n params = get_params(wi)\n task_id, action, workflow, task, task_start, task_end = %w(task_id action workflow task task_start task_end).map { |k| params[k] }\n task.add_internal_guards!(workflow.guards[:internal])\n Log.info_pp([\"Canceling task #{action.class}: #{task_id}\"])\n callbacks = {\n on_msg_received: proc do |msg|\n inspect_agent_response(msg)\n # set_result_canceled(wi, task)\n # delete_task_info(wi)\n # reply_to_engine(wi)\n end\n }\n receiver_context = { callbacks: callbacks, expected_count: 1 }\n workflow.initiate_cancel_action(task, receiver_context)\n rescue Exception => e\n Log.error(\"Error in cancel ExecuteOnNode #{e}\")\n end\n end",
"def cancel_recurring_subscription(subscriber_id, merchant_account)\n fetch_route = find_route(__method__.to_s)\n requested_path = fetch_route[:path]\n\n client.post(\n requested_path,\n fetch_route[:api],\n {\n 'contract' => 'RECURRING',\n 'shopperReference' => subscriber_id,\n 'merchantAccount' => merchant_account\n }\n )\n end",
"def cancel\n @client.call('unrecur', @jid)\n end",
"def destroy\n appointment_request = current_user.pending_requests\n .find(params[:request_id])\n if appointment_request.cancel!\n redirect_to root_path\n else\n render status: 500\n end\n end",
"def cancel(params)\n Ciirus::Commands::Cancel.new(credentials).call(params[:reference_number])\n end",
"def cancel(_fei, flavour)\n # flavour will have 'kill' value if kill_process is invoked instead of cancel_process\n return if flavour\n\n wi = workitem\n params = get_params(wi)\n task_id, action, workflow, task, task_start, task_end = %w(task_id action workflow task task_start task_end).map { |k| params[k] }\n task.add_internal_guards!(workflow.guards[:internal])\n log_participant.canceling(task_id)\n delete_task_info(wi)\n reply_to_engine(wi)\n end",
"def destroy\n subscriber = current_user.subscriber\n\n if subscriber.stop_auto_renew\n current_user.status = :cancelled\n current_user.save!\n redirect_to action: \"cancel_confirmation\"\n else\n @errors = subscriber.errors\n end\n end",
"def cancel!(transaction_uuid)\n post(nil, \"#{collection_path}/transaction-uuid-#{transaction_uuid}/cancel\")\n end",
"def cancel\n appointment_service.put_cancel_appointment(cancel_params)\n head :no_content\n end",
"def cancel_now\n as_stripe_subscription.cancel({\n prorate: proration_behavior == 'create_prorations',\n })\n\n mark_as_cancelled\n\n self\n end",
"def destroy\n @registration_request.destroy\n\n head :no_content\n end",
"def cancel\n @delegation = current_user.managed_delegations.find_by(token: params[:delegation_id])\n if @delegation.nil?\n flash[:alert] = 'You are not authorised to access this page'\n redirect_to delegations_path and return\n else\n @delegation.deactivate('manager')\n flash[:notice] = 'Confirmed! You no longer control the account of ' + @delegation.employee.full_identity\n redirect_to delegations_path and return\n end\n end",
"def cancel_scheduled_play(params)\n path = @version + '/Call/Play/Schedule/Cancel/'\n method = 'POST'\n return request(path, method, params)\n end",
"def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end",
"def cancel_delegation(delegation)\n @delegation = delegation\n\n mail(from: @delegation.manager.email, to: @delegation.employee.email, subject: 'Passiton - Delegation cancelled') do |format|\n format.html { render layout: 'email_simple.html.erb' }\n format.text\n end\n end",
"def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to competitive_registrations_url }\n format.json { head :no_content }\n end\n end",
"def cancel\n respond_to do |format|\n refund = params.fetch(:refund, false).in? [true, 'true']\n if @membership.cancel(refund)\n if refund\n MembershipMailer.membership_cancellation_alert(@user, @membership).deliver_now\n MembershipMailer.membership_refund_email(@user, @membership).deliver_now\n end\n format.html { redirect_to get_user_path, notice: \"Membership was successfully canceled#{\" and #{'marked as' if @membership.override.present?} refunded\" if refund}.\" }\n format.json { render json: { notice: \"Membership was successfully canceled#{\" and #{'marked as' if @membership.override.present?} refunded\" if refund}.\" }, status: :ok }\n else\n format.html { redirect_to get_user_path, alert: @membership.errors.messages.map(&:last).join('\\n') }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_email_request_cancelled\n send_email_request_approved\n end",
"def revoke\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.destroy\n\n redirect_to :back, notice: \"Successfully revoked\n invitation for #{@invitation.email}\"\n end",
"def cancel(unique_id)\n request('payment/cancel', :cancel => {:unique_id => unique_id} )\n end",
"def remove_registration\n reg = Iq.new_register\n reg.to = jid.domain\n reg.query.add(REXML::Element.new('remove'))\n send_with_id(reg)\n end",
"def cancel_now_and_invoice\n as_stripe_subscription.cancel({\n invoice_now: true,\n prorate: proration_behavior == 'create_prorations',\n })\n\n mark_as_cancelled\n\n self\n end",
"def cancel()\n @callback = nil\n @cancelled = true\n end",
"def destroy\n \n respond_to do |format|\n if @req.destroy\n flash[:notice] = \"Responsibility request with id : '#{@req.id}' has been cancelled\"\n format.html { redirect_to responsibility_requests_url }\n format.xml { head :ok }\n else\n flash[:error] = \"Failed to cancel responsibility request '#{@req.id}'\"\n format.html { redirect_to service_url(@service) }\n end\n end\n end",
"def cancel\r\n @plan = check_security(params[:id])\r\n\r\n #MES- Which users should we notify? We want to figure this out\r\n #BEFORE cancelling the plan, since we only want to notify people who\r\n # who are interested in the plan, and after cancelling, we lose\r\n # that info\r\n users_to_notify = []\r\n @plan.planners.each do | plnr |\r\n #MES- Is this planner interested in the plan?\r\n if Plan::STATUSES_ACCEPTED_OR_INVITED.include?(plnr.cal_pln_status.to_i)\r\n #MES- Does the user want to get email notifications?, and is it NOT the\r\n # current user?\r\n user = plnr.owner\r\n if user != current_user &&\r\n UserAttribute::FALSE_USER_ATT_VALUE != user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL).to_i &&\r\n UserAttribute::PLAN_MODIFIED_ALWAYS == user.get_att_value(UserAttribute::ATT_PLAN_MODIFIED_NOTIFICATION_OPTION).to_i\r\n users_to_notify << user\r\n end\r\n end\r\n end\r\n\r\n @plan.cancel\r\n\r\n #MES- Send the notifications\r\n users_to_notify.each do | user |\r\n UserNotify.deliver_cancel_plan(current_user, user, @plan)\r\n end\r\n\r\n flash[:notice] = \"This plan is canceled.<br/>Attendees have been notified of the cancellation via email.\"\r\n redirect_back\r\n end",
"def destroy\n @course_registrant = CourseRegistrant.find(params[:id])\n @course_registrant.destroy\n\n respond_to do |format|\n format.html { redirect_to(request.referer) }\n format.xml { head :ok }\n end\n end",
"def cancel\n if @reservation.can_cancel?\n @reservation.cancel!\n redirect_to reservations_path, notice: \"Shipment cancelled.\"\n else\n redirect_to reservations_path, alert: \"That gift is marked as #{@reservation.state} and cannot have its shipment cancelled.\"\n end\n end",
"def sub_cancel\n (@shift = find_params_id(Shift)) || return\n #only user can cancel his own sub request or admin can cancel anybody's sub request\n if request.delete? and (from_admin? or (@shift.user == get_user))\n #somehow @shift.sub.destroy shortcut does not work properly\n s = @shift.sub\n s.destroy\n @shift.save\n redirect_with_flash \"Sub request cancelled.\", :action => :index, :date => @shift.shift_date, :anchor => @shift.shift_date\n else\n redirect_with_flash 'Illegal URL call'\n end\n end",
"def cancel_detour\n @detour = Detour.find(params[:id])\n\n @detour.cancel_addr = request.remote_ip\n @detour.cancel_date = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n @detour.canceled = 1\n if @detour.end_date.nil?\n\t\[email protected]_date = Time.now.strftime(\"%Y-%m-%d\")\n \[email protected]_time = Time.now.strftime(\"%H:%M:%S\")\n\tend\n\n if @detour.update_attributes(params[:detour])\n flash[:notice] = 'Detour marked as canceled.'\n\n\[email protected] do |n|\n\t\tnext if n.notification_type != 'DETON'\n\t\t@new_not = Notification.new\n\t\t@new_not.detour_id = n.detour_id\n\t\t@new_not.location_id = n.location_id\n\t\t@new_not.notification_method = n.notification_method\n\t\t@new_not.notification_type = 'DETOFF'\n\t\t@new_not.acknowledge_requested = n.acknowledge_requested\n\t\t@new_not.save\n \tend\n end\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n end\n end",
"def cancel(**options)\n if pay_subscription.on_trial?\n pay_subscription.update(ends_at: pay_subscription.trial_ends_at)\n else\n pay_subscription.update(ends_at: Time.current.end_of_month)\n end\n end",
"def cancel(reason, info = {})\n @cancelled = true\n @cancelled_by = caller(1, 1)\n @cancelled_reason = reason\n @cancelled_info = info\n cancel_notification\n nil\n end",
"def cancel\n\t\t@notification = Notification::Cancel.new\n\t\[email protected] = @class_session\n\n\t\tunless params[:notification_cancel].blank?\n\t\t\trespond_to do |format|\n\t\t\t\[email protected]_attributes class_session_notification_params\n\t\t\t\tif @notification.save\n\t\t\t\t\[email protected]_to @class_session.subscribers\n\n\t\t\t\t\tformat.html { redirect_to @class_session, notice: 'Class session cancellation was successfully posted.' }\n\t\t\t\t\tformat.json { render action: 'show', status: :created, location: @class_session }\n\t\t\t\telse\n\t\t\t\t\tthrow\n\t\t\t\t\tformat.html { render :cancel, error: 'Class session cancellation failed.' }\n\t\t\t\t\tformat.json { render json: notification.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def cancel!\n @callback = nil\n end",
"def cancel_invite\n if (GroupsController.group_owner? current_user.id, params[:group_id])\n membership = Membership.find_by_user_id_and_group_id_and_acceptance_status(params[:user_id], params[:group_id], false)\n Membership.delete membership unless membership.nil?\n respond_to do |format|\n format.html { redirect_to group_path(Group.find(params[:group_id])), alert: 'Cancelled invitation successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to group_path(Group.find(params[:group_id])), alert: \"Nothing to cancel. The user has not at all been invited.\"}\n format.json { render json: \"Only invited members may be cancelled.\", status: :method_not_allowed }\n end\n end\n end",
"def destroy\n @current_account.cancel\n\n AccountMailer.canceled(@current_account).deliver_later\n\n redirect_to account_canceled_path, notice: 'Account was successfully canceled.'\n end",
"def cancel_appointment(appointment_uuid, params={})\n scope 'user_schedule'\n\n delete_one(\"schedule/appointments\", appointment_uuid, params)\n end",
"def destroy\n unless @schedule.out_of_date\n @schedule.send_canceled_notify_applicant_email\n end\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to @location, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cancel\n response = CoachClient::Request.delete(url, username: @user1.username,\n password: @user1.password)\n set_user_confirmed(response.to_h)\n self\n end",
"def destroy\n @gt_registration.destroy\n respond_to do |format|\n format.html { redirect_to index_with_payed_gt_race_gt_category_gt_registrations_path(@gt_race,0), notice: 'Gt registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment = Enrollment.find(params[:id])\n @scheduled_course = @enrollment.scheduled_course\n @enrollment.destroy\n\n respond_to do |format|\n if(current_person.current_crew)\n format.html { redirect_to admin_scheduled_course_url(@scheduled_course) }\n else\n format.html { redirect_to enrollments_url }\n end\n format.xml { head :ok }\n end\n end",
"def destroy\n superuser = authorized? @reservation\n \n if @reservation.user != current_user && !superuser\n flash[:alert] = \"Reservations can only be cancelled by their owner, an admin, or an instructor.\"\n elsif @reservation.session.started? && !superuser\n flash[:alert] = \"Reservations cannot be cancelled once the session has begun.\" \n else\n @reservation.cancel!\n if @reservation.user == current_user\n flash[ :notice ] = \"Your reservation has been cancelled.\"\n else\n flash[ :notice ] = \"The reservation for #{@reservation.user.name} has been cancelled.\"\n end\n end\n \n if request.referrer.present?\n redirect_to request.referrer\n elsif superuser\n redirect_to survey_results_session_path( @reservation.session )\n else\n redirect_to reservations_path\n end\n end",
"def cancel!\n self.service.deleteObject()\n end",
"def cancel!\n self.service.deleteObject()\n end",
"def cancel!\n Bumbleworks.dashboard.cancel_expression(@fei)\n end",
"def cancel_subscription\n case stripe_customer.subscription.status\n when 'active'\n stripe_customer.cancel_subscription(at_period_end: true)\n when 'trialing'\n stripe_customer.cancel_subscription(at_period_end: false)\n end \n rescue Stripe::StripeError => e\n log_stripe_error(e, \"Unable to cancel your subscription. #{e.message}.\") \n end",
"def cancelled!\n @cancelled = true\n end",
"def destroy\n @one_reg_institution = OneRegInstitution.find(params[:id])\n @one_reg_institution.destroy\n\n respond_to do |format|\n format.html { redirect_to one_reg_institutions_url }\n format.json { head :no_content }\n end\n end",
"def cancel(id)\n http.post(\"/nfse/#{id}/cancel\") do |response|\n respond_with_entity(response, Entities::NfseStatus)\n end\n end",
"def cancel_reservation\n lease_uuid = params[:lease_uuid]\n puts lease_uuid\n cancelReservation(lease_uuid)\n redirect_to my_reservations_path\n end",
"def cancel\n \n reservation = Reservation.where(:id => params[:reservation_id]).first\n room_info = reservation.reservation_rooms.where(:id => params[:res_room]).first \n @booking_information = Reservation.get_cancel_reservation_info(reservation,room_info)\n \n if request.post?\n booking_data = {\n \"itinerary_id\" => params[:itinerary_number],\n \"confirmation_number\" => params[:confirmation_number],\n \"email\" => params[:email]\n }\n \n (HotelService.new).cancel(booking_data)\n \n tooltip = \"Booking Amount: #{room_info.rate}<br/>\n Cancellation Charge: #{room_info.rate - params[:refund].to_f}<br/>\n Refund: #{params[:refund].to_f}\"\n room_info.update_attributes({:status => 'Cancelled',\n :rate => room_info.rate - params[:refund].to_f,\n :taxes_fees => 0,\n :tooltip => tooltip}) \n \n \n UserMailer.cancellation_mail(reservation.user_email,@booking_information).deliver \n reservation.update_total_rate_and_status_and_adults_and_children\n redirect_to reservation_path(params[:reservation_id])\n return \n end\n end",
"def cancel!\n # The simplest way to keep track of cancelled status is to nullify the\n # callback. This should also be optimal for garbage collection.\n @callback = nil\n end",
"def cancel\n \n unless status == :cancelled\n transaction do \n if total_paid > 0\n update(:status => :cancelled, :payment_status => :refunded, :total_paid => 0, :total_pending => total_cost)\n else \n update(:status => :cancelled)\n end\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'cancel_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.canceled_booking)\n charges.each do |charge|\n charge.refund\n end\n end\n end\n\n self\n end",
"def void(identification, options = {})\n response = post(Vindicia::Transaction.cancel({\n :transactions => [{\n :account => { :merchantAccountId => @account_id },\n :merchantTransactionId => identification,\n :sourceIp => options[:ip]\n }]\n }))\n\n if response[:return][:returnCode] == '200' && response[:qtyFail].to_i == 0\n success(response, identification)\n else\n fail(response)\n end\n end",
"def test_cancel\n\n pdef = Ruote.process_definition do\n sequence do\n bravo :flank => true\n alpha\n end\n end\n\n @dashboard.register_participant '.+', Ruote::NullParticipant\n\n wfid = @dashboard.launch(pdef)\n\n @dashboard.wait_for(:alpha)\n @dashboard.wait_for(1)\n\n fei = @dashboard.ps(wfid).expressions[1].fei\n\n @dashboard.cancel(fei)\n\n @dashboard.wait_for(wfid)\n sleep 1.0\n\n assert_nil @dashboard.ps(wfid)\n end",
"def cancel_request(slevomat_id, params)\n path = PATH.sub(':slevomat_id', slevomat_id.to_s).sub(':endpoint_version', @client.endpoint_version)\n result = @client.connection.post path, params\n Error.check_for_error(result)\n result\n end",
"def cancel!\n\t\t\t\t# The simplest way to keep track of cancelled status is to nullify the\n\t\t\t\t# callback. This should also be optimal for garbage collection.\n\t\t\t\t@callback = nil\n\t\t\tend",
"def cancelReservation(lease_uuid)\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s \n cert_path = APP_CONFIG['cert_path']\n \n header = {\"Content-Type\" => \"application/json\"}\n options = {uuid: lease_uuid}\n\n #puts options.to_json \n uri = URI.parse(broker_url+\"/resources/leases\")\n pem = File.read(cert_path)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.cert = OpenSSL::X509::Certificate.new(pem)\n http.key = OpenSSL::PKey::RSA.new(pem)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Delete.new(uri.request_uri, header)\n request.body = options.to_json\n\n response = http.request(request)\n puts response\n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response\n end\n end",
"def cancel\n @user = current_user\n sub = @user.subscription\n subscription = Stripe::Subscription.retrieve(sub)\n subscription.delete\n @user.subscribed = false\n @user.subscription = nil\n if @user.save\n render :ok, json: { message: [\"Subscription will be canceled at the end of the billing period\"] }\n else\n render json: { message: [\"Stripe Customer couldn't be saved.\"] }, status: :unprocessable_entity\n end\n end",
"def cancel\n if !current_user.worksessions.include?(@worksession)\n respond_to do |format|\n format.html {\n redirect_to user_worksessions_path(params[:user_id]), notice: 'You cannot cancel a worksession you are not signed up for.'\n }\n format.json { render :show, status: :created, location: @worksession }\n end\n else\n @user.worksessions.delete(@worksession)\n @worksession.users.delete(@user)\n @user.save\n if (@worksession.date.wday.between?(0, 1) and @worksession.users.size < 8) or (@worksession.date.wday.between?(5, 6) and @worksession.users.size < 4)\n @worksession.free = true\n @worksession.save\n end\n redirect_to available_path(current_user)\n @worksession.save\n end\n end"
] |
[
"0.6103245",
"0.60252124",
"0.60087955",
"0.5811438",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.5707157",
"0.5706176",
"0.5700771",
"0.56697124",
"0.5667243",
"0.56669486",
"0.566521",
"0.56621575",
"0.56609255",
"0.56592524",
"0.5646788",
"0.5643771",
"0.563286",
"0.5624228",
"0.5619812",
"0.5617293",
"0.5596181",
"0.5581513",
"0.55748147",
"0.5556432",
"0.5556432",
"0.5556432",
"0.5556432",
"0.5556432",
"0.5556432",
"0.5548621",
"0.5548263",
"0.55362266",
"0.553317",
"0.55306107",
"0.552818",
"0.55266964",
"0.5525434",
"0.5521792",
"0.5499473",
"0.54829466",
"0.547977",
"0.54543376",
"0.5446703",
"0.54371804",
"0.54101115",
"0.5402378",
"0.5401842",
"0.5382507",
"0.5379049",
"0.535084",
"0.5350229",
"0.5349512",
"0.53461975",
"0.53414005",
"0.53412056",
"0.5340866",
"0.53331214",
"0.5327504",
"0.5327488",
"0.53240097",
"0.53227466",
"0.5295186",
"0.52928585",
"0.5290325",
"0.5288329",
"0.52848625",
"0.5282529",
"0.5279731",
"0.52601343",
"0.52490985",
"0.5239079",
"0.52383536",
"0.52364016",
"0.5232465",
"0.52321833",
"0.5230101",
"0.5230101",
"0.5226737",
"0.522571",
"0.52256167",
"0.52236885",
"0.5217542",
"0.5214392",
"0.5214054",
"0.5209456",
"0.520238",
"0.52007586",
"0.5199885",
"0.5193239",
"0.51900023",
"0.5188469",
"0.518762",
"0.51834685"
] |
0.61293393
|
0
|
You get an array of numbers, return the sum of all of the positives ones. Example [1,4,7,12] => 1 + 7 + 12 = 20 Note: if there is nothing to sum, the sum is default to 0.
|
def positive_sum(arr)
arr.select{|x| x > 0}.reduce(0, :+)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def positive_sum(arr)\r\n sum = 0\r\n arr.each do |number|\r\n if number > 0\r\n sum += number\r\n end\r\n end\r\n sum\r\n end",
"def positive_sum(arr)\n arr.select!{|num| num > 0}\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def sum_of_positive(arr)\n sum = 0\n arr.each do |num|\n if num >= 0\n sum += num \n end\n end\n\n return sum\nend",
"def positive_sum(arr)\n total = 0\n arr.each { |num| total += num if num > 0 }\n\n total\nend",
"def positive_sum(arr)\n arr.select{|x| x > 0}.inject(0, :+)\nend",
"def positive_sum(arr)\n arr.select(&:positive?).inject(0, :+)\nend",
"def positive_sum(arr)\n arr.select{ |element| element > 0 }.reduce(0) { |sum, element| sum + element }\nend",
"def positive_sum(arr)\n arr.select(&:positive?).inject(0,:+)\nend",
"def positive_sum(arr)\n return 0 if arr.size == 0\n arr.inject(0){|sum, el| puts sum; el > 0 ? sum + el : sum}\nend",
"def positive_sum(arr)\n arr != [] ? arr.select {|num| num > 0}.sum() : 0\nend",
"def positive_sum(arr)\n sum = arr.select {|num| num > 0}.reduce(&:+) \n sum == nil ? 0 : sum\nend",
"def positive_sum(arr)\n arr.select{ |num| num.positive?}.sum\nend",
"def sum_of_positive(arr)\n arr.select {|e| e>=0}.sum\nend",
"def sum(array)\n return 0 if array.empty?\n array.inject(:+)\nend",
"def positive_sum(arr)\n t = 0\n p = 0\n while (p<arr.length) do\n if arr[p] > 0\n t += arr[p]\n end\n p += 1\n end\n return t\nend",
"def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend",
"def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend",
"def sum_of_negative(arr)\n sum = 0\n arr.each do |num|\n if num < 0\n sum += num \n end\n end\n\n return sum\nend",
"def sum arr\n return 0 if arr.empty?\n arr.inject(:+)\nend",
"def sum(array)\n return 0 if array.empty?\n return array.first if array.length == 1\n\n array.inject(:+)\nend",
"def sum_positive_count_negative(arr)\n sum = 0\n neg_count = 0\n arr.each do |num|\n if num >= 0\n sum += num \n else\n neg_count += 1\n end\n end\n\n return [sum, neg_count]\nend",
"def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend",
"def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend",
"def sum(in_array)\n return 0 if in_array.length == 0\n return in_array.reduce(:+)\nend",
"def count_sum(array)\n ans = []\n count = 0\n sum = 0\n return [] if array.empty?\n array.each do |n|\n if n > 0\n count += 1\n elsif n < 0\n sum += n\n end\n end\n ans << count\n ans << sum \n return ans\nend",
"def sum_of_sums(numbers)\n numbers_to_add = Array.new\n numbers.each_index do |index|\n numbers_to_add += numbers[0..index]\n end\n numbers_to_add.reduce(:+)\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).reduce(:+)\n end\n sum_total\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).reduce(:+)\n end\n sum_total\nend",
"def sum_of_sums(array)\n total = 0\n until array.size == 0\n total += array.reduce(:+)\n array.pop\n end\n total\nend",
"def sum_of_sums(array)\n results = []\n\n loop do \n break if array.empty?\n results << array.inject(:+)\n array.pop\n end\n\n results.inject(:+)\nend",
"def total array\n array.inject(0){|sum,x| sum + x }\nend",
"def sum(array)\n array.inject(0){|sum, n| sum + n}\n end",
"def count_positive_sum_negative(arr)\n sum = 0\n neg_count = 0\n arr.each do |num|\n if num >= 0\n neg_count += 1\n else\n sum += num\n end\n end\n\n return [neg_count, sum]\nend",
"def sum array\n\tsum = 0\n\tarray.each do |number|\n\t\tsum = sum + number\n\tend\n\tsum\nend",
"def sum(array)\n #return 0 if array.empty?\n #array.reduce(:+)\n \n array.length > 0 ? array.inject(:+) : 0\nend",
"def sum(array)\n\n raise 'array includes non integers' unless \n (array.empty? || array.all? { |x| x.integer?})\n \n array.reduce(0,:+)\n \nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).inject(:+)\n end\n sum_total\nend",
"def sum(array)\n return 0 if array.empty?\n array.first + sum(array[1..-1])\nend",
"def sum_of_sums(numbers)\n (0...numbers.size).reduce(0) { |sum, idx| sum += numbers[0..idx].reduce(:+) }\nend",
"def add_all_numbers(array)\n array.inject(:+)\nend",
"def sum(sums = Array[0])\n retVal = 0;\n sums.each do |i|\n retVal = (retVal + i.to_i);\n end\n retVal;\nend",
"def sum(array)\n array.reduce(0) {|sum, num| sum += num}\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def total(array_of_numbers)\n sum = 0\n array_of_numbers.each do |num|\n sum += num\n end\n return sum\nend",
"def sum arr\n (arr.empty?)? 0 : arr.inject(:+)\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n\n arr.reduce(&:+)\nend",
"def sum_of_sums(array)\n supersum = 0\n array.each_with_index do |_, index|\n supersum += array[0, index + 1].inject(:+)\n end\n supersum\nend",
"def array_sum(arr)\n if arr.length == 0\n return 0\n end\n arr.reduce(:+)\nend",
"def total_of_array(array)\n array.inject(0) {|sum, i| sum + i }\nend",
"def total(array)\n\tanswer=array.inject(0){\n\t\t|sum,i| sum+i\n\t}\n\treturn answer\nend",
"def sum_of_sums(array)\n result = 0\n array.each_index {|idx| result += array[0..idx].sum}\n result\nend",
"def sum(array)\n array.map(&:to_i).reduce(0, :+)\nend",
"def get_sum(array)\n return array.inject (0) { |sum, n| sum + n }\nend",
"def total(array)\n array.inject(0) {|sum, i| sum + i }\nend",
"def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend",
"def sum arr\n sum_array = 0 \n arr.each { |x| sum_array = sum_array + x } \n return sum_array\nend",
"def sum arr\n arr.inject(0){|sum,i| sum + i }\nend",
"def total(array_of_numbers)\n return array_of_numbers.reduce(:+)\nend",
"def sum arr\n arr.inject(0){|sum,n| sum + n }\nend",
"def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n counter = -1\n while counter + 1 > -arr.size\n total_sum += arr.slice(idx..counter).reduce(:+)\n counter -= 1\n end\n total_sum\nend",
"def total(arr)\n\tarr.inject(0) { |x, y| x + y }\nend",
"def total(array)\n\tarray.inject(0) {|sum,x| sum + x}\nend",
"def sum_only_numbers(array)\n ll_sum = 0.0\n if array.length > 0\n for idx in array do\n if idx.is_a?(Numeric)\n ll_sum += idx\n end\n end\n end\n return ll_sum\nend",
"def sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def sum (array)\n y=array.inject(:+).to_i\nend",
"def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n return rtn\nend",
"def sum_of_sums(arr)\n total = 0\n (0..(arr.size - 1)).each { |i| total += arr[0..i].reduce(:+) }\n total\nend",
"def sum(array)\n return 0 if array.empty?\n sum(array.drop(1)) + array.first\nend",
"def sum(array)\n return 0 if array.empty?\n sum(array.drop(1)) + array.first\nend",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend",
"def sum_of_sums(array)\n sum = 0\n array.length.times do |index|\n sum += array[0, index + 1].reduce(&:+)\n end\n sum\nend",
"def strange_sums(array)\n count = 0\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n count += 1 if array[i] + array[j] == 0\n end\n end\n\n count\nend",
"def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend",
"def sum arr\n\ttotal = 0\n\tif arr.size > 0\n\t\ttotal = arr.reduce(:+)\n\tend\n\n\treturn total\nend",
"def sum_of_sums(array)\n sums = []\n index = 0\n loop do\n (0..index).each {|index| sums << array[index]}\n index += 1\n break if index == array.size\n end\n sums.reduce(:+)\nend",
"def total(array)\n array.inject(0) {|total, i| total + i }\nend",
"def sum_only_numbers(an_array)\n total = 0\n num = an_array.each { |a| total += a if a.is_a?(Fixnum)} \n \n return total\nend",
"def sum(array)\n return array.inject(0, &:+)\nend",
"def sum arr\n # return arr.empty? ? 0 : arr.inject(:+)\n arr.inject(0, :+)\nend",
"def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend",
"def findSum()\n\tnumbers.inject(0) { |sum, number| sum + number }\nend",
"def sum(array)\n sum = 0\n\n array.each { |number|\n sum += number\n }\n\n return sum\nend",
"def sum arr\n return arr.inject(0, :+)\nend",
"def total(array)\n sum = 0\n array.inject(:+)\nend",
"def total(array)\n sum = 0\n array.inject(:+)\nend",
"def array_sum(arr)\n if arr.empty?\n 0\n else\n arr.reduce(:+)\nend\nend",
"def sum(anArray)\n if anArray.empty? then\n return 0.0\n else\n total = 0\n anArray.each {|i| total = total + i}\n return total\n end\nend",
"def sum_of_sums(numbers)\n sum = 0\n numbers.size.times do |idx|\n sum += numbers[0..idx].inject(:+)\n end\n \n sum\nend",
"def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend",
"def sum_array(array)\n sum = 0\n\n array.each do |number|\n sum += number\n end\n\n return sum\nend",
"def sum_of_sums1(numbers)\n result = 0\n index_end = 1\n loop do\n numbers[0, index_end].each { |number| result += number }\n break if index_end >= numbers.size\n\n index_end += 1\n end\n result\nend",
"def sum_array(integers)\n integers.inject(0) { |result, element| result + element }\nend",
"def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend",
"def sum arr\n arr.inject(0) { |sum, x| sum += x}\nend",
"def sum(array)\n s = 0\n\tarray.each {|x| s+= x}\n\ts\nend",
"def sum_of_sums(numbers)\n numbers.each_with_index.inject(0) do |result, (_, index)|\n result += numbers[0..index].sum\n result\n end\nend",
"def sum_array(array)\n sum = 0\n array.each do |number|\n sum += number\n end\n sum\nend"
] |
[
"0.8194223",
"0.8155228",
"0.80068475",
"0.796987",
"0.7900624",
"0.78847253",
"0.7822795",
"0.7821847",
"0.7752128",
"0.77304655",
"0.7706112",
"0.76693165",
"0.7596689",
"0.75488156",
"0.74992645",
"0.74900395",
"0.7465904",
"0.7458943",
"0.74519014",
"0.74303967",
"0.73824185",
"0.7334142",
"0.72996515",
"0.7299487",
"0.7294698",
"0.7293695",
"0.7249489",
"0.724879",
"0.7240418",
"0.7235715",
"0.72338957",
"0.7230048",
"0.72286433",
"0.7228617",
"0.7226462",
"0.7206486",
"0.72048575",
"0.72005635",
"0.71914476",
"0.7184517",
"0.7182373",
"0.7173479",
"0.71729386",
"0.71729386",
"0.717222",
"0.7164144",
"0.7142011",
"0.714161",
"0.7134843",
"0.7133622",
"0.7132237",
"0.7128545",
"0.7124972",
"0.7123665",
"0.71235085",
"0.7109575",
"0.7107252",
"0.71025234",
"0.70990026",
"0.70982784",
"0.7096578",
"0.709183",
"0.70871913",
"0.7079219",
"0.7077983",
"0.70698",
"0.70696616",
"0.706861",
"0.7067738",
"0.7067738",
"0.7067533",
"0.70670724",
"0.7065792",
"0.70633113",
"0.7062778",
"0.7062326",
"0.70622057",
"0.7056746",
"0.7049507",
"0.70487285",
"0.7048266",
"0.704373",
"0.7043445",
"0.7041495",
"0.70366037",
"0.70333934",
"0.70333934",
"0.70222074",
"0.7020176",
"0.7018574",
"0.7016109",
"0.70029074",
"0.70014995",
"0.699886",
"0.69977784",
"0.69944316",
"0.699109",
"0.6988919",
"0.69829655"
] |
0.78847736
|
6
|
GET /request_texts GET /request_texts.json
|
def index
@request_texts = RequestText.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def get_texts(params)\n #first, get the relevant canto and its stanzas\n canto = Canto.find_by_name(params['canto'])\n @stanzas = Stanza.where(canto_id: canto.id).includes(:stanza_translations).order(:number)\n case params[\"view\"]\n #if user wants to view a text without annotations, select the relevant translations\n when \"no_annotations\" # get text of the original poem or of one of its translations\n translation = Translation.find_by_name(params[:text])\n stanza_translations = extract_translations(translation)\n when \"asimov_annotations\"\n stanza_translations = extract_translations(Translation.first)\n when \"parallel_texts\"\n stanza_translations = parallel_texts_collection(params)\n end\n stanza_translations\n end",
"def get\n text_file = TextFile.find_by(name: params['name'])\n response = {}\n if text_file\n response = create_response(text_file)\n end\n render json: response\n end",
"def get_text\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/textItems'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['TextItems']['List'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def text\n # insufficient parameters\n if !params.has_key?(:utar_id) || !params.has_key?(:utar_password)\n @result = {:message => 'No utar credential specified'}\n render json: @result, :status => 400\n return\n end\n\n # find student from database\n student = Student.find_by(:utar_id => params[:utar_id])\n if(!student)\n @result = {:message => 'Student not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n # check if campus is valid\n if(!Mechanizor.is_campus_valid?(student.campus))\n @result = {:message => 'Student campus error'}\n render json: @result, :status => 403\n return\n end\n\n # find the subject\n # use integer value of enum on find_by and new , eg: student[:campus] instead of student.campus\n subject = Subject.find_by(:code => params[:code], :campus => student[:campus])\n if(!subject)\n @result = {:message => 'Subject not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n @subject_texts = Mechanizor.get_subject_text(params[:utar_id], params[:utar_password], subject.url, subject.code, student.campus)\n\n if !@subject_texts\n @result = {:message => 'Error accessing WBLE or student does not have this subject'}\n render json: @result, :status => 403\n return\n end\n\n @result = {:message => 'Successfully retrieved text for subject', :texts => @subject_texts}\n render json: @result\n end",
"def lookup text\r\n result = self.class.get '/lookup', { query:{ key:@@api_key, lang:@@lang, text:text } }\r\n check_result result \r\n end",
"def index\n @instructor_texts = InstructorText.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instructor_texts }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def index\n @texts = Text.all\n end",
"def index\n @texts = Text.all\n end",
"def index\n @api_v1_custom_texts = Api::V1::CustomText.all\n end",
"def texts(types)\n Apis.client.get(\"/weather/texts?types=#{types.join(',')}\")\n end",
"def index\n @texts = Text.order(:id).page(params[:page])\n end",
"def set_request_text\n @request_text = RequestText.find(params[:id])\n end",
"def get_language_text_with_http_info(language_code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguagesApi#get_language_text ...\"\n end\n \n # verify the required parameter 'language_code' is set\n fail \"Missing the required parameter 'language_code' when calling get_language_text\" if language_code.nil?\n \n # resource path\n local_var_path = \"/languages/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = language_code\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n 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 => 'LanguageDictionary')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguagesApi#get_language_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @text_entry = TextEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_entry }\n end\n end",
"def get_text\n Net::HTTP.get(URI('http://' + url.gsub(/http:\\/\\//,''))).downcase.split(//)#gsub(/[[:[punct]:]:]/, ' ').downcase.gsub(/\\s+/, @@end_token).split(//)\n end",
"def ms_translate(text)\n https = Net::HTTP.new(@uri.host, @uri.port)\n https.use_ssl = true\n begin\n req = Net::HTTP::Post.new(@uri.request_uri, @headers)\n req.body = [{ 'Text' => text }].to_json\n response = https.request(req)\n return response_body(response)\n rescue StandardError => ex\n puts \"ERROR: #{ex.message}\"\n end\n end",
"def get_phrases(word, *args)\n http_method = :get\n path = '/word/{word}/phrases'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @text = this_class.find(params[:id])\n return forbidden if not authorized? :show, @text\n @words = @text.words.page params[:page]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text }\n end\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def speak\n speak_what = params[:text_to_speak]\n logger.debug \"speak_what=#{speak_what}\"\n if !speak_what.present? then return end\n speak_what_encoded = ERB::Util.url_encode(speak_what)\n logger.debug \"speak_what_encoded=#{speak_what_encoded}\"\n uri = \"#{HOST}:#{PORT}/sayall/#{speak_what_encoded}\"\n begin\n logger.debug \"uri=#{uri}\"\n response = open(uri).read \n rescue ActionController::UnknownFormat => e\n if e.include? '204'\n # do nothing\n else\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e\n end\n rescue Exception => e\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e \n end\n redirect_to :controller => 'presets', :action => 'display'\n end",
"def get_document_text_items(request)\n data, _status_code, _headers = get_document_text_items_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def param_text\n\n params[Constants::REQUEST_PARAM_TEXT]\n\n end",
"def request_text_params\n params.require(:request_text).permit(:name, :email, :website, :body, :ip)\n end",
"def detect text, format = :plain\n request = URI.encode \"#{@api_uri}/detect?text=#{text}&format=#{format}\"\n response = open request\n json_hash = JSON.parse response.read\n code = json_hash[\"code\"].to_i\n lang = json_hash[\"lang\"]\n result = Hash.new\n result = {\"code\" => code, \"lang\" => lang}\n return result\n end",
"def index\n @api_v1_text_fields = Api::V1::TextField.all\n end",
"def index\n @text_messages = TextMessage.all\n end",
"def index\n @static_texts = StaticText.all\n end",
"def get_all\n get_docs\n get_text\n return JSON.pretty_generate(@data)\n end",
"def get_keywords_for_text(retina_name, body)\n resource_path = '/text/keywords'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name }\n post_data = body\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n\n JSON.parse(response.body, symbolize_names: true)\n end",
"def show\n @user = User.find(params[:id])\n @texts = Text.where({user_id: current_user.id})\n respond_to do |format|\n format.html{}\n format.json {render json: @user}\n\n end\n end",
"def get_words\n response = HTTParty.get('http://linkedin-reach.hagbpyjegb.us-west-2.elasticbeanstalk.com/words')\n converted_response = response.parsed_response\nend",
"def index\n @text_messages = TextMessage.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @text_messages, callback: params[:callback] }\n format.xml { render xml: @text_messages }\n end\n end",
"def index\n @text_contents = TextContent.all\n end",
"def getToolsStopwords( text)\n params = Hash.new\n params['text'] = text\n return doCurl(\"get\",\"/tools/stopwords\",params)\n end",
"def sentiment(text)\r\n return iod_request('analyzesentiment',\r\n {:text => text, :language => $sentiment_language, :apikey => $api_key})\r\nend",
"def read_text(name, extension = '.json')\n File.read(\n [\n __FILE__.gsub(%r{(?<=/spec/).*}, ''),\n 'texts/',\n name,\n extension\n ].join\n )\nend",
"def text_from_api(input)\n OutAPI::TextMapper\n .new(JSON.parse(Api.config.GOOGLE_CREDS), Api.config.UNSPLASH_ACCESS_KEY)\n .process(input[:decode_text])\n rescue StandardError\n raise API_NOT_FOUND_MSG\n end",
"def get_page_text_with_http_info(name, page_number, llx, lly, urx, ury, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_page_text ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'llx' is set\n if @api_client.config.client_side_validation && llx.nil?\n fail ArgumentError, \"Missing the required parameter 'llx' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'lly' is set\n if @api_client.config.client_side_validation && lly.nil?\n fail ArgumentError, \"Missing the required parameter 'lly' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'urx' is set\n if @api_client.config.client_side_validation && urx.nil?\n fail ArgumentError, \"Missing the required parameter 'urx' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'ury' is set\n if @api_client.config.client_side_validation && ury.nil?\n fail ArgumentError, \"Missing the required parameter 'ury' when calling PdfApi.get_page_text\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/text\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'LLX'] = llx\n query_params[:'LLY'] = lly\n query_params[:'URX'] = urx\n query_params[:'URY'] = ury\n query_params[:'format'] = @api_client.build_collection_param(opts[:'format'], :csv) if !opts[:'format'].nil?\n query_params[:'regex'] = opts[:'regex'] if !opts[:'regex'].nil?\n query_params[:'splitRects'] = opts[:'split_rects'] if !opts[:'split_rects'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'TextRectsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_page_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n format.json do\n # render :json => @translated_word.to_json(:include => { :word => { :only => :text } })\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def sent_messages\n get('/direct_messages/sent.json')\n end",
"def index\n scope = Request.user_or_admin(current_user)\n scope = scope.order('updated_at DESC')\n \n @requests = scope.includes(:car).includes(:messages => :user).page params[:page]\n\n # Если нет ни одного запроса, то перекидываем \n # к машинам с сохранением флэша\n unless @requests.present?\n flash.keep\n redirect_to cars_path and return\n end\n\n content_for :title, \"Список запросов\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @requests }\n end\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def api_v1_custom_text_params\n params.fetch(:api_v1_custom_text, {})\n end",
"def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def destroy\n @request_text.destroy\n respond_to do |format|\n format.html { redirect_to request_texts_url }\n format.json { head :no_content }\n end\n end",
"def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end",
"def text\n result_hash['text']\n end",
"def index\n @text_contents = TextContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @text_contents }\n end\n end",
"def index\n respond_to do |format|\n format.json { render :json => Phrase.all }\n end\n end",
"def get_source_text\n response = @api.get(@cloud.url_downloads(\"source-text?pid=#{@process_id}\"), parse_json: false, no_callbacks: true, token: @cloud.access_token.token)\n response\n end",
"def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def index\n @textlines = Textline.all\n end",
"def response\n self.textual_response\n end",
"def text_params\n params.require(:text).permit(:text)\n end",
"def index\n\t\trespond_with( {:error => 'You must provide a word.' }, :status => 422 ) # http 422 is unprocessible entity / malformed request\n\tend",
"def create\n @request_text = RequestText.new(request_text_params)\n \n @request_text.ip = request.remote_ip\n\n respond_to do |format|\n if @request_text.save\n format.html { redirect_to '/', notice: 'Request text was successfully created.' }\n format.json { render action: 'show', status: :created, location: @request_text }\n else\n format.html { render action: 'new' }\n format.json { render json: @request_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_to_api_ai(text)\n client = ApiAiRuby::Client.new(:client_access_token => ACCESS_TOKEN())\n return client.text_request(text)\n end",
"def texts; end",
"def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end",
"def returnTextFileApi\n question_type = params[:question_type]\n question_number = params[:question_number].to_i\n submission_id = params[:submission_id]\n submission = Submission.find(submission_id)\n if !submission.nil? && submission.answers[question_number][\"question_type\"] == question_type\n if question_type == \"2\"\n if submission.answers[question_number][\"answer_id\"].nil? \n render :json => {:answer => submission.answers[question_number][\"answer_text\"],:question => submission.answers[question_number][\"question_text\"] }\n else\n text_result = TextUpload.find(submission.answers[question_number][\"answer_id\"])\n render :json => {:answer => text_result.text , :question => submission.answers[question_number][\"question_text\"] }\n end\n elsif question_type == \"3\"\n render :json =>{:answer => submission.answers[question_number][\"file_link\"], :question => submission.answers[question_number][\"file_text\"], :file_size => submission.answers[question_number][\"file_size\"] } \n end\n else\n render plain: \"error\"\n end\n end",
"def get_document_text_annotations_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_text_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_text_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/text\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'TextAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_text_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @text_files = TextFile.all\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def show\n @intertext = Intertext.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intertext }\n end\n end",
"def response(word)\n url = 'https://api.dictionaryapi.dev/api/v2/entries/en_US/'+word\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json_data = JSON.parse(response)\n end",
"def get_document_text_annotations(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_text_annotations_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_text_annotations_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end",
"def request_translation(params = {})\n response = Unirest.post(\"#{Unbabel::Client::ENDPOINT}/translation/\",\n parameters: params.to_json)\n response.body\n end",
"def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def index\n @site_texts = SiteText.all\n end",
"def request_trending\n base_uri = 'http://localhost:8888/developers'\n response = RestClient.get( base_uri, { params: { language: cleaned_query_param } } )\n @data = JSON.parse(response) \n end",
"def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def index\n @texters = Texter.all\n end",
"def text_params\n params.require(:text).permit(:tweet_id, :user_id, :content, :create_datetime)\n end",
"def index\n params.permit(:message)\n\n assistant = IBMWatson::AssistantV1.new(\n version: \"2018-09-20\",\n username: \"ebbfae24-aaba-403c-8f06-b11b5ae7ce81\",\n password: \"b7ij6FUSNHdt\",\n url:\"https://gateway.watsonplatform.net/assistant/api\",\n iam_apikey: \"XOIijyk6xzJeEmjeVlvnJHhGUomigWWu_xKo1WcMiIiz\"\n )\n\n response = assistant.message(\n workspace_id: \"98aec387-baa5-4161-a891-09cb44317cf3\",\n input: {\n text: params[:message]\n }\n )\n @result = response.result\n render json: @result\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def get_content_from_server(language)\n Browser::HTTP.get(\"try_ruby_#{language}.json\") do\n on :success do |response|\n TryRuby.instance.update_json(response.json)\n end\n\n on :failure do |response|\n puts \"\\nWhoops! Loading the tutorial failed \" \\\n \"(status = #{response.status_code}).\\n\" \\\n \"Please reload the page.\"\n end\n end\n end",
"def get_bigrams_internal(word, *args)\n http_method = :get\n path = '/word/{word}/phrasesInternal'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def sentiment_from_text text_content:\n # [START language_sentiment_text]\n # text_content = \"Text to run sentiment analysis on\"\n\n require \"google/cloud/language\"\n\n language = Google::Cloud::Language.language_service\n\n document = { content: text_content, type: :PLAIN_TEXT }\n response = language.analyze_sentiment document: document\n\n sentiment = response.document_sentiment\n\n puts \"Overall document sentiment: (#{sentiment.score})\"\n puts \"Sentence level sentiment:\"\n\n sentences = response.sentences\n\n sentences.each do |sentence|\n sentiment = sentence.sentiment\n puts \"#{sentence.text.content}: (#{sentiment.score})\"\n end\n # [END language_sentiment_text]\nend",
"def index\n @text_samples = TextSample.all\n end",
"def perform(id, texts, is_tokenized: false)\n params = { id: id, texts: texts, is_tokenized: is_tokenized }\n response = HTTP.post(\"#{@host}/encode\", json: params)\n embeddings = JSON.parse(response.to_s)['result']\n embeddings\n end",
"def index\n @add_texts = AddText.all\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def text_test\n params.inspect\n # Parameters: \n # {\"ToCountry\"=>\"US\", \n # \"ToState\"=>\"UT\", \n # \"SmsMessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"NumMedia\"=>\"0\", \n # \"ToCity\"=>\"PARK CITY\", \n # \"FromZip\"=>\"84770\", \n # \"SmsSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"FromState\"=>\"UT\", \n # \"SmsStatus\"=>\"received\", \n # \"FromCity\"=>\"ST GEORGE\", \n # \"Body\"=>\"testing 5678\", \n # \"FromCountry\"=>\"US\", \n # \"To\"=>\"+14352141844\", \n # \"ToZip\"=>\"84098\", \n # \"NumSegments\"=>\"1\", \n # \"MessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"AccountSid\"=>\"ACfb03eaaab63e59c4a90d5bf07b5f6f70\", \n # \"From\"=>\"+14356691878\", \n # \"ApiVersion\"=>\"2010-04-01\"}\n from = params[:From]\n\n end",
"def translate(texts, opts={})\n texts = Array(texts)\n if opts[:to].instance_of?(Array)\n return multiple_translate(texts, opts)\n end\n\n opts.merge!(:to => set_target(texts)) if opts[:to].nil?\n\n result, threads = [], []\n texts.each_with_index do |text, i|\n url = urlize(text, opts)\n threads << Thread.new(url, i) do |site, no|\n result << [no, send_request(site)]\n end\n end\n threads.each { |th| th.join }\n\n result.sort_by { |n, _| n }.map { |_, res| parse(res) }\n end",
"def text_params\n params.require(:text).permit(:to, :from, :text, :token)\n end",
"def received_text\n message = params['events'][0]['message']\n if message.nil?\n nil\n else\n message['text']\n end\n end",
"def hnl_http_get_text(uri, include_http_response = false)\n # setup the request\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n # make the request\n response = http.request(request)\n # and return the result\n return [response.body, response] if include_http_response\n response.body\n end",
"def show\r\n @text_activity = TextActivity.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @text_activity }\r\n end\r\n end",
"def messages\n get_json('messages.json')\n end",
"def analyze(text, analysis_params)\n request(:get, \"_analyze\", analysis_params) do |req|\n req.body = text\n end\n end",
"def get_examples_for_words(body, *args)\n http_method = :post\n path = '/words/examples'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def getToolsStem( text)\n params = Hash.new\n params['text'] = text\n return doCurl(\"get\",\"/tools/stem\",params)\n end",
"def suitable_locale_text(texts)\n english = texts.select { |t| english_locales.include? t[\"locale\"] }\n (english + texts).first[\"text\"]\n end",
"def stats\n Project.hit 15\n Project.hit 32\n @stats = time_data TextMessage.all\n @cloud = word_cloud TextMessage.pluck(:text)\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(TextMessage.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(TextMessage.all, :hash) }\n end\n end"
] |
[
"0.65497273",
"0.6340287",
"0.63128537",
"0.61542857",
"0.6130874",
"0.60848445",
"0.59647423",
"0.5940359",
"0.5923374",
"0.5923374",
"0.5897322",
"0.58849394",
"0.5850994",
"0.58053637",
"0.5800679",
"0.5783335",
"0.57830423",
"0.5680339",
"0.56663704",
"0.56231683",
"0.5607075",
"0.5587682",
"0.5584466",
"0.5571251",
"0.5557204",
"0.55302745",
"0.5511855",
"0.5509592",
"0.5508027",
"0.5499469",
"0.5480432",
"0.5468053",
"0.5465643",
"0.5462356",
"0.54446274",
"0.54436225",
"0.5442287",
"0.54334915",
"0.54155713",
"0.5403209",
"0.5391829",
"0.5390752",
"0.53900164",
"0.53824776",
"0.5379452",
"0.5367878",
"0.53648895",
"0.53648895",
"0.53643763",
"0.53616756",
"0.5352241",
"0.5346548",
"0.5345553",
"0.5340793",
"0.5336014",
"0.5309244",
"0.5306704",
"0.53026336",
"0.5300074",
"0.5299353",
"0.52987516",
"0.52964777",
"0.52951986",
"0.52916914",
"0.52771",
"0.52767754",
"0.5271182",
"0.5270719",
"0.5267453",
"0.52647245",
"0.5259032",
"0.5257381",
"0.52496225",
"0.5249256",
"0.5247199",
"0.52456456",
"0.52396435",
"0.52375525",
"0.52336055",
"0.5222308",
"0.52192223",
"0.52188706",
"0.5218787",
"0.5210569",
"0.5210477",
"0.5207636",
"0.52045375",
"0.52013314",
"0.51891255",
"0.5179432",
"0.51759726",
"0.51732343",
"0.5172309",
"0.51652914",
"0.5163825",
"0.5158635",
"0.515828",
"0.51579434",
"0.5154588",
"0.51523715"
] |
0.74384046
|
0
|
GET /request_texts/1 GET /request_texts/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @request_texts = RequestText.all\n end",
"def get\n text_file = TextFile.find_by(name: params['name'])\n response = {}\n if text_file\n response = create_response(text_file)\n end\n render json: response\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def get_texts(params)\n #first, get the relevant canto and its stanzas\n canto = Canto.find_by_name(params['canto'])\n @stanzas = Stanza.where(canto_id: canto.id).includes(:stanza_translations).order(:number)\n case params[\"view\"]\n #if user wants to view a text without annotations, select the relevant translations\n when \"no_annotations\" # get text of the original poem or of one of its translations\n translation = Translation.find_by_name(params[:text])\n stanza_translations = extract_translations(translation)\n when \"asimov_annotations\"\n stanza_translations = extract_translations(Translation.first)\n when \"parallel_texts\"\n stanza_translations = parallel_texts_collection(params)\n end\n stanza_translations\n end",
"def show\n @text_entry = TextEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_entry }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def get_text\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/textItems'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['TextItems']['List'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def set_request_text\n @request_text = RequestText.find(params[:id])\n end",
"def lookup text\r\n result = self.class.get '/lookup', { query:{ key:@@api_key, lang:@@lang, text:text } }\r\n check_result result \r\n end",
"def text\n # insufficient parameters\n if !params.has_key?(:utar_id) || !params.has_key?(:utar_password)\n @result = {:message => 'No utar credential specified'}\n render json: @result, :status => 400\n return\n end\n\n # find student from database\n student = Student.find_by(:utar_id => params[:utar_id])\n if(!student)\n @result = {:message => 'Student not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n # check if campus is valid\n if(!Mechanizor.is_campus_valid?(student.campus))\n @result = {:message => 'Student campus error'}\n render json: @result, :status => 403\n return\n end\n\n # find the subject\n # use integer value of enum on find_by and new , eg: student[:campus] instead of student.campus\n subject = Subject.find_by(:code => params[:code], :campus => student[:campus])\n if(!subject)\n @result = {:message => 'Subject not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n @subject_texts = Mechanizor.get_subject_text(params[:utar_id], params[:utar_password], subject.url, subject.code, student.campus)\n\n if !@subject_texts\n @result = {:message => 'Error accessing WBLE or student does not have this subject'}\n render json: @result, :status => 403\n return\n end\n\n @result = {:message => 'Successfully retrieved text for subject', :texts => @subject_texts}\n render json: @result\n end",
"def index\n @instructor_texts = InstructorText.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instructor_texts }\n end\n end",
"def index\n @api_v1_custom_texts = Api::V1::CustomText.all\n end",
"def index\n @texts = Text.all\n end",
"def index\n @texts = Text.all\n end",
"def index\n @texts = Text.order(:id).page(params[:page])\n end",
"def get_language_text_with_http_info(language_code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguagesApi#get_language_text ...\"\n end\n \n # verify the required parameter 'language_code' is set\n fail \"Missing the required parameter 'language_code' when calling get_language_text\" if language_code.nil?\n \n # resource path\n local_var_path = \"/languages/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = language_code\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n 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 => 'LanguageDictionary')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LanguagesApi#get_language_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end",
"def read_text(name, extension = '.json')\n File.read(\n [\n __FILE__.gsub(%r{(?<=/spec/).*}, ''),\n 'texts/',\n name,\n extension\n ].join\n )\nend",
"def destroy\n @request_text.destroy\n respond_to do |format|\n format.html { redirect_to request_texts_url }\n format.json { head :no_content }\n end\n end",
"def show\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n format.json do\n # render :json => @translated_word.to_json(:include => { :word => { :only => :text } })\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def returnTextFileApi\n question_type = params[:question_type]\n question_number = params[:question_number].to_i\n submission_id = params[:submission_id]\n submission = Submission.find(submission_id)\n if !submission.nil? && submission.answers[question_number][\"question_type\"] == question_type\n if question_type == \"2\"\n if submission.answers[question_number][\"answer_id\"].nil? \n render :json => {:answer => submission.answers[question_number][\"answer_text\"],:question => submission.answers[question_number][\"question_text\"] }\n else\n text_result = TextUpload.find(submission.answers[question_number][\"answer_id\"])\n render :json => {:answer => text_result.text , :question => submission.answers[question_number][\"question_text\"] }\n end\n elsif question_type == \"3\"\n render :json =>{:answer => submission.answers[question_number][\"file_link\"], :question => submission.answers[question_number][\"file_text\"], :file_size => submission.answers[question_number][\"file_size\"] } \n end\n else\n render plain: \"error\"\n end\n end",
"def show\n @intertext = Intertext.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intertext }\n end\n end",
"def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end",
"def show\n @text = this_class.find(params[:id])\n return forbidden if not authorized? :show, @text\n @words = @text.words.page params[:page]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text }\n end\n end",
"def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def index\n @api_v1_text_fields = Api::V1::TextField.all\n end",
"def show\n @user = User.find(params[:id])\n @texts = Text.where({user_id: current_user.id})\n respond_to do |format|\n format.html{}\n format.json {render json: @user}\n\n end\n end",
"def get_document_text_annotations_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_text_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_text_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/text\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'TextAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_text_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def get_text\n Net::HTTP.get(URI('http://' + url.gsub(/http:\\/\\//,''))).downcase.split(//)#gsub(/[[:[punct]:]:]/, ' ').downcase.gsub(/\\s+/, @@end_token).split(//)\n end",
"def index\n @text_contents = TextContent.all\n end",
"def show\r\n @text_activity = TextActivity.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @text_activity }\r\n end\r\n end",
"def index\n respond_to do |format|\n format.json { render :json => Phrase.all }\n end\n end",
"def create\n @request_text = RequestText.new(request_text_params)\n \n @request_text.ip = request.remote_ip\n\n respond_to do |format|\n if @request_text.save\n format.html { redirect_to '/', notice: 'Request text was successfully created.' }\n format.json { render action: 'show', status: :created, location: @request_text }\n else\n format.html { render action: 'new' }\n format.json { render json: @request_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def texts(types)\n Apis.client.get(\"/weather/texts?types=#{types.join(',')}\")\n end",
"def detect text, format = :plain\n request = URI.encode \"#{@api_uri}/detect?text=#{text}&format=#{format}\"\n response = open request\n json_hash = JSON.parse response.read\n code = json_hash[\"code\"].to_i\n lang = json_hash[\"lang\"]\n result = Hash.new\n result = {\"code\" => code, \"lang\" => lang}\n return result\n end",
"def show\n @text = Text.find(params[:id])\n end",
"def text_from_api(input)\n OutAPI::TextMapper\n .new(JSON.parse(Api.config.GOOGLE_CREDS), Api.config.UNSPLASH_ACCESS_KEY)\n .process(input[:decode_text])\n rescue StandardError\n raise API_NOT_FOUND_MSG\n end",
"def get_phrases(word, *args)\n http_method = :get\n path = '/word/{word}/phrases'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def sentiment(text)\r\n return iod_request('analyzesentiment',\r\n {:text => text, :language => $sentiment_language, :apikey => $api_key})\r\nend",
"def ms_translate(text)\n https = Net::HTTP.new(@uri.host, @uri.port)\n https.use_ssl = true\n begin\n req = Net::HTTP::Post.new(@uri.request_uri, @headers)\n req.body = [{ 'Text' => text }].to_json\n response = https.request(req)\n return response_body(response)\n rescue StandardError => ex\n puts \"ERROR: #{ex.message}\"\n end\n end",
"def text\n result_hash['text']\n end",
"def get_page_text_with_http_info(name, page_number, llx, lly, urx, ury, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_page_text ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'llx' is set\n if @api_client.config.client_side_validation && llx.nil?\n fail ArgumentError, \"Missing the required parameter 'llx' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'lly' is set\n if @api_client.config.client_side_validation && lly.nil?\n fail ArgumentError, \"Missing the required parameter 'lly' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'urx' is set\n if @api_client.config.client_side_validation && urx.nil?\n fail ArgumentError, \"Missing the required parameter 'urx' when calling PdfApi.get_page_text\"\n end\n # verify the required parameter 'ury' is set\n if @api_client.config.client_side_validation && ury.nil?\n fail ArgumentError, \"Missing the required parameter 'ury' when calling PdfApi.get_page_text\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/text\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'LLX'] = llx\n query_params[:'LLY'] = lly\n query_params[:'URX'] = urx\n query_params[:'URY'] = ury\n query_params[:'format'] = @api_client.build_collection_param(opts[:'format'], :csv) if !opts[:'format'].nil?\n query_params[:'regex'] = opts[:'regex'] if !opts[:'regex'].nil?\n query_params[:'splitRects'] = opts[:'split_rects'] if !opts[:'split_rects'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'TextRectsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_page_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_source_text\n response = @api.get(@cloud.url_downloads(\"source-text?pid=#{@process_id}\"), parse_json: false, no_callbacks: true, token: @cloud.access_token.token)\n response\n end",
"def index\n @text_contents = TextContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @text_contents }\n end\n end",
"def update\n respond_to do |format|\n if @request_text.update(request_text_params)\n format.html { redirect_to @request_text, notice: 'Request text was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @text_messages = TextMessage.all\n end",
"def get_text_multimedias(course_id)\r\n relative_url = PATH_COURSES_TEXTMULTIMEDIAS % [course_id]\r\n return get(relative_url)\r\n end",
"def speak\n speak_what = params[:text_to_speak]\n logger.debug \"speak_what=#{speak_what}\"\n if !speak_what.present? then return end\n speak_what_encoded = ERB::Util.url_encode(speak_what)\n logger.debug \"speak_what_encoded=#{speak_what_encoded}\"\n uri = \"#{HOST}:#{PORT}/sayall/#{speak_what_encoded}\"\n begin\n logger.debug \"uri=#{uri}\"\n response = open(uri).read \n rescue ActionController::UnknownFormat => e\n if e.include? '204'\n # do nothing\n else\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e\n end\n rescue Exception => e\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e \n end\n redirect_to :controller => 'presets', :action => 'display'\n end",
"def get_page_text_annotations_with_http_info(name, page_number, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_page_text_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_page_text_annotations\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.get_page_text_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/annotations/text\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'TextAnnotationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_page_text_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @corpus = Corpus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus }\n end\n end",
"def index\n @textlines = Textline.all\n end",
"def index\n @static_texts = StaticText.all\n end",
"def show\n @instructor_text = InstructorText.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor_text }\n end\n end",
"def api_v1_custom_text_params\n params.fetch(:api_v1_custom_text, {})\n end",
"def show\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sentence }\n end\n end",
"def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end",
"def response\n self.textual_response\n end",
"def get_keywords_for_text(retina_name, body)\n resource_path = '/text/keywords'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name }\n post_data = body\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_all\n get_docs\n get_text\n return JSON.pretty_generate(@data)\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n params.permit(:message)\n\n assistant = IBMWatson::AssistantV1.new(\n version: \"2018-09-20\",\n username: \"ebbfae24-aaba-403c-8f06-b11b5ae7ce81\",\n password: \"b7ij6FUSNHdt\",\n url:\"https://gateway.watsonplatform.net/assistant/api\",\n iam_apikey: \"XOIijyk6xzJeEmjeVlvnJHhGUomigWWu_xKo1WcMiIiz\"\n )\n\n response = assistant.message(\n workspace_id: \"98aec387-baa5-4161-a891-09cb44317cf3\",\n input: {\n text: params[:message]\n }\n )\n @result = response.result\n render json: @result\n end",
"def new\n @textanswer = Textanswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def get_document_text_annotations(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_text_annotations_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_text_annotations_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def param_text\n\n params[Constants::REQUEST_PARAM_TEXT]\n\n end",
"def index\n @text_files = TextFile.all\n end",
"def sentiment_from_text text_content:\n # [START language_sentiment_text]\n # text_content = \"Text to run sentiment analysis on\"\n\n require \"google/cloud/language\"\n\n language = Google::Cloud::Language.language_service\n\n document = { content: text_content, type: :PLAIN_TEXT }\n response = language.analyze_sentiment document: document\n\n sentiment = response.document_sentiment\n\n puts \"Overall document sentiment: (#{sentiment.score})\"\n puts \"Sentence level sentiment:\"\n\n sentences = response.sentences\n\n sentences.each do |sentence|\n sentiment = sentence.sentiment\n puts \"#{sentence.text.content}: (#{sentiment.score})\"\n end\n # [END language_sentiment_text]\nend",
"def response(word)\n url = 'https://api.dictionaryapi.dev/api/v2/entries/en_US/'+word\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json_data = JSON.parse(response)\n end",
"def send_to_api_ai(text)\n client = ApiAiRuby::Client.new(:client_access_token => ACCESS_TOKEN())\n return client.text_request(text)\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end",
"def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\trespond_with( {:error => 'You must provide a word.' }, :status => 422 ) # http 422 is unprocessible entity / malformed request\n\tend",
"def new\n @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end",
"def index\n @text_messages = TextMessage.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @text_messages, callback: params[:callback] }\n format.xml { render xml: @text_messages }\n end\n end",
"def validate_text(text)\n response = RestClient.post \"#{BASE_URI}/?out=json\", text, HEADERS\n @json = JSON.parse(response.body)\n @errors = retrieve_errors\n end",
"def get_content_from_server(language)\n Browser::HTTP.get(\"try_ruby_#{language}.json\") do\n on :success do |response|\n TryRuby.instance.update_json(response.json)\n end\n\n on :failure do |response|\n puts \"\\nWhoops! Loading the tutorial failed \" \\\n \"(status = #{response.status_code}).\\n\" \\\n \"Please reload the page.\"\n end\n end\n end",
"def text_params\n params.require(:text).permit(:tweet_id, :user_id, :content, :create_datetime)\n end",
"def show_by_translation\n @translated_word = TranslatedWord.find_by_translation(params[:translation])\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def index\n @texters = Texter.all\n end",
"def text page\n @client.text page\n end",
"def index\n @add_texts = AddText.all\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def request_text_params\n params.require(:request_text).permit(:name, :email, :website, :body, :ip)\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def get_text_annotation_with_http_info(name, annotation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_text_annotation ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_text_annotation\"\n end\n # verify the required parameter 'annotation_id' is set\n if @api_client.config.client_side_validation && annotation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'annotation_id' when calling PdfApi.get_text_annotation\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/annotations/text/{annotationId}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'annotationId' + '}', annotation_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'TextAnnotationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_text_annotation\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @reminder_phrase = ReminderPhrase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder_phrase }\n end\n end",
"def convert_document_autodetect_to_txt_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_autodetect_to_txt ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_autodetect_to_txt\"\n end\n # resource path\n local_var_path = '/convert/autodetect/to/txt'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'textFormattingMode'] = opts[:'text_formatting_mode'] if !opts[:'text_formatting_mode'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'TextConversionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_autodetect_to_txt\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @txt5 = Txt5.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @txt5 }\n end\n end",
"def show\n @txt3 = Txt3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @txt3 }\n end\n end",
"def getToolsStopwords( text)\n params = Hash.new\n params['text'] = text\n return doCurl(\"get\",\"/tools/stopwords\",params)\n end",
"def help_text\n options = {question_pairing_id: params[:question_pairing_id]}\n options[:disability_ids] = params[:disability_ids].split(',') if params[:disability_ids].present?\n\n @help_text = QuestionPairingDisability.with_names(options)\n\n respond_to do |format|\n format.html { render layout: 'fancybox'}\n format.json { render json: @data }\n end\n\n end",
"def index\n @text_samples = TextSample.all\n end",
"def json_get\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n write_json @note if @note\n render :nothing => true\n end",
"def get_word(word, *args)\n http_method = :get\n path = '/word/{word}'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def perform(id, texts, is_tokenized: false)\n params = { id: id, texts: texts, is_tokenized: is_tokenized }\n response = HTTP.post(\"#{@host}/encode\", json: params)\n embeddings = JSON.parse(response.to_s)['result']\n embeddings\n end",
"def new\r\n @text_activity = TextActivity.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @text_activity }\r\n end\r\n end",
"def text_params\n params.require(:text).permit(:text)\n end"
] |
[
"0.71680796",
"0.64562637",
"0.6167204",
"0.6164141",
"0.6126681",
"0.611253",
"0.6074115",
"0.6062396",
"0.6035272",
"0.6016303",
"0.5938826",
"0.5924549",
"0.5897851",
"0.5897851",
"0.58521515",
"0.5750596",
"0.5712206",
"0.5697288",
"0.5663135",
"0.56581277",
"0.5657775",
"0.5653582",
"0.56440383",
"0.5643347",
"0.56283325",
"0.5609379",
"0.5581474",
"0.55744714",
"0.55736244",
"0.55664355",
"0.5547619",
"0.5542445",
"0.55300015",
"0.5526976",
"0.5516925",
"0.5512546",
"0.5498449",
"0.5488317",
"0.548587",
"0.5484876",
"0.5479456",
"0.5465853",
"0.54525226",
"0.5450684",
"0.54334885",
"0.5430931",
"0.5429739",
"0.5416148",
"0.540965",
"0.5401445",
"0.5399616",
"0.5388345",
"0.53839505",
"0.53748125",
"0.53680545",
"0.53572536",
"0.53457487",
"0.5344526",
"0.5317787",
"0.5313591",
"0.53050476",
"0.529273",
"0.52864146",
"0.52816194",
"0.52809167",
"0.52789336",
"0.5275601",
"0.527401",
"0.5273641",
"0.52710176",
"0.5266367",
"0.52561647",
"0.5255301",
"0.52499485",
"0.5238867",
"0.523638",
"0.5234985",
"0.5233719",
"0.5228833",
"0.52267295",
"0.5212639",
"0.5212261",
"0.52086926",
"0.52079374",
"0.52079374",
"0.52077186",
"0.52064407",
"0.52024996",
"0.5201104",
"0.5195221",
"0.5193668",
"0.5193452",
"0.51929086",
"0.5179726",
"0.5176998",
"0.51743585",
"0.5168436",
"0.5164241",
"0.51567715",
"0.51559657",
"0.5152424"
] |
0.0
|
-1
|
POST /request_texts POST /request_texts.json
|
def create
@request_text = RequestText.new(request_text_params)
@request_text.ip = request.remote_ip
respond_to do |format|
if @request_text.save
format.html { redirect_to '/', notice: 'Request text was successfully created.' }
format.json { render action: 'show', status: :created, location: @request_text }
else
format.html { render action: 'new' }
format.json { render json: @request_text.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @request_texts = RequestText.all\n end",
"def request_text_params\n params.require(:request_text).permit(:name, :email, :website, :body, :ip)\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def text_params\n params.require(:text).permit(:text)\n end",
"def set_request_text\n @request_text = RequestText.find(params[:id])\n end",
"def ms_translate(text)\n https = Net::HTTP.new(@uri.host, @uri.port)\n https.use_ssl = true\n begin\n req = Net::HTTP::Post.new(@uri.request_uri, @headers)\n req.body = [{ 'Text' => text }].to_json\n response = https.request(req)\n return response_body(response)\n rescue StandardError => ex\n puts \"ERROR: #{ex.message}\"\n end\n end",
"def text_params\n params.require(:text).permit(:tweet_id, :user_id, :content, :create_datetime)\n end",
"def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def text_params\n params.require(:text).permit(:to, :from, :text, :token)\n end",
"def perform(id, texts, is_tokenized: false)\n params = { id: id, texts: texts, is_tokenized: is_tokenized }\n response = HTTP.post(\"#{@host}/encode\", json: params)\n embeddings = JSON.parse(response.to_s)['result']\n embeddings\n end",
"def create\n @add_text = AddText.new(add_text_params)\n\n respond_to do |format|\n if @add_text.save\n format.html { redirect_to @add_text, notice: 'Add text was successfully created.' }\n format.json { render :show, status: :created, location: @add_text }\n else\n format.html { render :new }\n format.json { render json: @add_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @text = current_user.texts.build(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_text_params\n params.require(:add_text).permit(:text)\n end",
"def text_params\n params.require(:text).permit(:title, :content, :description)\n end",
"def text_params\n params.require(:text).permit(:description)\n end",
"def create\n @text = Text.new(text_params)\n notify_android(text_params[:token])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def master_text_params\n params.require(:master_text).permit(:key, :one, :other, :text, :comment, :format, :pluralizable, :project_id, view_ids: [])\n end",
"def validate_text(text)\n response = RestClient.post \"#{BASE_URI}/?out=json\", text, HEADERS\n @json = JSON.parse(response.body)\n @errors = retrieve_errors\n end",
"def create\n @static_text = StaticText.new(static_text_params)\n\n respond_to do |format|\n if @static_text.save\n format.html { redirect_to @static_text, notice: 'Static text was successfully created.' }\n format.json { render :show, status: :created, location: @static_text }\n else\n format.html { render :new }\n format.json { render json: @static_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_custom_text = Api::V1::CustomText.new(api_v1_custom_text_params)\n\n respond_to do |format|\n if @api_v1_custom_text.save\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_custom_text }\n else\n format.html { render :new }\n format.json { render json: @api_v1_custom_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_to_api_ai(text)\n client = ApiAiRuby::Client.new(:client_access_token => ACCESS_TOKEN())\n return client.text_request(text)\n end",
"def speak(text)\n @conn.post 'speak.json', :message => {:body => text}\n end",
"def api_v1_custom_text_params\n params.fetch(:api_v1_custom_text, {})\n end",
"def text_test\n params.inspect\n # Parameters: \n # {\"ToCountry\"=>\"US\", \n # \"ToState\"=>\"UT\", \n # \"SmsMessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"NumMedia\"=>\"0\", \n # \"ToCity\"=>\"PARK CITY\", \n # \"FromZip\"=>\"84770\", \n # \"SmsSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"FromState\"=>\"UT\", \n # \"SmsStatus\"=>\"received\", \n # \"FromCity\"=>\"ST GEORGE\", \n # \"Body\"=>\"testing 5678\", \n # \"FromCountry\"=>\"US\", \n # \"To\"=>\"+14352141844\", \n # \"ToZip\"=>\"84098\", \n # \"NumSegments\"=>\"1\", \n # \"MessageSid\"=>\"SM5d11339688438ea6840b1ff5cf6b3e33\", \n # \"AccountSid\"=>\"ACfb03eaaab63e59c4a90d5bf07b5f6f70\", \n # \"From\"=>\"+14356691878\", \n # \"ApiVersion\"=>\"2010-04-01\"}\n from = params[:From]\n\n end",
"def text_params\n params.require(:text).permit(:title)\n end",
"def get_keywords_for_text(retina_name, body)\n resource_path = '/text/keywords'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name }\n post_data = body\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n\n JSON.parse(response.body, symbolize_names: true)\n end",
"def post_params\n params.permit(:text)\n end",
"def text_sample_params\n params.require(:text_sample).permit(:description, :text)\n end",
"def text_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'text',\n 'Content' => 'ping', # will send a pong\n }\nend",
"def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end",
"def create\n @texttocorrect = Texttocorrect.new(texttocorrect_params)\n\n respond_to do |format|\n if @texttocorrect.save\n format.html { redirect_to @texttocorrect, notice: 'Texttocorrect was successfully created.' }\n format.json { render :show, status: :created, location: @texttocorrect }\n else\n format.html { render :new }\n format.json { render json: @texttocorrect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def text\n # insufficient parameters\n if !params.has_key?(:utar_id) || !params.has_key?(:utar_password)\n @result = {:message => 'No utar credential specified'}\n render json: @result, :status => 400\n return\n end\n\n # find student from database\n student = Student.find_by(:utar_id => params[:utar_id])\n if(!student)\n @result = {:message => 'Student not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n # check if campus is valid\n if(!Mechanizor.is_campus_valid?(student.campus))\n @result = {:message => 'Student campus error'}\n render json: @result, :status => 403\n return\n end\n\n # find the subject\n # use integer value of enum on find_by and new , eg: student[:campus] instead of student.campus\n subject = Subject.find_by(:code => params[:code], :campus => student[:campus])\n if(!subject)\n @result = {:message => 'Subject not found in Database'}\n render json: @result, :status => 404\n return\n end\n\n @subject_texts = Mechanizor.get_subject_text(params[:utar_id], params[:utar_password], subject.url, subject.code, student.campus)\n\n if !@subject_texts\n @result = {:message => 'Error accessing WBLE or student does not have this subject'}\n render json: @result, :status => 403\n return\n end\n\n @result = {:message => 'Successfully retrieved text for subject', :texts => @subject_texts}\n render json: @result\n end",
"def speak\n speak_what = params[:text_to_speak]\n logger.debug \"speak_what=#{speak_what}\"\n if !speak_what.present? then return end\n speak_what_encoded = ERB::Util.url_encode(speak_what)\n logger.debug \"speak_what_encoded=#{speak_what_encoded}\"\n uri = \"#{HOST}:#{PORT}/sayall/#{speak_what_encoded}\"\n begin\n logger.debug \"uri=#{uri}\"\n response = open(uri).read \n rescue ActionController::UnknownFormat => e\n if e.include? '204'\n # do nothing\n else\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e\n end\n rescue Exception => e\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e \n end\n redirect_to :controller => 'presets', :action => 'display'\n end",
"def register\n ensure_post\n ensure_application\n ensure_valid_signature\n\n unless params[:source].blank?\n source = Tr8n::TranslationSource.find_or_create(params[:source], application)\n end\n\n phrases = []\n if params[:phrases]\n begin\n phrases = HashWithIndifferentAccess.new({:data => JSON.parse(params[:phrases])})[:data]\n rescue Exception => ex\n raise Tr8n::Exception.new(\"Invalid request. JSON parsing failed: #{ex.message}\")\n end\n elsif params[:label]\n phrases << {:label => params[:label], :description => params[:description]}\n end\n\n keys = []\n phrases.each do |phrase|\n phrase = {:label => phrase} if phrase.is_a?(String)\n next if phrase[:label].strip.blank?\n opts = {:source => source, :locale => (language || Tr8n::Config.default_language).locale, :application => application}\n keys << Tr8n::TranslationKey.find_or_create(phrase[:label], phrase[:description], opts).to_api_hash(:translations => false)\n end\n\n render_response(keys)\n end",
"def sentiment(text)\r\n return iod_request('analyzesentiment',\r\n {:text => text, :language => $sentiment_language, :apikey => $api_key})\r\nend",
"def static_text_params\n params.require(:static_text).permit(:title, :body, :active)\n end",
"def destroy\n @request_text.destroy\n respond_to do |format|\n format.html { redirect_to request_texts_url }\n format.json { head :no_content }\n end\n end",
"def texttocorrect_params\n params.require(:texttocorrect).permit(:language, :duedate, :description)\n end",
"def create\n @master_text = MasterText.new(master_text_params)\n respond_to do |format|\n if LocalizedTextEnforcer::MasterTextCrudder.new(@master_text).save\n format.html { redirect_to project_master_texts_path(@master_text.project), notice: \"Master text was successfully created.\" }\n format.json { render action: \"show\", status: :created, location: @master_text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @master_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def texter_params\n params.require(:texter).permit(:client_name, :message_description)\n end",
"def message_params\n params.require(:message).permit(:text, :start_at, :end_at, :library, :request_type)\n end",
"def say(text, options = {})\n request = Net::HTTP::Post.new(@uri.request_uri)\n request.body = encode_payload(text, options)\n response = @http.request(request)\n return nil # so as not to trigger text in outgoing webhook reply\n end",
"def plain_text_input_params\n params.fetch(:plain_text_input, {})\n end",
"def create\n @text = Text.new(text_params)\n @text.reader_id = current_reader.id \n @text.readability_index = @text.difficulty_method \n @text.flesh_index = @text.rudolf_flesh_method\n #@text.speed_index = '1'\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: \"Text was successfully created.\" }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @guides_text = Guides::Text.new(guides_text_params)\n @guides_text.user = current_user\n @guides_text.published_at = Time.now\n respond_to do |format|\n if @guides_text.save\n format.html { redirect_to @guides_text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @guides_text }\n else\n format.html { render :new }\n format.json { render json: @guides_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['plans'][me]['messages'] << message\n end",
"def create\n @site_text = SiteText.new(site_text_params)\n\n respond_to do |format|\n if @site_text.save\n format.html { redirect_to @site_text, notice: 'Site text was successfully created.' }\n format.json { render :show, status: :created, location: @site_text }\n else\n format.html { render :new }\n format.json { render json: @site_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.find_or_create_by_text(params[:text])\n\n respond_to do |format|\n if @word.save\n format.json { render json: @word, status: :created,\n location: @word}\n else\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end",
"def word_params\n params.require(:word).permit(:text)\n end",
"def sentence_params\n params.require(:sentence).permit(:content, :category, :language)\n end",
"def update\n respond_to do |format|\n if @request_text.update(request_text_params)\n format.html { redirect_to @request_text, notice: 'Request text was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_translation(params = {})\n response = Unirest.post(\"#{Unbabel::Client::ENDPOINT}/translation/\",\n parameters: params.to_json)\n response.body\n end",
"def create\n @text = this_class.new(params[this_key]){|one| one.user_id = current_user.id }\n return forbidden if not authorized? :create\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def text_memory_params\n params.require(:text_memory).permit(:title, :text, :date, :lat, :lon)\n end",
"def send_to_ocr\n run_callbacks :send_to_ocr do\n self.response = http.request(request)\n self.response_body = JSON.parse(response.body)\n end\n end",
"def gen(text, opts = {})\n url = build_url(text, opts)\n send_request(url)\n end",
"def param_text\n\n params[Constants::REQUEST_PARAM_TEXT]\n\n end",
"def get_texts(params)\n #first, get the relevant canto and its stanzas\n canto = Canto.find_by_name(params['canto'])\n @stanzas = Stanza.where(canto_id: canto.id).includes(:stanza_translations).order(:number)\n case params[\"view\"]\n #if user wants to view a text without annotations, select the relevant translations\n when \"no_annotations\" # get text of the original poem or of one of its translations\n translation = Translation.find_by_name(params[:text])\n stanza_translations = extract_translations(translation)\n when \"asimov_annotations\"\n stanza_translations = extract_translations(Translation.first)\n when \"parallel_texts\"\n stanza_translations = parallel_texts_collection(params)\n end\n stanza_translations\n end",
"def translatorused_params\n params.require(:translatorused).permit(:code, :text)\n end",
"def create\n @text_content = TextContent.new(text_content_params)\n\n respond_to do |format|\n if @text_content.save\n format.html { redirect_to @text_content, notice: 'Text content was successfully created.' }\n format.json { render :show, status: :created, location: @text_content }\n else\n format.html { render :new }\n format.json { render json: @text_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @text_entry = TextEntry.new(params[:text_entry])\n\n respond_to do |format|\n if @text_entry.save\n format.html { redirect_to statute_type_url(@text_entry.statute_type_id), notice: 'Text entry was successfully created.' }\n format.json { render json: @text_entry, status: :created, location: @text_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_tokens_for_text(retina_name, body, pos_tags=nil)\n resource_path = '/text/tokenize'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name, 'POStags' => pos_tags }\n post_data = body\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params, post_data, headers)\n\n JSON.parse(response.body, symbolize_names: true)\n end",
"def create\n @plain_text_input = PlainTextInput.new(plain_text_input_params)\n\n respond_to do |format|\n if @plain_text_input.save\n format.html { redirect_to @plain_text_input, notice: 'Plain text input was successfully created.' }\n format.json { render :show, status: :created, location: @plain_text_input }\n else\n format.html { render :new }\n format.json { render json: @plain_text_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_field\n params.inspect\n #@textos = Array.new(1+1) { Texto.new } # Generate index+1 objects\n #respond_with(@textos)\n end",
"def text_file_params\n params.require(:text_file).permit(:name, :content)\n end",
"def create\n @response_domain_text = ResponseDomainText.new(params[:response_domain_text])\n @response_domain_text.init\n\n respond_to do |format|\n if @response_domain_text.save\n format.html { redirect_to(@response_domain_text, :notice => 'Text answer was successfully created.') }\n format.xml { render :xml => @response_domain_text, :status => :created, :location => @response_domain_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response_domain_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def about_list_texts_params\n params.require(:about_list_text).permit(:title, :description, :about_id)\n end",
"def create\n @instructor_text = InstructorText.new(params[:instructor_text])\n\n respond_to do |format|\n if @instructor_text.save\n format.html { redirect_to @instructor_text, notice: 'Instructor text was successfully created.' }\n format.json { render json: @instructor_text, status: :created, location: @instructor_text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instructor_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batale_text = authorize Batale::Text.new(batale_text_params)\n @batale_text.cria_codigo_texto\n\n respond_to do |format|\n if @batale_text.save\n format.html { redirect_to @batale_text, notice: 'Texto criado com sucesso.' }\n format.json { render :show, status: :created, location: @batale_text }\n else\n format.html { render :new }\n format.json { render json: @batale_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def text_page_params\n params.require(:text_page).permit(:title, :contents, :load_from_google, :file_id, :google_account_id)\n end",
"def text_to_speech(text_data, options = {})\n resource = '/speech/v3/textToSpeech'\n params = {\n :Authorization => \"Bearer #{@access_token}\",\n :Content_Type => 'text/plain',\n :Accept => 'audio/x-wav'\n }.merge(options)\n\n begin\n response = @connection.post( resource, text_data, params )\n response.body\n rescue => e\n raise RuntimeError, e.to_s\n end\n end",
"def post_translation(key, lang, source, new_value)\n return true unless $REAL\n\n new_value_json = {\n 'target_language' => lang,\n 'type' => 'key',\n 'key' => key,\n 'source' => source,\n 'target' => new_value\n }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n # POST https://translation.io/api/v1/segments(.json)\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'POST',\n 'https://translation.io/api/v1/segments.json',\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend",
"def phrase_params\n params.permit(:phrase, :language, :user_id)\n end",
"def answer_params\n params.permit(:text, :correct)\n end",
"def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end",
"def index\n params.permit(:message)\n\n assistant = IBMWatson::AssistantV1.new(\n version: \"2018-09-20\",\n username: \"ebbfae24-aaba-403c-8f06-b11b5ae7ce81\",\n password: \"b7ij6FUSNHdt\",\n url:\"https://gateway.watsonplatform.net/assistant/api\",\n iam_apikey: \"XOIijyk6xzJeEmjeVlvnJHhGUomigWWu_xKo1WcMiIiz\"\n )\n\n response = assistant.message(\n workspace_id: \"98aec387-baa5-4161-a891-09cb44317cf3\",\n input: {\n text: params[:message]\n }\n )\n @result = response.result\n render json: @result\n end",
"def create\n @text = Text.new(text_params)\n\n @comment = Comment.new\n @comment.text = @text\n\n @user = current_user\n\n respond_to do |format|\n if @text.save\n format.html {redirect_to @text, notice: 'Text was successfully created.'}\n format.json {render :show, status: :created, location: @text}\n else\n format.html {render :new}\n format.json {render json: @text.errors, status: :unprocessable_entity}\n end\n end\n end",
"def hero_phrase_params\n params.require(:hero_phrase).permit(:text)\n end",
"def phrase_params\n params.require(:phrase).permit(:locale, :i18n_key, :i18n_value, :flagged_at, :notes)\n end",
"def text\n lead = Lead.find(params[:lead_id])\n client = Twilio::REST::Client.new\n if params[:auto_text] || !params[:body].blank?\n client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: lead.phone,\n body: params[:auto_text] ? custom_message(lead.first_name) : params[:body]\n )\n flash[:success] = \"Text Sent!\"\n else\n flash[:alert] = \"NO TEXT SENT\"\n end\n redirect_to \"/leads/#{lead.id}/edit\"\n rescue Twilio::REST::RequestError => error\n redirect_to \"/leads/#{lead.id}/edit\"\n flash[:alert] = \"NO TEXT SENT - #{error}\"\n end",
"def create\n @textline = Textline.new(textline_params)\n\n respond_to do |format|\n if @textline.save\n format.html { redirect_to @textline, notice: 'Textline was successfully created.' }\n format.json { render :show, status: :created, location: @textline }\n else\n format.html { render :new }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_examples_post(word, body, *args)\n http_method = :post\n path = '/word/{word}/examples'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def post_page_text_replace_with_http_info(name, page_number, text_replace_list_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.post_page_text_replace ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.post_page_text_replace\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.post_page_text_replace\"\n end\n # verify the required parameter 'text_replace_list_request' is set\n if @api_client.config.client_side_validation && text_replace_list_request.nil?\n fail ArgumentError, \"Missing the required parameter 'text_replace_list_request' when calling PdfApi.post_page_text_replace\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/text/replace\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n post_body = @api_client.object_to_http_body(text_replace_list_request)\n auth_names = ['JWT']\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 => 'TextReplaceResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#post_page_text_replace\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @api_v1_text_field = Api::V1::TextField.new(api_v1_text_field_params)\n\n respond_to do |format|\n if @api_v1_text_field.save\n format.html { redirect_to @api_v1_text_field, notice: 'Text field was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_text_field }\n else\n format.html { render :new }\n format.json { render json: @api_v1_text_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_text\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/textItems'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['TextItems']['List'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def create # rubocop:disable Metrics/MethodLength\n @text_sample = TextSample.new(text_sample_params)\n respond_to do |format|\n if @text_sample.save\n @text_sample.analyse\n\n format.html do\n redirect_to @text_sample,\n notice: 'Text sample was successfully created and analysed.'\n end\n format.json { render :show, status: :created, location: @text_sample }\n else\n format.html { render :new }\n format.json { render json: @text_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_v1_text_field_params\n params.fetch(:api_v1_text_field, {})\n end",
"def speech_params\n params.require(:speech).permit(:codigoparlamentar, :codigopronunciamento, :data, :urltexto, :textocompleto)\n end",
"def raw_bibtex_entry_params\n params.require(:content).permit(:converted, :subject_list => [], :keyword_list => [])\n end",
"def create\n @text = (params[:text] || \"\").strip\n @offset = (params[:offset] || \"-1\").to_i\n @concept = params[:concept] || \"\"\n @type = params[:type] || \"\"\n\n @ret = @document.add_annotation(@text, @offset, @type, @concept)\n @entity_types = EntityType.where(collection_id: @document.collection_id)\n\n respond_to do |format|\n format.html { redirect_to @annotation, notice: 'The annotation was successfully created.' }\n format.json { render :show, status: :ok, location: @annotation }\n end\n end",
"def put_add_text_with_http_info(name, page_number, paragraph, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_add_text ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_add_text\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.put_add_text\"\n end\n # verify the required parameter 'paragraph' is set\n if @api_client.config.client_side_validation && paragraph.nil?\n fail ArgumentError, \"Missing the required parameter 'paragraph' when calling PdfApi.put_add_text\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/text\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n post_body = @api_client.object_to_http_body(paragraph)\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_add_text\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def text_content_params\n params.require(:text_content).permit(:content, :post_id)\n end",
"def batale_text_params\n params.require(:batale_text).permit(\n :codigo_texto, :nome_aluno, :numero_aluno,\n :idade, :sexo, :numero_estrato, :numero_coleta,\n :numero_texto, :ano_coleta, :tipo_texto, :escola_crianca,\n :serie, :turma, :texto_original, :texto_normatizado, :texto_highlighted,\n :image, :tipo_escrita\n )\n end",
"def texts=(texts); end",
"def texts=(texts); end",
"def add_need(subject, text)\n url = URI.parse(\"http://#{@@api_url}/needs/add.xml#{@config[:apikey]}\")\n req = Net::HTTP::Post.new(url.path)\n\n req.basic_auth(@config[:email], @config[:password])\n req.set_form_data({'text' => text, 'subject' => subject})\n\n response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n parse(response.body)\n \n end",
"def get_examples_for_words(body, *args)\n http_method = :post\n path = '/words/examples'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def question_params\n params.require(:question).permit(:text)\n end"
] |
[
"0.6719368",
"0.6506125",
"0.62863934",
"0.6118663",
"0.60813296",
"0.6051296",
"0.603817",
"0.5965374",
"0.5941802",
"0.5921346",
"0.5881889",
"0.587454",
"0.5790046",
"0.5741888",
"0.5737444",
"0.5722283",
"0.5687871",
"0.56675225",
"0.56507343",
"0.5649251",
"0.5600831",
"0.5600777",
"0.56006086",
"0.5564978",
"0.55447644",
"0.55341697",
"0.55151325",
"0.55013",
"0.54810226",
"0.54769814",
"0.54567283",
"0.5446051",
"0.5427772",
"0.54014635",
"0.54011446",
"0.5400629",
"0.5386384",
"0.5382788",
"0.5366407",
"0.5348964",
"0.53472304",
"0.53364563",
"0.53362435",
"0.5328922",
"0.53220826",
"0.5319648",
"0.53058964",
"0.52919",
"0.5289132",
"0.52876985",
"0.52857804",
"0.5284128",
"0.5269756",
"0.52666986",
"0.52651215",
"0.52643067",
"0.5262058",
"0.52511173",
"0.52509576",
"0.52491057",
"0.5246229",
"0.5245346",
"0.523258",
"0.5228983",
"0.5220537",
"0.52138925",
"0.5206722",
"0.52030885",
"0.5191475",
"0.5185933",
"0.51789904",
"0.5178956",
"0.51707256",
"0.5170514",
"0.5169884",
"0.516612",
"0.51633835",
"0.51619506",
"0.5160272",
"0.5155466",
"0.51539606",
"0.5153338",
"0.5146574",
"0.51447123",
"0.51417637",
"0.51400787",
"0.5138272",
"0.5137886",
"0.5137699",
"0.5132217",
"0.51317394",
"0.51175207",
"0.51120144",
"0.5110263",
"0.5106061",
"0.5102195",
"0.5102195",
"0.5101896",
"0.5098761",
"0.50949204"
] |
0.6553612
|
1
|
PATCH/PUT /request_texts/1 PATCH/PUT /request_texts/1.json
|
def update
respond_to do |format|
if @request_text.update(request_text_params)
format.html { redirect_to @request_text, notice: 'Request text was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @request_text.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @api_v1_custom_text.update(api_v1_custom_text_params)\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_custom_text }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_custom_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text.readability_index = @text.difficulty_method\n @text.flesh_index = @text.rudolf_flesh_method\n #@text.speed_index = '15'\n\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: \"Text was successfully updated.\" }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: 'Text was successfully updated.' }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: 'Text was successfully updated.' }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_text.update(add_text_params)\n format.html { redirect_to @add_text, notice: 'Add text was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_text }\n else\n format.html { render :edit }\n format.json { render json: @add_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_request_text\n @request_text = RequestText.find(params[:id])\n end",
"def update\n respond_to do |format|\n if LocalizedTextEnforcer::MasterTextCrudder.new(@master_text).update(master_text_params)\n format.html { redirect_to project_master_texts_path(@master_text.project), notice: \"Master text was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @master_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # rubocop:disable Metrics/MethodLength\n respond_to do |format|\n if @text_sample.update(text_sample_params)\n # TODO: reanalyse the text\n format.html { redirect_to @text_sample, notice: 'Text sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_sample }\n else\n format.html { render :edit }\n format.json do\n render json: @text_sample.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end",
"def update\n @texts = Text.all\n\n puts params\n\n respond_to do |format|\n\n if @agreement.update(agreement_params)\n format.html { redirect_to @agreement, notice: 'Certificado atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @agreement }\n else\n format.html { render :edit }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @text.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_text_field.update(api_v1_text_field_params)\n format.html { redirect_to @api_v1_text_field, notice: 'Text field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_text_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_text_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_text\n\n respond_to do |format|\n if update_suc\n format.html { redirect_to @document, notice: suc_msg }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text_content.update(text_content_params)\n format.html { redirect_to @text_content, notice: 'Text content was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_content }\n else\n format.html { render :edit }\n format.json { render json: @text_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text_file.update(text_file_params)\n format.html { redirect_to @text_file, notice: 'Text file was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_file }\n else\n format.html { render :edit }\n format.json { render json: @text_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text = this_class.find(params[:id])\n return forbidden if not authorized? :update, @text\n\n respond_to do |format|\n if @text.update_attributes(params[this_key])\n format.html { redirect_to @text, notice: 'Text was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n if @text_message.update_attributes(params[:text_message])\n format.html { redirect_to @text_message, notice: 'Text message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incoming_text = IncomingText.find(params[:id])\n\n respond_to do |format|\n if @incoming_text.update_attributes(params[:incoming_text])\n format.html { redirect_to(@incoming_text, :notice => 'Incoming text was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incoming_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @texttocorrect.update(texttocorrect_params)\n format.html { redirect_to @texttocorrect, notice: 'Texttocorrect was successfully updated.' }\n format.json { render :show, status: :ok, location: @texttocorrect }\n else\n format.html { render :edit }\n format.json { render json: @texttocorrect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @static_text.update(static_text_params)\n format.html { redirect_to @static_text, notice: 'Static text was successfully updated.' }\n format.json { render :show, status: :ok, location: @static_text }\n else\n format.html { render :edit }\n format.json { render json: @static_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @comment = Comment.new\n @comment.text = @text\n\n @user = current_user\n\n if @text.update(text_params)\n format.html {redirect_to edit_text_path(@text), notice: 'Text was successfully updated.'}\n format.json {render :show, status: :ok, location: @text}\n else\n format.html {redirect_to edit_text_path(@text), notice: @text.errors}\n format.json {render json: @text.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @textline.update(textline_params)\n format.html { redirect_to @textline, notice: 'Textline was successfully updated.' }\n format.json { render :show, status: :ok, location: @textline }\n else\n format.html { render :edit }\n format.json { render json: @textline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text_message.update(text_message_params)\n format.html { redirect_to @text_message, notice: 'Text message was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_message }\n else\n format.html { render :edit }\n format.json { render json: @text_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n if @textanswer.update_attributes(params[:textanswer])\n format.html { redirect_to @textanswer, notice: 'Textanswer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @textanswer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text_entry = TextEntry.find(params[:id])\n\n respond_to do |format|\n if @text_entry.update_attributes(params[:text_entry])\n format.html { redirect_to statute_type_url(@text_entry.statute_type_id), notice: 'Text entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @plain_text_input.update(plain_text_input_params)\n format.html { redirect_to @plain_text_input, notice: 'Plain text input was successfully updated.' }\n format.json { render :show, status: :ok, location: @plain_text_input }\n else\n format.html { render :edit }\n format.json { render json: @plain_text_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @guides_text.update(guides_text_params)\n format.html { redirect_to @guides_text, notice: 'Text was successfully updated.' }\n format.json { render :show, status: :ok, location: @guides_text }\n else\n format.html { render :edit }\n format.json { render json: @guides_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @instructor_text = InstructorText.find(params[:id])\n\n respond_to do |format|\n if @instructor_text.update_attributes(params[:instructor_text])\n format.html { redirect_to @instructor_text, notice: 'Instructor text was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n @text_with_prefix = args[:text_with_prefix] if args.key?(:text_with_prefix)\n @text_with_prefix_suffix = args[:text_with_prefix_suffix] if args.key?(:text_with_prefix_suffix)\n @text_with_suffix = args[:text_with_suffix] if args.key?(:text_with_suffix)\n end",
"def update\n @notebook = Notebook.find(params[:id])\n\n respond_to do |format|\n if @notebook.update_attributes(:annotation=>params[:text])\n format.html { redirect_to @notebook, notice: 'Notebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notebook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @texter.update(texter_params)\n format.html { redirect_to @texter, notice: 'Texter was successfully updated.' }\n format.json { render :show, status: :ok, location: @texter }\n else\n format.html { render :edit }\n format.json { render json: @texter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @text_segments = args[:text_segments] if args.key?(:text_segments)\n end",
"def edit_text_replace_simple_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_replace_simple ...'\n end\n # verify the required parameter 'request' is set\n if @api_client.config.client_side_validation && request.nil?\n fail ArgumentError, \"Missing the required parameter 'request' when calling EditTextApi.edit_text_replace_simple\"\n end\n # resource path\n local_var_path = '/convert/edit/text/replace/string'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = ['Apikey']\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 => 'ReplaceStringSimpleResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditTextApi#edit_text_replace_simple\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @text_block = TextBlock.find(params[:id])\n\n respond_to do |format|\n if @text_block.update_attributes(params[:text_block])\n format.html { redirect_to get_redirect_path, notice: 'Text block was successfully updated.' }\n format.json { head :ok }\n else\n flash[:error] = \"Writing cannot be updated due to validation errors\"\n format.html { redirect_to get_redirect_path }\n format.json { render json: @text_block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n end",
"def update\n respond_to do |format|\n if @text_manager.update(text_manager_params)\n format.html { redirect_to text_managers_path, notice: 'Text manager was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @text_manager.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @textnote.update(textnote_params)\n format.html { redirect_to current_user, notice: 'Textnote was successfully updated.' }\n format.json { render :show, status: :ok, location: @textnote }\n else\n format.html { render :edit }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update(text); end",
"def update\n @reminder_phrase = ReminderPhrase.find(params[:id])\n\n respond_to do |format|\n if @reminder_phrase.update_attributes(params[:reminder_phrase])\n format.html { redirect_to @reminder_phrase, notice: 'Reminder phrase was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reminder_phrase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batale_text.update(batale_text_params)\n format.html { redirect_to @batale_text, notice: 'Texto editado com sucesso.' }\n format.json { render :show, status: :ok, location: @batale_text }\n else\n format.html { render :edit }\n format.json { render json: @batale_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @text_activity = TextActivity.find_by_id(params[:id]) \r\n\r\n attr = params[:text_activity]\r\n section_id = attr[:section_id]\r\n attr.delete(:section_id) \r\n\r\n respond_to do |format|\r\n if @text_activity.update_attributes(attr)\r\n format.html { redirect_to Section.find(section_id), notice: 'Text activity was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @text_activity.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n @text = args[:text] if args.key?(:text)\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n @text = args[:text] if args.key?(:text)\n end",
"def update\n respond_to do |format|\n if @objective_textual.update(objective_textual_params)\n format.html { redirect_to @objective_textual, notice: 'Objective textual was successfully updated.' }\n format.json { render :show, status: :ok, location: @objective_textual }\n else\n format.html { render :edit }\n format.json { render json: @objective_textual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @txt = Txt.find(params[:id])\n\n respond_to do |format|\n if @txt.update_attributes(params[:txt])\n format.html { redirect_to(@txt, :notice => 'Txt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @txt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @texto = Texto.find(params[:id])\n\n respond_to do |format|\n if @texto.update_attributes(params[:texto])\n format.html { redirect_to(@texto, :notice => 'Texto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @texto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, :notice => 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @textual_content.update textual_content_params\n render :show, status: :ok, location: [@card, @textual_content]\n else\n render json: @textual_content.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @text_book.update(text_book_params)\n format.html { redirect_to @text_book, notice: 'Text book was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_book }\n else\n format.html { render :edit }\n format.json { render json: @text_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @txt5 = Txt5.find(params[:id])\n\n respond_to do |format|\n if @txt5.update_attributes(params[:txt5])\n format.html { redirect_to @txt5, notice: 'Txt5 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @txt5.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text_topic = TextTopic.find(params[:id])\n\n respond_to do |format|\n if @text_topic.update_attributes(params[:text_topic])\n format.html { redirect_to(@text_topic, :notice => 'Text topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @text_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @text_block = TextBlock.find(params[:id])\n \n respond_to do |format|\n if @text_block.update_attributes(params[:text_block])\n format.html { redirect_to @text_block, notice: 'Text block was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_document_text_replace_with_http_info(name, text_replace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.post_document_text_replace ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.post_document_text_replace\"\n end\n # verify the required parameter 'text_replace' is set\n if @api_client.config.client_side_validation && text_replace.nil?\n fail ArgumentError, \"Missing the required parameter 'text_replace' when calling PdfApi.post_document_text_replace\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/text/replace\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n post_body = @api_client.object_to_http_body(text_replace)\n auth_names = ['JWT']\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 => 'TextReplaceResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#post_document_text_replace\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @txt3 = Txt3.find(params[:id])\n\n respond_to do |format|\n if @txt3.update_attributes(params[:txt3])\n format.html { redirect_to @txt3, notice: 'Txt3 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @txt3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @text = Text.new(params[:text])\n @text.resource_id = @resource.id\n @text.save\n\n @resource.attachment = @text\n @resource.save\n \n respond_to do |format|\n if @text.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.html { redirect_to edit_course_path(@course), notice: 'Text was successfully updated.' }\n format.js\n end\n end \n end",
"def update!(**args)\n @raw_text = args[:raw_text] if args.key?(:raw_text)\n end",
"def master_text_params\n params.require(:master_text).permit(:key, :one, :other, :text, :comment, :format, :pluralizable, :project_id, view_ids: [])\n end",
"def update( text )\n text\n end",
"def update\n respond_to do |format|\n if @mobile_text.update(mobile_text_params)\n format.html { redirect_to @mobile_text, notice: 'Mobile text was successfully updated.' }\n format.json { render :show, status: :ok, location: @mobile_text }\n else\n format.html { render :edit }\n format.json { render json: @mobile_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @textbook.update(textbook_params)\n format.html { redirect_to @textbook, notice: 'Textbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @textbook }\n else\n format.html { render :edit }\n format.json { render json: @textbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @intertext = Intertext.find(params[:id])\n\n respond_to do |format|\n if @intertext.update_attributes(params[:intertext]) and\n @intertext.horace.update_attributes(params[:horace]) and\n @intertext.homer.update_attributes(params[:homer])\n format.html { redirect_to intertexts_path, notice: 'Intertext was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intertext.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text_story = current_user.text_stories.find(params[:id])\n\n respond_to do |format|\n if @text_story.update_attributes(params[:text_story])\n format.html { redirect_to @text_story, notice: 'Text story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n @token = args[:token] if args.key?(:token)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @site_text.update(site_text_params)\n format.html { redirect_to @site_text, notice: 'Site text was successfully updated.' }\n format.json { render :show, status: :ok, location: @site_text }\n else\n format.html { render :edit }\n format.json { render json: @site_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(text)\n text\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n if @translated_word.update_attributes(params[:translation])\n format.json { head :no_content }\n else\n format.json { render :json => @translated_word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update!(**args)\n @text = args[:text] if args.key?(:text)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n end"
] |
[
"0.6611145",
"0.65562725",
"0.64173865",
"0.64173865",
"0.6400193",
"0.6373649",
"0.6368891",
"0.63140434",
"0.62895834",
"0.62615544",
"0.62381303",
"0.6223819",
"0.6217745",
"0.6138507",
"0.61103433",
"0.6109359",
"0.6086264",
"0.6058902",
"0.6054726",
"0.60418016",
"0.6036755",
"0.6011959",
"0.5965344",
"0.5941179",
"0.5919161",
"0.5912487",
"0.5904077",
"0.5903524",
"0.5884883",
"0.5857616",
"0.58536303",
"0.58305883",
"0.5809107",
"0.57795346",
"0.577472",
"0.5774119",
"0.57736397",
"0.57500684",
"0.57481647",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5747166",
"0.5735469",
"0.5725167",
"0.57190025",
"0.57190025",
"0.57190025",
"0.57190025",
"0.5716624",
"0.570437",
"0.5690455",
"0.5685766",
"0.5656705",
"0.5655044",
"0.5653541",
"0.5653541",
"0.5648822",
"0.5645946",
"0.5612308",
"0.55957913",
"0.55874985",
"0.55815417",
"0.5578911",
"0.5578911",
"0.5576965",
"0.55711913",
"0.556067",
"0.5560182",
"0.5556814",
"0.55561775",
"0.554977",
"0.5546579",
"0.55433273",
"0.554143",
"0.5534788",
"0.5528779",
"0.5528302",
"0.55280024",
"0.5523099",
"0.5523099",
"0.55202067",
"0.5517296",
"0.55163634",
"0.55163634",
"0.5502679",
"0.550076"
] |
0.74509895
|
0
|
DELETE /request_texts/1 DELETE /request_texts/1.json
|
def destroy
@request_text.destroy
respond_to do |format|
format.html { redirect_to request_texts_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @text = Text.find(params[:id])\n @text.destroy\n respond_to do |format|\n format.html { redirect_to texts_url, notice: \"Text was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_text.destroy\n respond_to do |format|\n format.html { redirect_to add_texts_url, notice: 'Add text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text.destroy\n respond_to do |format|\n format.html { redirect_to texts_url, notice: 'Text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text.destroy\n respond_to do |format|\n format.html { redirect_to texts_url, notice: 'Text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_custom_text.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_custom_texts_url, notice: 'Custom text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @static_text.destroy\n respond_to do |format|\n format.html { redirect_to static_texts_url, notice: 'Static text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text.destroy\n respond_to do |format|\n format.html {redirect_to texts_url, notice: 'Text was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @text.destroy\n respond_to do |format|\n format.html { redirect_to texts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incoming_text = IncomingText.find(params[:id])\n @incoming_text.destroy\n\n respond_to do |format|\n format.html { redirect_to(incoming_texts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @textline.destroy\n respond_to do |format|\n format.html { redirect_to textlines_url, notice: 'Textline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @textual_content.destroy\n render json: { message: 'Textual content deleted sucussfully.' }, status: 200\n end",
"def destroy\n @text = this_class.find(params[:id])\n return forbidden if not authorized? :destroy, @text\n @text.destroy\n\n respond_to do |format|\n format.html { redirect_to texts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_content.destroy\n respond_to do |format|\n format.html { redirect_to text_contents_url, notice: 'Text content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intertext = Intertext.find(params[:id])\n @intertext.destroy\n\n respond_to do |format|\n format.html { redirect_to intertexts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master_text.destroy\n @master_text.project.recalculate_counts!\n respond_to do |format|\n format.html { redirect_to project_master_texts_path(@master_text.project), notice: \"Master text was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to sentences_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @text_sample.destroy\n respond_to do |format|\n format.html do\n redirect_to text_samples_url,\n notice: 'Text sample was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @instructor_text = InstructorText.find(params[:id])\n @instructor_text.destroy\n\n respond_to do |format|\n format.html { redirect_to instructor_texts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_message = TextMessage.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to text_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_file.destroy\n respond_to do |format|\n format.html { redirect_to text_files_url, notice: 'Text file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @texttocorrect.destroy\n respond_to do |format|\n format.html { redirect_to texttocorrects_url, notice: 'Texttocorrect was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adword_text.destroy\n respond_to do |format|\n format.html { redirect_to adword_texts_url, notice: 'Adword text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @textanswer = Textanswer.find(params[:id])\n @textanswer.destroy\n\n respond_to do |format|\n format.html { redirect_to textanswers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reminder_phrase = ReminderPhrase.find(params[:id])\n @reminder_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to reminder_phrases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_content = TextContent.find(params[:id])\n @text_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(text_contents_url) }\n format.xml { head :ok }\n end\n end",
"def deleteRequest\n\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @texto = Texto.find(params[:id])\n @texto.destroy\n\n respond_to do |format|\n format.html { redirect_to(textos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { message('You have successfully deleted this request') }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @text_manager.destroy\n respond_to do |format|\n format.html { redirect_to text_managers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @text_activity = TextActivity.find(params[:id])\r\n @text_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective_textual.destroy\n respond_to do |format|\n format.html { redirect_to objective_textuals_url, notice: 'Objective textual was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guides_text.destroy\n respond_to do |format|\n format.html { redirect_to guides_texts_url, notice: 'Text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fourth_story_text = FourthStoryText.last\n @fourth_story_text.destroy\n $update_delete_time = true\n respond_to do |format|\n format.html { redirect_to fourth_story_texts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sentence.destroy\n respond_to do |format|\n format.html { redirect_to sentences_url, notice: 'Sentence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_text = StoryText.find(params[:id])\n @story_text.destroy\n\n respond_to do |format|\n format.html { redirect_to(story_texts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @txt5 = Txt5.find(params[:id])\n @txt5.destroy\n\n respond_to do |format|\n format.html { redirect_to txt5s_url }\n format.json { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @text_message.destroy\n respond_to do |format|\n format.html { redirect_to text_messages_url, notice: 'Text message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_text_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_text_fields_url, notice: 'Text field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @txt = Txt.find(params[:id])\n @txt.destroy\n\n respond_to do |format|\n format.html { redirect_to(txts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site_text.destroy\n respond_to do |format|\n format.html { redirect_to site_texts_url, notice: 'Site text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typo.destroy\n respond_to do |format|\n format.html { redirect_to typos_url, notice: 'Typo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phrase.destroy\n respond_to do |format|\n format.html { redirect_to phrases_url, notice: 'Phrase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mobile_text.destroy\n respond_to do |format|\n format.html { redirect_to mobile_texts_url, notice: 'Mobile text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @textnote.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Textnote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n Request.delete(*args)\n end",
"def destroy\n @text_entry = TextEntry.find(params[:id])\n @statute_type_id = @text_entry.statute_type_id\n @text_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to statute_type_url(@statute_type_id) }\n format.json { head :no_content }\n end\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 destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to(sentences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @txt3 = Txt3.find(params[:id])\n @txt3.destroy\n\n respond_to do |format|\n format.html { redirect_to txt3s_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sentitrigram.destroy\n respond_to do |format|\n format.html { redirect_to sentitrigrams_url, notice: 'Sentitrigram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sentifourgram.destroy\n respond_to do |format|\n format.html { redirect_to sentifourgrams_url, notice: 'Sentifourgram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to admin_requests_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n head :no_content\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_tr_text = AzTrText.find(params[:id])\n @az_tr_text.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => 'index_user') }\n end\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n path = 'public/uploads/batale/text/image/' + @batale_text.id\n FileUtils.remove_dir(path) unless Dir.glob(path).empty? # Remove imagem associada ao texto, caso exista\n @batale_text.destroy\n respond_to do |format|\n format.html { redirect_to batale_texts_url, notice: 'Texto deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_block = TextBlock.find(params[:id])\n @text_block.destroy\n \n respond_to do |format|\n format.html { redirect_to text_blocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @richtext = Richtext.find(params[:id])\n @richtext.destroy\n\n respond_to do |format|\n format.html { redirect_to richtexts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = @skill.requests.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to myrequests_path }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n @oa_sent_document.destroy\n\n respond_to do |format|\n format.html { redirect_to oa_sent_documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n end\n end",
"def destroy\n @req.destroy\n respond_to do |format|\n flash[:notice] = \"Req was successfully destroyed.\"\n format.html { redirect_to reqs_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 @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submit_request.destroy\n respond_to do |format|\n format.html { redirect_to submit_requests_url, notice: '依頼されたタスクが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @txt4 = Txt4.find(params[:id])\n @txt4.destroy\n\n respond_to do |format|\n format.html { redirect_to txt4s_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @text_memory.destroy\n respond_to do |format|\n format.html { redirect_to text_memories_url, notice: 'Text memory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_memory.destroy\n respond_to do |format|\n format.html { redirect_to text_memories_url, notice: 'Text memory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typerelsequence.destroy\n respond_to do |format|\n format.html { redirect_to typerelsequences_url, notice: 'Typerelsequence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @response_domain_text = ResponseDomainText.find(params[:id])\n @response_domain_text.destroy\n\n respond_to do |format|\n format.html { redirect_to(response_domain_texts_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.69577616",
"0.6938973",
"0.6934526",
"0.6934526",
"0.6898743",
"0.6892599",
"0.68865126",
"0.68121135",
"0.6782535",
"0.6740674",
"0.67274487",
"0.67084813",
"0.6705469",
"0.6683916",
"0.66828996",
"0.6634282",
"0.6622166",
"0.66143703",
"0.6610321",
"0.66070014",
"0.659672",
"0.65950876",
"0.65854543",
"0.65796596",
"0.6576433",
"0.657422",
"0.65461206",
"0.65298235",
"0.6526913",
"0.6506067",
"0.6506067",
"0.6506067",
"0.6506067",
"0.6506067",
"0.6506067",
"0.65026593",
"0.6498921",
"0.64965826",
"0.64860606",
"0.6480732",
"0.6474573",
"0.6472323",
"0.64696175",
"0.6459766",
"0.6454421",
"0.64540625",
"0.64540625",
"0.64540625",
"0.64445055",
"0.6440945",
"0.6420137",
"0.64173204",
"0.64035416",
"0.6399367",
"0.63951755",
"0.6386767",
"0.63802224",
"0.6378231",
"0.6376692",
"0.6366734",
"0.6360287",
"0.63582593",
"0.6351578",
"0.6346605",
"0.6337652",
"0.63294953",
"0.63236547",
"0.63194805",
"0.6319357",
"0.6318184",
"0.63134307",
"0.63118684",
"0.6298391",
"0.6297074",
"0.62965417",
"0.6286026",
"0.6281489",
"0.62680703",
"0.6264205",
"0.6262624",
"0.62483907",
"0.62451106",
"0.62397826",
"0.6239696",
"0.6237897",
"0.6229506",
"0.62284607",
"0.62284607",
"0.62284607",
"0.62284607",
"0.62275386",
"0.62275386",
"0.6226001",
"0.6220771",
"0.621953",
"0.62193406",
"0.62193406",
"0.6217735",
"0.62122494",
"0.62086976"
] |
0.7916422
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_request_text
@request_text = RequestText.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_handler\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 set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def 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 setup_signals; end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n 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 around_hooks; 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 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 default_action; 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 callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\n end",
"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 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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0.53307265",
"0.5312121",
"0.5298173",
"0.5296388",
"0.52952695",
"0.5258086",
"0.52430934",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.52335346",
"0.5232943",
"0.5226392",
"0.52221715",
"0.5217978",
"0.52136153",
"0.52076435",
"0.52067244",
"0.5175402",
"0.5174649",
"0.5173085",
"0.5165201",
"0.5162052",
"0.5157932",
"0.5152905",
"0.5152353",
"0.5150909",
"0.514719",
"0.5138596",
"0.51333916",
"0.51139015",
"0.5113431",
"0.5113431",
"0.5109581",
"0.51066816",
"0.5091428",
"0.5089407",
"0.5082971",
"0.50822043",
"0.50668514",
"0.5055155",
"0.50525695",
"0.50499475",
"0.50499475",
"0.5034445",
"0.50249445",
"0.5022226",
"0.50167644",
"0.5014211",
"0.4999924",
"0.49996212",
"0.49978727",
"0.4989682",
"0.4989682",
"0.49851838",
"0.49817684",
"0.4979687",
"0.49787104",
"0.49688423",
"0.49664098",
"0.49564412",
"0.49561828",
"0.49547398",
"0.4953481",
"0.4952925",
"0.4946049",
"0.494379",
"0.49319315",
"0.49313048",
"0.49269778",
"0.49263066",
"0.49257493",
"0.4924526",
"0.49212465",
"0.49173486",
"0.4915802",
"0.49151486",
"0.49150333",
"0.49147308"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def request_text_params
params.require(:request_text).permit(:name, :email, :website, :body, :ip)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def 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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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 get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\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"
] |
[
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915146",
"0.6290595",
"0.62824667",
"0.62420255",
"0.62403506",
"0.6217174",
"0.6213706",
"0.62112075",
"0.6194868",
"0.6178784",
"0.6174678",
"0.6172499",
"0.61630744",
"0.61544263",
"0.615248",
"0.6147727",
"0.61221075",
"0.6119646",
"0.61076134",
"0.6106584",
"0.6094013",
"0.6081423",
"0.6071337",
"0.6063637",
"0.6021453",
"0.6018253",
"0.60161054",
"0.60112554",
"0.60071784",
"0.60071784",
"0.60004836",
"0.6000254",
"0.5999255",
"0.59930664",
"0.59919107",
"0.5991741",
"0.5980763",
"0.59663844",
"0.59605104",
"0.5960486",
"0.5959414",
"0.5957901",
"0.59538954",
"0.5953327",
"0.59450173",
"0.59391475",
"0.59391475",
"0.59386194",
"0.59351885",
"0.593139",
"0.5926316",
"0.5925927",
"0.59176016",
"0.59119296",
"0.5909275",
"0.5908221",
"0.59053046",
"0.58983994",
"0.58980995",
"0.58964473",
"0.5895902",
"0.5893993",
"0.58927304",
"0.5887752",
"0.58841616",
"0.5880381",
"0.58752084",
"0.586956",
"0.5868584",
"0.58679324",
"0.5867004",
"0.58667004",
"0.58642864",
"0.5863347",
"0.58626384",
"0.58615845",
"0.58594906",
"0.5854959",
"0.5854423",
"0.58506453",
"0.5850135"
] |
0.0
|
-1
|
Creates a GameStats object and fetches data from the Steam Community for the given user and game
|
def initialize(id, game_name)
if id.is_a? Numeric
@steam_id64 = id
else
@custom_url = id.downcase
end
@game_friendly_name = game_name
url = base_url + '?xml=all'
@xml_data = REXML::Document.new(open(url, {:proxy => true}).read).root
@privacy_state = @xml_data.elements['privacyState'].text
if public?
@app_id = @xml_data.elements['game/gameLink'].text.match(/http:\/\/store.steampowered.com\/app\/([1-9][0-9]+)/)[1]
@custom_url = @xml_data.elements['player/customURL'].text if @custom_url.nil?
@game_name = @xml_data.elements['game/gameName'].text
@hours_played = @xml_data.elements['stats/hoursPlayed'].text unless @xml_data.elements['stats/hoursPlayed'].nil?
@steam_id64 = @xml_data.elements['player/steamID64'].text.to_i if @steam_id64.nil?
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_stats(steam_id)\n return unless has_stats?\n\n GameStats.create_game_stats steam_id, @short_name\n end",
"def steam_user_stats\n @steam_user_stats if initted?\n end",
"def initialize(steam_id, game_name)\n super steam_id, game_name\n\n if public?\n most_recent_game_data = @xml_data['stats']['mostrecentgame']\n\n @most_recent_game = {}\n unless most_recent_game_data.nil?\n @most_recent_game[:difficulty] = most_recent_game_data['difficulty']\n @most_recent_game[:escaped] = (most_recent_game_data['bEscaped'] == 1)\n @most_recent_game[:movie] = most_recent_game_data['movie']\n @most_recent_game[:time_played] = most_recent_game_data['time']\n end\n end\n end",
"def get_game_statistics(lobby_id)\n find_lobby(lobby_id).game_statistics\n end",
"def fetch_games\n game_csv = nil\n DGS::ConnectionPool.with do |dgs|\n game_csv = dgs.get(session, '/quick_status.php?version=2')\n end\n new_games = GameCSVParser.new(game_csv).games\n game_merger = GameMerger.new(self.games, new_games)\n self.games = game_merger.current_games\n create_notifications_for_games!(game_merger)\n game_merger.added_games\n # rescue others => report & ignore, blow transaction?\n rescue DGS::NotLoggedInException\n handle_expired_session\n end",
"def person_game_stats(person_id, **options)\n game = options.delete(:gamePk) || 'current'\n\n get(\"/people/#{person_id}/stats/game/#{game}\", **options)['stats']\n end",
"def get_game_stats(game)\n agent = Mechanize.new\n html = agent.get(\"http://espn.go.com/ncb/boxscore?gameId=#{game.gameID}\").body\n doc = Nokogiri::HTML(html)\n\n awayRecs = doc.xpath(\"//div[@class = 'team-info']\").css(\"p\")[0].text\n awayOvrRaw = awayRecs.scan(/(\\d+)-(\\d+),.*/)\n if(awayOvrRaw != [] )\n awayOvrPer = awayOvrRaw[0][0].to_f / (awayOvrRaw[0][1].to_f + awayOvrRaw[0][0].to_f)\n else\n awayOvrPer = 0.05\n end\n awayRaw = awayRecs.scan(/.*, (\\d+)-(\\d+)/)\n if(awayRaw != [])\n awayPer = awayRaw[0][0].to_f / (awayRaw[0][1].to_f + awayRaw[0][0].to_f)\n else\n awayPer = 0.05 \n end\n homeRecs = doc.xpath(\"//div[@class = 'team-info']\").css(\"p\")[1].text\n homeOvrRaw = homeRecs.scan(/(\\d+)-(\\d+),.*/)\n if(homeOvrRaw != [])\n homeOvrPer = homeOvrRaw[0][0].to_f / (homeOvrRaw[0][1].to_f + homeOvrRaw[0][0].to_f) \n else\n homeOvrPer = 0.05\n end\n homeRaw = homeRecs.scan(/.*, (\\d+)-(\\d+)/)\n if(homeRaw != [])\n homePer = homeRaw[0][0].to_f / (homeRaw[0][1].to_f + homeRaw[0][0].to_f)\n else\n homePer = 0.05\n end\n # Find the table with information\n table = doc.xpath('//table[@class = \"mod-data\"]')\n rows = table.css('tbody')\n\n # Declare variables\n isHome = false\n homePoints = 0\n awayPoints = 0\n\n # Get data for game\n rows.each do |row|\n col = row.css('td')\n if(col.count == 18)\n fg = col[1].text.scan((/(\\d+)-(\\d+)/)) \n fgm = fg[0][0].to_f\n fga = fg[0][1].to_f\n fgPer = fgm / fga\n\n threeP = col[2].text.scan((/(\\d+)-(\\d+)/))\n threePM = threeP[0][0].to_f\n threePA = threeP[0][1].to_f\n threePer = threePM / threePA\n\n twoPM = fgm - threePM\n twoPA = fga - threePA\n twoPer = twoPM.to_f / twoPA.to_f\n\n ft = col[3].text.scan((/(\\d+)-(\\d+)/))\n ftm = ft[0][0].to_f\n fta = ft[0][1].to_f\n ftPer = ftm / fta\n\n offReb = col[4].text.to_f\n defReb = col[5].text.to_f\n totReb = col[6].text.to_f\n assists = col[7].text.to_f\n steals = col[8].text.to_f\n blocks = col[9].text.to_f\n to = col[10].text.to_f\n pf = col[11].text.to_f\n\n points = col[12].text.to_f\n pps = points / fga\n adjFG = ((points - ftm)/ fga)/ 2\n\n apto = assists / to\n spto = steals / to\n spf = steals / pf\n bpf = blocks / pf\n \n # Updates specific game entry with newly scraped data\n if(isHome)\n game.update(homePoints: points, homefgm: fgm, homefga: fga, homefgPer: fgPer, hometwoMade: twoPM, hometwoAtt: twoPA, hometwoPer: twoPer, homethreeMade: threePM, homethreeAtt: threePA, homethreePer: threePer, homeftm: ftm, homefta: fta, homeftPer: ftPer, homeoffReb: offReb, homedefReb: defReb, hometotalReb: totReb, homepps: pps, homeadjFG: adjFG, homeassist: assists, hometo: to, homeapto: apto, homesteals: steals, homefouls: pf, homestealPerTO: spto, homestealPerFoul: spf, homeblocks: blocks, homeblocksPerFoul: bpf, homeOvrWL: homeOvrPer, homeHomeWL: homePer)\n elsif\n game.update(awaypoints: points, awayfgm: fgm, awayfga: fga, awayfgPer: fgPer, awaytwoMade: twoPM, awaytwoAtt: twoPA, awaytwoPer: twoPer, awaythreeMade: threePM, awaythreeAtt: threePA, awaythreePer: threePer, awayftm: ftm, awayfta: fta, awayftPer: ftPer, awayoffReb: offReb, awaydefReb: defReb, awaytotalReb: totReb, awaypps: pps, awayadjFG: adjFG, awayassist: assists, awayto: to, awayapto: apto, awaysteals: steals, awayfouls: pf, awaystealPerTO: spto, awaystealPerFoul: spf, awayblocks: blocks, awayblocksPerFoul: bpf, awayOvrWL: homeOvrPer, awayAwayWL: awayPer)\n end\n\n # Always two rows, first is away, second is home\n isHome = true\n end\n end \n end",
"def show\n @game = Game.find(params[:id])\n\n # all users that haven't already been added to the game\n @users_not_added = User.all - User.in_game(@game.id)\n\n # new user_game for adding more\n @user_game = UserGame.new\n\n # current_user's data in this game\n @current_user_game = UserGame.find_by_user_id_and_game_id(current_user.id, @game.id)\n\n @transaction = Transaction.new\n @manager = User.find_by_id(@game.manager_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def create\n @user_game_stats = UserGameStat.new\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n UserGameStat.create!(id:current_user.id, user_id: current_user.id)\n format.html { redirect_to @user, notice: \"User was successfully created.\" }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_game\n @game = Game.find(params[:id])\n get_team_players\n @player_game_statistic=PlayerGameStatistic.new({:game_id => @game.id,:player_id=>Player.all.first.id})\n get_opponent_players\n end",
"def getStats (player)\n if player == \"me\"\n my_hits = self.my_hits\n my_misses = self.my_misses\n my_sunk_ships = sunkShips(\"me\")\n finished = self.finished\n stats = {my_hits: my_hits,\n my_misses: my_misses,\n my_sunk_ships: my_sunk_ships,\n finished: finished}\n statsRet = stats.to_json\n return statsRet\n\n else # player == \"enemy\"\n enemy_hits = self.enemy_hits\n enemy_misses = self.enemy_misses\n enemy_sunk_ships = sunkShips(\"enemy\")\n finished = self.finished\n stats = {enemy_hits: enemy_hits,\n enemy_misses: enemy_misses,\n enemy_sunk_ships: enemy_sunk_ships,\n finished: finished}\n statsRet = stats.to_json\n return statsRet\n end\n end",
"def initiate_game(user)\n $game_session = GameSession.create(\n user_id: user.id,\n total_score: 0,\n fifty_fifty: 1,\n phone_a_friend: 1\n )\nend",
"def initialize(app_id, game_data)\n @app_id = app_id\n @name = game_data.elements['name'].text\n if game_data.elements['globalStatsLink'].nil?\n @short_name = nil\n else\n @short_name = game_data.elements['globalStatsLink'].text.match(/http:\\/\\/steamcommunity.com\\/stats\\/([^?\\/]+)\\/achievements\\//)[1].downcase\n end\n\n @@games[@app_id] = self\n end",
"def load_stats(data, user)\n return data if data\n raise('No data or user provided') unless user\n stats = GithubStats.new(user).data\n raise(\"Failed to find data for #{user} on GitHub\") unless stats\n stats\n end",
"def games\n @users = User.all\n @conversation = Conversation.new\n end",
"def stats\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['stats']) do\n if params[:id] == current_user.id.to_s\n # A regular user can only view his/her own stats\n @user = current_user\n elsif current_user.is_admin\n # admin users can view anyone's stats\n unless @user = User.where(:id => params[:id]).first\n return render_error(404, \"could not find that user\")\n end\n else\n return render_error(401, \"unauthorized\")\n end\n\n @status = 200\n num_recent_frames = params[:num_frames] ? params[:num_frames].to_i : Settings::UserStats.num_recent_frames\n @stats = GT::UserStatsManager.get_dot_tv_stats_for_recent_frames(@user, num_recent_frames)\n @stats.each {|s| s.frame.creator[:shelby_user_image] = s.frame.creator.avatar_url}\n end\n end",
"def refresh_library\n\n if self.steam_uid != nil #Steam_username has to exist to call API\n\n #Call owned games using Steam API\n url = \"http://api.steampowered.com/IPlayerService/GetOwnedGames/v1/?key=#{ENV[\"STEAM_WEB_API_KEY\"]}&include_played_free_games=1&format=json&steamid=#{self.steam_uid}\"\n\n raw_data = open(url).read\n parsed_data = JSON.parse(raw_data)\n games = parsed_data[\"response\"][\"games\"]\n\n # Check if player doesn't own any games or profile is set to private\n if games.nil? == false\n\n #Run through every owned game\n games.each do |game|\n\n # Check if game already exists in Crewlink database\n if Game.where(:app_id => game[\"appid\"]).exists?\n # Pull Game ID from database by Steam App ID\n game_id = Game.where(:app_id => game[\"appid\"]).pluck(:id)[0]\n\n # Check if game is already in user's library\n if self.libraries.find_by(:game_id => game_id).present? == false\n # Pull multiplayer status from game database\n multiplayer_status = Game.find_by(:id => game_id).multiplayer_status\n\n # Build library entry\n library = Library.new\n library.owner_id = self.id\n library.game_id = game_id\n library.default_looking_to_play_status = multiplayer_status\n\n library.save\n end\n\n # Game not in database, so need to create game entry and library entry\n else\n app_id = game[\"appid\"].to_s\n url = \"http://store.steampowered.com/api/appdetails?appids=#{app_id}\"\n raw_data = open(url).read\n parsed_data = JSON.parse(raw_data)[app_id]\n success = parsed_data[\"success\"]\n\n # Some App IDs no longer work (Steam has deleted data), so must test for success value of true\n if success == true\n new_game = Game.new\n app_id = game[\"appid\"]\n title = parsed_data[\"data\"][\"name\"]\n developer = parsed_data[\"data\"][\"developers\"]\n img_url = parsed_data[\"data\"][\"header_image\"]\n multiplayer_status = 0\n\n categories = parsed_data[\"data\"][\"categories\"]\n\n if categories.class == Array\n\n categories.each do |type|\n if type[\"id\"] == 1\n multiplayer_status = 1\n end\n end\n end\n\n # Build game entry\n new_game.app_id = app_id\n new_game.title = title\n new_game.developer = developer\n new_game.multiplayer_status = multiplayer_status\n new_game.img_url = img_url\n\n new_game.save\n\n # Build library entry\n library = Library.new\n library.owner_id = self.id\n library.game_id = new_game.id\n library.default_looking_to_play_status = new_game.multiplayer_status\n\n library.save\n response = 0\n response\n end\n end\n end\n end\n end\n end",
"def add_stats\n @game = Game.find(params[:id])\n @player_stats_all = Player.find(params[:player_id]).player_stats.where(\n :season => @game.season,\n :league_id => @game.league_id,\n :team_id => params[:team_id]\n )\n \n if @player_stats_all.count > 0\n @player_stats = @player_stats_all.first\n else\n @player_stats = PlayerStats.new(\n :player_id => params[:player_id],\n :league_id => @game.league_id,\n :team_id => params[:team_id]\n )\n end\n \n @player_stats.add_game_desrriptor(params[:player_stats])\n @game.stats[params[:player_team] << params[:player_id]]\n \n ActiveRecord::Base.transaction do\n @player_stats.save\n @game.save\n end\n end",
"def per_game_stats(season = nil)\n season_id = season ? season.id : Season.current.id\n StatLine.find_by_sql('SELECT AVG(fgm) as fgm, AVG(fga) as fga, coalesce(AVG(fgm)/nullif(AVG(fga), 0), 0) as fgpct, AVG(twom) as twom, AVG(twoa) as twoa, coalesce(AVG(twom)/nullif(AVG(twoa), 0), 0) as twopct, AVG(threem) as threem, AVG(threea) as threea, coalesce(AVG(threem)/nullif(AVG(threea), 0), 0) as threepct,' \\\n 'AVG(ftm) as ftm, AVG(fta) as fta, coalesce(AVG(ftm)/nullif(AVG(fta), 0), 0) as ftpct, AVG(orb) as orb, AVG(drb) as drb, AVG(trb) as trb, AVG(ast) as ast, AVG(stl) as stl, AVG(blk) as blk, AVG(fl) as fl, AVG(\"to\") as to,' \\\n 'AVG(points) as points, COUNT(*) as game_count, sums.league_id FROM (SELECT SUM(fgm) as fgm, SUM(fga) as fga, SUM(twom) as twom, SUM(twoa) as twoa, SUM(threem) as threem, SUM(threea) as threea,' \\\n 'SUM(ftm) as ftm, SUM(fta) as fta, SUM(orb) as orb, SUM(drb) as drb, SUM(trb) as trb, SUM(ast) as ast, SUM(stl) as stl, SUM(blk) as blk, SUM(fl) as fl, SUM(\"to\") as to,' \\\n \"SUM(points) as points, g.league_id as league_id FROM stat_lines sl INNER JOIN games g ON sl.game_id = g.id \" \\\n \"WHERE g.winner is not null AND (g.forfeit is null or not g.forfeit) AND (sl.dnp is null OR not sl.dnp) AND team_id = #{self.id} AND g.season_id = #{season_id} GROUP BY game_id, g.league_id) sums GROUP BY sums.league_id\")\n end",
"def get_games\n @games = Game.where(:user_id=>:id)\n end",
"def index\n @user = user_session.current_user\n @new_game = Game.new(player1_id: @user.id)\n @ongoing_games = @user.ongoing_games\n @waiting_games = Game.waiting_games(@user)\n @user_waiting_game = @user.waiting_game\n @recent_games = @user.completed_games(5)\n end",
"def perform\n users = User.all\n\n users.each do |user|\n\n # Pull User status using Steam API\n url = \"http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=#{ENV[\"STEAM_WEB_API_KEY\"]}&steamids=#{user.steam_uid}\"\n parsed_data = JSON.parse(open(url).read)\n online_status = parsed_data[\"response\"][\"players\"][0][\"personastate\"]\n\n\n # Steam has many different status types, but anything above zero is indicative of the User having Steam open and being sign-in on at least one device\n if online_status > 0\n online_status = 1\n\n in_game_status = parsed_data[\"response\"][\"players\"][0][\"gameid\"]\n\n # If user is not in-game, in_game_status will be nil\n if in_game_status.nil?\n in_game_status = 0\n looking_to_play_status = 0\n else\n # Set Looking to play status based on game (Steamm returns app_id number when player is playing a game)\n current_game = user.owned_games.find_by(:app_id => in_game_status)\n looking_to_play_status = user.libraries.find_by(:game_id => current_game.id).default_looking_to_play_status\n end\n #If offline, player cannot be in a game and is not looking to play\n else\n in_game_status = 0\n looking_to_play_status = 0\n end\n\n # Store the user's last played game if they have played a game and this has been previously recorded in our database\n if user.in_game_status != 0 && in_game_status == 0\n user.last_played_game = user.in_game_status\n end\n\n #Update user entry\n user.online_status = online_status\n user.in_game_status = in_game_status\n user.looking_to_play_status = looking_to_play_status\n user.save\n end\n end",
"def index\n @available_games = Game.available(current_user)\n @users_games = Game.users_games(current_user)\n end",
"def all_stats_for_player(name, game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\nend",
"def initialize(steam_id)\n super steam_id, 'cs:s'\n\n if public?\n @last_match_stats = {}\n @total_stats = {}\n\n @last_match_stats[:cost_per_kill] = @xml_data.elements['stats/lastmatch/costkill'].text.to_f\n @last_match_stats[:ct_wins] = @xml_data.elements['stats/lastmatch/ct_wins'].text.to_i\n @last_match_stats[:damage] = @xml_data.elements['stats/lastmatch/dmg'].text.to_i\n @last_match_stats[:deaths] = @xml_data.elements['stats/lastmatch/deaths'].text.to_i\n @last_match_stats[:dominations] = @xml_data.elements['stats/lastmatch/dominations'].text.to_i\n @last_match_stats[:favorite_weapon_id] = @xml_data.elements['stats/lastmatch/favwpnid'].text.to_i\n @last_match_stats[:kills] = @xml_data.elements['stats/lastmatch/kills'].text.to_i\n @last_match_stats[:max_players] = @xml_data.elements['stats/lastmatch/max_players'].text.to_i\n @last_match_stats[:money] = @xml_data.elements['stats/lastmatch/money'].text.to_i\n @last_match_stats[:revenges] = @xml_data.elements['stats/lastmatch/revenges'].text.to_i\n @last_match_stats[:stars] = @xml_data.elements['stats/lastmatch/stars'].text.to_i\n @last_match_stats[:t_wins] = @xml_data.elements['stats/lastmatch/t_wins'].text.to_i\n @last_match_stats[:wins] = @xml_data.elements['stats/lastmatch/wins'].text.to_i\n @total_stats[:blind_kills] = @xml_data.elements['stats/lifetime/blindkills'].text.to_i\n @total_stats[:bombs_defused] = @xml_data.elements['stats/lifetime/bombsdefused'].text.to_i\n @total_stats[:bombs_planted] = @xml_data.elements['stats/lifetime/bombsplanted'].text.to_i\n @total_stats[:damage] = @xml_data.elements['stats/lifetime/dmg'].text.to_i\n @total_stats[:deaths] = @xml_data.elements['stats/summary/deaths'].text.to_i\n @total_stats[:domination_overkills] = @xml_data.elements['stats/lifetime/dominationoverkills'].text.to_i\n @total_stats[:dominations] = @xml_data.elements['stats/lifetime/dominations'].text.to_i\n @total_stats[:earned_money] = @xml_data.elements['stats/lifetime/money'].text.to_i\n @total_stats[:enemy_weapon_kills] = @xml_data.elements['stats/lifetime/enemywpnkills'].text.to_i\n @total_stats[:headshots] = @xml_data.elements['stats/lifetime/headshots'].text.to_i\n @total_stats[:hits] = @xml_data.elements['stats/summary/shotshit'].text.to_i\n @total_stats[:hostages_rescued] = @xml_data.elements['stats/lifetime/hostagesrescued'].text.to_i\n @total_stats[:kills] = @xml_data.elements['stats/summary/kills'].text.to_i\n @total_stats[:knife_kills] = @xml_data.elements['stats/lifetime/knifekills'].text.to_i\n @total_stats[:logos_sprayed] = @xml_data.elements['stats/lifetime/decals'].text.to_i\n @total_stats[:nightvision_damage] = @xml_data.elements['stats/lifetime/nvgdmg'].text.to_i\n @total_stats[:pistol_rounds_won] = @xml_data.elements['stats/lifetime/pistolrounds'].text.to_i\n @total_stats[:revenges] = @xml_data.elements['stats/lifetime/revenges'].text.to_i\n @total_stats[:rounds_played] = @xml_data.elements['stats/summary/rounds'].text.to_i\n @total_stats[:rounds_won] = @xml_data.elements['stats/summary/wins'].text.to_i\n @total_stats[:seconds_played] = @xml_data.elements['stats/summary/timeplayed'].text.to_i\n @total_stats[:shots] = @xml_data.elements['stats/summary/shots'].text.to_i\n @total_stats[:stars] = @xml_data.elements['stats/summary/stars'].text.to_i\n @total_stats[:weapons_donated] = @xml_data.elements['stats/lifetime/wpndonated'].text.to_i\n @total_stats[:windows_broken] = @xml_data.elements['stats/lifetime/winbroken'].text.to_i\n @total_stats[:zoomed_sniper_kills] = @xml_data.elements['stats/lifetime/zsniperkills'].text.to_i\n\n @last_match_stats[:kdratio] = (@total_stats[:deaths] > 0) ? @last_match_stats[:kills].to_f / @last_match_stats[:deaths] : 0\n @total_stats[:accuracy] = (@total_stats[:shots] > 0) ? @total_stats[:hits].to_f / @total_stats[:shots] : 0\n @total_stats[:kdratio] = (@total_stats[:deaths] > 0) ? @total_stats[:kills].to_f / @total_stats[:deaths] : 0\n @total_stats[:rounds_lost] = @total_stats[:rounds_played] - @total_stats[:rounds_won]\n end\n end",
"def show\n graph = Koala::Facebook::API.new(current_user.oauth_token)\n friends = graph.get_connections(\"me\", \"friends\")\n @friends_count = 0\n @gamers = []\n @ranking = []\n friends.each do |friend|\n unless (User.find_by uid: friend[\"id\"]).nil?\n friend = User.find_by uid: friend[\"id\"]\n if friend.games.include? @game\n @gamers << friend\n @ranking << friend\n end\n @friends_count = @friends_count + 1\n end\n end\n\n @last_achievements = current_user.achievements.where(:game_id => @game.id).all\n\n @user_achievements =[]\n unless @gamers.nil?\n @gamers.each do |gamer|\n gamer.achievements.each do |ach|\n if ach.game_id == @game.id\n user_achievement_new = UserAchievement.new\n user_achievement_new.user = gamer\n user_achievement_new.achievement = ach\n @user_achievements << user_achievement_new\n end\n end\n end\n\n @ranking << current_user\n @ranking = @ranking.sort_by! {|u| u.game_points(@game)}\n @ranking = @ranking.reverse\n\n @gamers = @gamers.sort_by! {|u| u.game_points(@game)}\n @gamers = @gamers.reverse\n end\n\n @game_points = 0\n @last_achievements.each do |ac|\n @game_points = @game_points + ac.points\n end\n\n end",
"def game\n fetch('games.super_mario.games')\n end",
"def fetch_games\n games, doc = [], get_xml(bungie_net_recent_games_url)\n (doc/:item).each_with_index do |item, i|\n games[i] = {\n :title => (item/:title).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :link => (item/'link').inner_html,\n :description => (item/:description).inner_html,\n :gameid => pull_gameid((item/'link').inner_html)\n }\n end\n return games\n end",
"def get_game_count(username)\n get_count(username, 'Played')\n end",
"def get_advanced_team_game_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StatsApi.get_advanced_team_game_stats ...'\n end\n # resource path\n local_var_path = '/stats/game/advanced'\n\n # query parameters\n query_params = {}\n query_params[:'year'] = opts[:'year'] if !opts[:'year'].nil?\n query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?\n query_params[:'team'] = opts[:'team'] if !opts[:'team'].nil?\n query_params[:'opponent'] = opts[:'opponent'] if !opts[:'opponent'].nil?\n query_params[:'excludeGarbageTime'] = opts[:'exclude_garbage_time'] if !opts[:'exclude_garbage_time'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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<AdvancedGameStat>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StatsApi#get_advanced_team_game_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_team_stats()\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team/stats\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def get_stats()\n result = Array.new()\n res = @db.query(\"SELECT * FROM UserStats;\")\n while row = res.fetch_row do\n result.push(UserInfo.new(row[0], row[1], row[2], row[3]))\n end\n result\n end",
"def find\n # @game = Game.not_full.without(current_user).sample || Game.create\n # @game.users << current_user\n \n @game = Game.last\n end",
"def calculate!\n ov = self[:overall]\n ov[:high_night] = {}\n ov[:winners] = {}\n\n self.each do |player_id, st|\n next if player_id == :overall\n\n ## calculate computed stats for player\n st[:nights] += st[:dates].keys.length # if st[:nights] == 0\n st[:high_night] = st[:dates].values.max\n st[:gold_stars] = 1 if st[:nights] == 29\n st[:warps_per_game] = 1.0 * st[:warps] / st[:games] rescue 0\n st[:warps_per_night] = 1.0 * st[:warps] / st[:nights] rescue 0\n st[:games_per_night] = 1.0 * st[:games] / st[:nights] rescue 0\n st[:wins_per_night] = 1.0 * st[:wins] / st[:nights] rescue 0\n st[:wins_per_game] = 1.0 * st[:wins] / st[:games] rescue 0\n\n ## accumulate overall stats\n [:warps, :wins, :cfbs,\n :mystery_factors, :gold_stars]. each do |field|\n ov[field] += st[field]\n end\n [:wimps, :come_ons].each do |field|\n if st[field]\n ov[field] ||= 0\n ov[field] += st[field]\n end\n end\n # nights won calculation\n st[:dates].each do |date,warps|\n ov[:dates][date] += warps\n hnd = ov[:high_night][date] ||= {:players => [], :warps => 0}\n if hnd[:warps] < warps\n hnd[:players] = [player_id]\n hnd[:warps] = warps\n elsif hnd[:warps] == warps\n hnd[:players].push(player_id)\n end\n end\n end\n\n ## update overall computed stats\n st = self[:overall]\n ov[:games] = ov[:wins]\n ov[:nights] = ov[:dates].keys.length\n ov[:nights] = 29 if ov[:nights] == 0 ## provide sane default\n ov[:nights] = ov[:nights_real] if ov[:nights_real]\n ov[:warps_per_game] = 1.0 * ov[:warps] / ov[:games] rescue 0\n ov[:warps_per_night] = 1.0 * ov[:warps] / ov[:nights] rescue 0\n ov[:games_per_night] = 1.0 * ov[:games] / ov[:nights] rescue 0\n ov[:high_night].each do |date,h|\n h[:players].each {|p| self[p][:nights_won] += 1}\n end\n\n ## determine per-stat winners\n # fuck everyone but the top 50 OR those with 50+ warps\n # the 51 below is not a bug\n sorted_players = self.keys.sort{|a,b| self[b][:warps] <=> self[a][:warps]}\n fifty_plus = self.keys.select{|p| self[p][:warps] >= 50}\n eligible = (sorted_players[0..51] | fifty_plus).\n inject(Hash.new(false)) {|acc,p| acc.merge(p => true)}\n [:warps, :games, :nights, :wins, :nights_won, :cfbs,\n :come_ons, :wimps, :warps_per_game, :warps_per_night,\n :games_per_night, :wins_per_game, :high_night].each do |field|\n owf = ov[:winners][field] = {:players => [], :value => 0}\n self.each do |player, st|\n next if player == :overall\n next unless eligible[player]\n if st[field].to_f > owf[:value]\n owf[:players] = [player]\n owf[:value] = st[field]\n elsif st[field] == owf[:value]\n owf[:players].push(player)\n end\n end\n end\n\n ## mark per-stat winners\n ov[:winners].each do |field, win|\n win[:players].each do |player|\n self[player][:winner][field] = true\n end\n end\n\n self\n end",
"def get_team_scoring_stats(conf)\n doc = getHTML(\"http://espn.go.com/mens-college-basketball/statistics/team/_/stat/scoring-per-game/seasontype/2/group/#{conf.webExt}\")\n table = doc.xpath('//table[@class = \"tablehead\"]')\n rows = table.css('tr[@class != \"colhead\"]')\n rows.each do |row|\n col = row.css('td')\n if(col.count == 10)\n\n name = col[1].text \n\n ppg = col[3].text\n\n fg = col[4].text.scan((/(\\d+.\\d+)-(\\d+\\d+)/)) \n fgm = fg[0][0].to_i\n fga = fg[0][1].to_i\n fgPer = col[5].text\n\n threeP = col[6].text.scan((/(\\d+.\\d+)-(\\d+.\\d+)/))\n threePM = threeP[0][0].to_i\n threePA = threeP[0][1].to_i\n threePer = col[7].text\n\n twoPM = fgm - threePM\n twoPA = fga - threePA\n\n ft = col[8].text.scan((/(\\d+.\\d+)-(\\d+.\\d+)/))\n ftm = ft[0][0].to_i\n fta = ft[0][1].to_i\n ftPer = col[9].text\n\n # Updates specific teams entry with newly scraped data\n team = Team.find_by! name: name \n team.update(points: ppg, fgm: fgm, fga: fga, fgPer: fgPer, threeMade: threePM, threeAtt: threePA, threePer: threePer, twoMade: twoPM, twoAtt: twoPA, ftm: ftm, fta: fta, ftPer: ftPer)\n end\n end \n end",
"def stats\n # lookup user + stats via api\n if user_signed_in? and request.headers['HTTP_COOKIE'] and @user = Shelby::API.get_user(params['user_id'])\n @frames = Shelby::API.get_user_stats(params['user_id'], req0uest.headers['HTTP_COOKIE'])\n end\n end",
"def stats(id, season = nil)\n Stats.new(Client.get(\"/v1.2/stats/by-summoner/#{id}/summary\", query: {\"season\" => season.to_s}))\n end",
"def player_stats(player_name)\n stats = {}\n player_data.each do |player|\n if player_name == player[:player_name]\n stats[:number] = player[:number]\n stats[:shoe] = player[:shoe]\n stats[:points] = player[:points]\n stats[:rebounds] = player[:rebounds]\n stats[:assists] = player[:assists]\n stats[:steals] = player[:steals]\n stats[:blocks] = player[:blocks]\n stats[:slam_dunks] = player[:slam_dunks]\n end\n end\n return stats\nend",
"def index\n @user = current_user # Needed for Merit\n\n if current_user.badges.size == 0\n award_badge(1)\n end\n\n if current_user.sign_in_count == 5\n award_badge(2)\n end\n\n if current_user.role.nil? || current_user.role.blank?\n current_user.role = 'Player'\n current_user.correct_answers_in_a_row = 0\n current_user.save\n end\n\n if Statistic.where(:email => current_user.email).blank?\n Statistic.create email: current_user.email, action_correct: 0, action_total: 0, adventure_correct: 0, adventure_total: 0, arcade_correct: 0, arcade_total: 0, fps_correct: 0, fps_total: 0, racing_correct: 0, racing_total: 0, role_playing_correct: 0, role_playing_total: 0, wins: 0, loses: 0\n end\n\n @opponent_turn_games = Game.where('user_email = ? OR opponent_user_email = ?', current_user.email, current_user.email).where.not(:user_turn_email => current_user.email).where(:is_game_over => false)\n @user_turn_games = Game.where(:user_turn_email => current_user.email).where(:is_game_over => false)\n @past_games = Game.where('user_email = ? OR opponent_user_email = ?', current_user.email, current_user.email).where(:is_game_over => true)\n end",
"def versus_stats\n return unless public?\n\n if @versus_stats.nil?\n versus_data = @xml_data['stats']['versus']\n\n @versus_stats = {}\n @versus_stats[:games_played] = versus_data['gamesplayed'].to_i\n @versus_stats[:games_completed] = versus_data['gamescompleted'].to_i\n @versus_stats[:finales_survived] = versus_data['finales'].to_i\n @versus_stats[:points] = versus_data['points'].to_i\n @versus_stats[:most_points_infected] = versus_data['pointsas']\n @versus_stats[:games_won] = versus_data['gameswon'].to_i\n @versus_stats[:games_lost] = versus_data['gameslost'].to_i\n @versus_stats[:highest_survivor_score] = versus_data['survivorscore'].to_i\n\n @versus_stats[:finales_survived_percentage] = @versus_stats[:finales_survived].to_f / @versus_stats[:games_played]\n\n self.class.const_get(:SPECIAL_INFECTED).each do |infected|\n @versus_stats[infected] = {}\n @versus_stats[infected][:special_attacks] = versus_data[\"#{infected}special\"].to_i\n @versus_stats[infected][:most_damage] = versus_data[\"#{infected}dmg\"].to_i\n @versus_stats[infected]['avg_lifespan'] = versus_data[\"#{infected}lifespan\"].to_i\n end\n end\n\n @versus_stats\n end",
"def basic_stats\n if @player_champs_list.present?\n {\n spec_user: User.find_by(name: @player.summoner.name.downcase),\n summoner: @player.summoner,\n top_played: first_champ(top_played_champs),\n top_kd: first_champ(top_kd_champs),\n top_wl: first_champ(top_wl_champs)\n }\n else \n nil\n end\n end",
"def set_player_game_statistic\n @player_game_statistic = PlayerGameStatistic.find(params[:id])\n end",
"def create\n @game = Game.new(params[:game])\n @game.manager_id = current_user.id\n\n @usergame = UserGame.new\n @usergame.user_id = current_user.id\n\n respond_to do |format|\n if @game.save\n @usergame.game_id = @game.id\n @usergame.balance = @game.budget\n @usergame.save!\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game\n fetch('esport.games')\n end",
"def player_stats(name)\n# player_stats start at nil (nothing)\n player_stats = nil\n# game_hash.each do |home_away, team_info| iterates over the hash to return all player_stats\n game_hash.each do |home_away, team_info|\n team_info.each do |data_label, data|\n if data_label == :players\n data.each do |player_name, stats|\n if player_name == name\n player_stats = stats\n end\n end\n end\n end\n end\n player_stats\nend",
"def call stat\n data = Hash.new { |h, k| h[k] = {} }\n @matches.each do |m|\n teams = [m.home_team, m.away_team]\n scaffs = StatScaffold.call(teams)\n scaffs[m.home_id], scaffs[m.away_id] = StatParser.call(m, scaffs[m.home_id], scaffs[m.away_id])\n data[m.home_team.name][m.round] = scaffs[m.home_id][stat]\n data[m.away_team.name][m.round] = scaffs[m.away_id][stat]\n end\n data.map {|team| {:name => team[0], :data => team[1]}}\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def fetch_league_stats(params={})\n\n url_params = {\n # dates are inclusive\n 'DateFrom' => [''], # '02/01/2015'\n 'DateTo' => [''],\n 'GameScope' => [''],\n 'GameSegment' => [''],\n 'LastNGames' => ['0'],\n 'LeagueID' => ['00'],\n 'Location' => [''],\n 'MeasureType' => ['Advanced'], # 'Base', 'Advanced', 'Four Factors',\n 'Month' => ['0'],\n 'OpponentTeamID' => ['0'],\n 'Outcome' => [''],\n 'PaceAdjust' => ['N'],\n 'PerMode' => ['Totals'],\n 'Period' => ['0'],\n 'PlayerExperience' => [''],\n 'PlayerPosition' => [''],\n 'PlusMinus' => ['N'],\n 'Rank' => ['N'],\n 'Season' => ['2014-15'],\n 'SeasonSegment' => [''],\n 'SeasonType' => ['Regular Season'],\n 'StarterBench' => [''],\n 'VsConference' => [''],\n 'VsDivision' => ['']}\n\n url_params = merge_valid_params(\n url_params,\n {'MeasureType' => ['Base', 'Advanced', 'Four Factors'],\n 'Season' => ['2013-14', '2014-15', '2015-16', '2016-17', '2017-18']\n },\n params\n )\n unless params['DateFrom'].nil?\n url_params['DateFrom'] = params['DateFrom']\n end\n unless params['DateTo'].nil?\n url_params['DateTo'] = params['DateTo']\n end\n\n fetch_cached_url('http://stats.nba.com/stats/leaguedashteamstats', url_params)\n # example_url = 'http://stats.nba.com/stats/leaguedashteamstats?Conference=&DateFrom=12%2F01%2F2017&DateTo=&Division=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Advanced&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2017-18&SeasonSegment=&SeasonType=Regular+Season&ShotClockRange=&StarterBench=&TeamID=0&VsConference=&VsDivision='\n # y = 'http://stats.nba.com/stats/leaguedashteamstats?DateFrom=&DateTo=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Advanced&Month=0&OpponentTeamID=0&Outcome=&PaceAdjust=N&PerMode=Totals&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2014-15&SeasonSegment=&SeasonType=Regular+Season&StarterBench=&VsConference=&VsDivision='\nend",
"def get_stats (stats)\n if stats.season_exists\n stats.update_stats\n stats.display\n else\n puts \"There are no recorded statistics for that season.\"\n end\nend",
"def index\n @games = Game.where(user_id: session[:user_id])\n current_user_id = current_user.id\n @current_user_rating = UserRating.find_by(user_id:current_user_id).rating\n end",
"def load_fantasy_stats\n load_tournament_list\n load_tournament_game_data\n create_leagues\n load_player_data\n end",
"def show\n authorize @bgg_publisher\n results = WithGameSummaries::SearchAndPaginate.call(params: params,\n initial_scope: @bgg_publisher.game_summaries,\n init_search: { game_summary_summaries_bgg_summary_id_in_all: [@bgg_publisher.id]}\n )\n\n @q = results.q\n @game_summaries = results.game_summaries\n\n end",
"def fill_stats(raw_hash)\n logger.debug(\"************** building match_stats with raw_hash: #{raw_hash}\")\n stats_hash = {:win => raw_hash[\"wins\"].to_i,\n :hero_id => raw_hash[\"hero_id\"].to_i,\n :team => raw_hash[\"team\"].to_i,\n :position => raw_hash[\"position\"].to_i,\n :hero_kills => raw_hash[\"herokills\"].to_i,\n :deaths => raw_hash[\"deaths\"].to_i,\n :hero_assists => raw_hash[\"heroassists\"].to_i,\n :level => raw_hash[\"level\"].to_i,\n :item_1 => raw_hash[\"slot_1\"].to_i,\n :item_2 => raw_hash[\"slot_2\"].to_i,\n :item_3 => raw_hash[\"slot_3\"].to_i,\n :item_4 => raw_hash[\"slot_4\"].to_i,\n :item_5 => raw_hash[\"slot_5\"].to_i,\n :item_6 => raw_hash[\"slot_6\"].to_i,\n :rating_change => raw_hash[\"amm_team_rating\"].to_f,\n :gold_lost_death => raw_hash[\"goldlost2death\"].to_i,\n :secs_dead => raw_hash[\"secs_dead\"].to_i,\n :hero_dmg => raw_hash[\"herodmg\"].to_i,\n :hero_kill_exp => raw_hash[\"heroexp\"].to_i,\n :hero_kill_gold => raw_hash[\"herokillsgold\"].to_i,\n :creep_kills => raw_hash[\"teamcreepkills\"].to_i,\n :creep_dmg => raw_hash[\"teamcreepdmg\"].to_i,\n :creep_exp => raw_hash[\"teamcreepexp\"].to_i,\n :creep_gold => raw_hash[\"teamcreepgold\"].to_i,\n :neutral_kills => raw_hash[\"neutralcreepkills\"].to_i,\n :neutral_dmg => raw_hash[\"teamcreepdmg\"].to_i,\n :neutral_exp => raw_hash[\"neutralcreepexp\"].to_i,\n :neutral_gold => raw_hash[\"neutralcreepgold\"].to_i,\n :building_dmg => raw_hash[\"bdmg\"].to_i,\n :building_gold => raw_hash[\"bgold\"].to_i,\n :denies => raw_hash[\"denies\"].to_i,\n :exp_denied => raw_hash[\"exp_denied\"].to_i,\n :gold => raw_hash[\"gold\"].to_i,\n :gold_spent => raw_hash[\"gold_spent\"].to_i,\n :exp => raw_hash[\"exp\"].to_i,\n :actions => raw_hash[\"actions\"].to_i,\n :secs => raw_hash[\"secs\"].to_i,\n :consumables => raw_hash[\"consumables\"].to_i,\n :wards => raw_hash[\"wards\"].to_i,\n :nickname => raw_hash[\"nickname\"],\n :hon_id => raw_hash[\"account_id\"].to_i,\n :match_number => raw_hash[\"match_id\"].to_i}\n return \"duplicate\" if MatchStat.where(\"hon_id = ? AND match_number = ?\", stats_hash[:hon_id], stats_hash[:match_number]).any?\n stats_hash.each_key {|field| self.send(\"#{field}=\", stats_hash[field])}\n user = User.find_by_hon_id(self.hon_id)\n uid = user.id if user\n self.user_id = uid if uid and !self.user_id\n return self.save\n \n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def setup_game\n log_message(\"Game Restarting...\")\n @game_start_time = Time.now.to_i\n @users_by_id.values.each do |user|\n user[\"score\"] = 0\n end\n end",
"def score_user_lolteam\n lolteam = self\n summoner_ids = lolteam.attributes.values.slice(3,7)\n scoring_object = {}\n sum_of_scores_across_summoners = Summoner.where(id: summoner_ids).each_with_index do |summoner,idx|\n scoring_object[\"slot#{idx + 1}\"] = summoner.final_score(lolteam.bet.id).round(2)\n scoring_object[\"id#{idx + 1}\"] = summoner.id\n scoring_object[\"name#{idx + 1}\"] = summoner.name\n end\n scoring_object['total_score'] = scoring_object['slot1'].round(2) + scoring_object['slot2'].round(2) + scoring_object['slot3'].round(2) + scoring_object['slot4'].round(2) + scoring_object['slot5'].round(2) + scoring_object['slot6'].round(2) + scoring_object['slot7'].round(2)\n scoring_object[:user_id] = self.user.id\n scoring_object[:lolteam_id] = self.id\n scoring_object\n end",
"def new\n @user = User.find(params[:user_id])\n @game = @user.games.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @game }\n end\n end",
"def player_stats(player_name)\n result = {}\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats\n end\n end\n end\n result\nend",
"def player_stats(name)\n stats = {}\n game_hash.each do |team, team_data|\n team_data[:players].each do |data, output|\n if data == name \n stats = output\n end\n end\n end\n stats\nend",
"def index\n @player_game_statistics = PlayerGameStatistic.all\n end",
"def player_stats(player_name)\n player_stats = {}\n game_hash.each do |team, all_info_hash|\n all_info_hash[:players].each do |stats|\n if stats[:player_name] == player_name\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def show\n @user = User.find(params[:id])\n @games = @user.games\n\n end",
"def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n if(teams[away_team.name].nil?)\n teams[away_team.name] = {:win => 0, :loss => 0, :tie => 0, :point => 0}\n end\n if(game.home_team_score && game.visiting_team_score)\n if(game.home_team_score > game.visiting_team_score)\n # home team won\n teams[home_team.name][:win] += 1\n teams[home_team.name][:point] += 5\n # visiting team loss\n teams[away_team.name][:loss] += 1\n elsif(game.home_team_score < game.visiting_team_score)\n # home team loss\n teams[home_team.name][:loss] += 1\n #visiting team won\n teams[away_team.name][:win] += 1\n teams[away_team.name][:point] += 5\n else\n # tie game\n teams[home_team.name][:tie] += 1\n teams[home_team.name][:point] += 1\n teams[away_team.name][:tie] += 1\n teams[away_team.name][:point] += 1\n end\n end\n end\n teams.each do |team, value|\n puts team\n total_games = value[:win] + value[:loss] + value[:tie]\n if total_games > 0 \n win_percentage = value[:win]/total_games.to_f\n else\n win_percentage = 0\n end \n value[:percentage] = win_percentage\n end\n teams_sorted = teams.sort_by{ |k, v| v[:point]}.reverse\n return teams_sorted\n end",
"def fetch_player_activity\n unique_ids_two_weeks_ago = Card.for_quizzes.between_days('quizzes', 14, 8).select(:user_id).distinct.pluck(:user_id)\n unique_ids_one_week_ago = Card.for_quizzes.between_days('quizzes', 7, 1).select(:user_id).distinct.pluck(:user_id)\n returned_user_ids = unique_ids_two_weeks_ago.select { |id| unique_ids_one_week_ago.include?(id) }\n left_user_ids = unique_ids_two_weeks_ago.reject { |id| unique_ids_one_week_ago.include?(id) }\n returned_users = User.where(id: returned_user_ids).sample(25)\n left_users = User.where(id: left_user_ids).sample(25)\n message_count = Notification.where('notifications.created_at BETWEEN ? AND ?', DateTime.current.beginning_of_day - 7, DateTime.current.end_of_day - 1).size\n new_users = User.where('users.created_at BETWEEN ? AND ?', DateTime.current.beginning_of_day - 7, DateTime.current.end_of_day - 1).sample(25)\n confirmed_can_users = Hash.new(0)\n can_users = Hash.new(0)\n User.confirmed.where(source: \"mlb_scan_lp\").each do |user|\n role = user.roles.first\n role ? confirmed_can_users[user.roles.first.name] += 1 : confirmed_can_users['global'] += 1\n end\n User.where(confirmed: false).where(source: \"mlb_scan_lp\").each do |user|\n role = user.roles.first\n role ? can_users[user.roles.first.name] += 1 : can_users['global'] += 1\n end\n registered_count = confirmed_can_users.size\n unregistered_count = can_users.size\n phone_number_count = PhoneNumber.all.size\n WeeklyUserActivityMailer.stats_email(\n new_users: new_users, \n returned_users: returned_users, \n left_users: left_users,\n message_count: message_count,\n can_users: can_users,\n confirmed_can_users: confirmed_can_users,\n registered_count: registered_count,\n unregistered_count: unregistered_count,\n phone_number_count: phone_number_count\n ).deliver_now\n end",
"def initialize(id, username, name, profile_url, avatar_url, repo_stats, nbr_stared, nbr_forks, orgs_user_belong, score)\n @id = id\n @username = username\n @name = name\n @profile_url = profile_url\n @avatar_url = avatar_url\n @repos = repo_stats\n @nbr_stared = nbr_stared\n @nbr_forks = nbr_forks\n @orgs_user_belong = orgs_user_belong\n @score = score\n end",
"def show\n id = User.find_by_fb_id(params[:id]).id\n @user_game = UserGame.find_by_user_id(id)\n\n respond_to do |format|\n format.json { render json: @user_game }\n end\n end",
"def get_team_games(team)\n # Set Up\n doc = getHTML(\"http://espn.go.com/mens-college-basketball/team/schedule/_/id/#{team.webExt}\")\n\n table = doc.xpath('//table[@class = \"tablehead\"]')\n rows = table.css('tr')\n\n # Loop through each row\n rows.each do |row|\n if(row.css('li').count > 3)\n linkHref = row.css('li[@class =\"score\"]')[0].css('a[href]')[0]\n if(linkHref != nil)\n link = linkHref[\"href\"].scan(/(.*=)(\\d+)/)\n gameID = link[0][1] \n if(Game.where(gameID: gameID).empty?)\n # get Date\n date = row.css(\"td\")[0].text\n # get opp\n opp = row.css('li[@class =\"team-name\"]').text\n # get HOME/away (vs/@)\n loc = row.css('li[@class =\"game-status\"]').text\n if(loc == \"@\")\n homeTeam = team.name\n awayTeam = opp\n else\n homeTeam = opp\n awayTeam = team.name\n end\n \n # Creates Game Entry\n game = Game.create(gameID: gameID, date: date, homeTeam: homeTeam, awayTeam: awayTeam)\n # Gets more game stats\n get_game_stats(game)\n end\n end\n end\n end\n end",
"def leaderboard(type = Person::STATS_ALL_TIME, force = false)\n\n # Get our Redis store\n# store = Redis.new\n\n # Define the key\n key = \"Leaderboard \" + type\n \n # Get the value from Redis\n val = nil #store.get(key)\n \n # Get the object for the player from Redis\n # or a new Hash if it doesn't exist\n if force || val == nil\n\n # Get all the games in the given time window\n if type == Person::STATS_SEVEN_DAY \n \n # Define our key objects\n nSecsWeek = 604800 \n t = Time.now \n t.utc\n \n startkey = t.to_i\n endkey = t.to_i - nSecsWeek\n \n # We can't compute these stats in CouchDB, because we can't\n # reduce on a filtered view. Therefore we have to calculate the\n # stats here.\n \n # Get the games from the Game Controller\n gc = GameController.new @server \n games = gc.all(type)\n\n # Create storage to calculate the stats in\n stats = Hash.new\n \n # Define a lambda to initialize a new hash for statistics\n initStatsHash = ->{ \n {:points => 0, :wins => 0, :losses => 0}\n }\n \n # Iterate through the games\n games.each do |game| \n # Get the winners\n playerIds = game.playerIds\n # Calculate the stats for each player in the game\n playerIds.each do |playerId|\n # Check to see if we've created stats before\n if ! stats.has_key?(playerId)\n # Create a new hash for statistics\n stats[playerId] = initStatsHash.call()\n end\n \n # Get the points for the player earnt for the game\n points = game.pointsForPlayer(playerId)\n if points != 0\n stats[playerId][:points] += points\n if points > 0\n stats[playerId][:wins] += 1\n else\n stats[playerId][:losses] += 1\n end\n end\n end\n end\n \n # Turn this into an array\n results = stats.each { |key,value|\n value[:playerId] = key\n }.values\n \n # Now update the percentages\n results.each do |stats|\n stats[:percentage] = (stats[:wins].to_f / (stats[:wins] + stats[:losses])) * 100 \n end\n\n # Now we need to sort it\n leaderboard = results.sort_by { |item|\n # This sorts everyone with out a single win to the bottom, then by points, descending, and by wins descending\n [item[:wins] == 0 ? 1 : 0, -item[:points], -item[:wins]]\n }.enum_for(:each_with_index).collect { |item, i|\n {:person => self.byId(item[:playerId]), :rank => item, :position => i + 1}\n }\n\n \n else\n\n # Create a request\n req = @server + \"/#{CouchDB::DB}/_design/Game/_view/leaderboard?group_level=1\"\n\n # Get the response from CouchDB\n response = CouchRest.get req\n\n # Sort the results\n leaderboard = response['rows'].sort_by { |item|\n # This sorts everyone with out a single win to the bottom, then by points, descending, and by wins descending\n [item['value']['wins'] == 0 ? 1 : 0, -item['value']['points'], -item['value']['wins']]\n }.enum_for(:each_with_index).collect { |item, i|\n {:person => self.byId(item['key'][0]), :rank => item['value'], :position => i + 1}\n }\n \n end\n\n # Save the leaderboard in redis\n# store.set key, leaderboard.to_json\n\n elsif val != nil\n # Parse the leaderboard out of redis\n leaderboard = JSON.parse(val)\n end\n\n # Return the leaderboard\n return leaderboard\n end",
"def getMidSeasonStatistics()\n for player in @skater_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{player[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft + stats[\"goals\"]).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft + stats[\"assists\"]).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft + stats[\"powerPlayPoints\"]).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft + stats[\"plusMinus\"]).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft + stats[\"shots\"]).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft + stats[\"hits\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft).to_i\n end\n puts player\n end\n for goalie in @goalie_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{goalie[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft + stats[\"gamesStarted\"]).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft + stats[\"wins\"]).to_i\n goalie[9] = (((goalie[9].to_f)*gamesLeft + stats[\"savePercentage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[11] = (((goalie[11].to_f)*gamesLeft + stats[\"goalAgainstAverage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft + stats[\"shutouts\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft).to_i\n goalie[9] = ((goalie[9].to_f/82)*gamesLeft).to_i\n goalie[11] = ((goalie[11].to_f/82)*gamesLeft).to_i\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft).to_i\n end\n puts goalie\n end\nend",
"def initialize(steam_id64, app_id, achievement_data)\n @app_id = app_id\n @name = achievement_data.elements['name'].text\n @steam_id64 = steam_id64\n @unlocked = (achievement_data.attributes['closed'].to_i == 1)\n\n if @unlocked && !achievement_data.elements['unlockTimestamp'].nil?\n @timestamp = Time.at(achievement_data.elements['unlockTimestamp'].text.to_i)\n end\n end",
"def newgame\n # unless @stats_mode == true\n # puts \"\\n=========================================================\"\n # end\n \n @players = Array.new\n @frame_scores = Array.new\n @game_scores = Array.new\n \n @player = 1\n @frame_no = 1\n @roll_type = 1\n @pins_remaining = 10\nend",
"def get_details(game) \n\n # HTML.parse is used here to clean up HTML codes like and line breaks\n game.description = Nokogiri::HTML.parse(@doc.css('description').text).text\n\n # These items are pretty easy to grab\n game.minplayers = @doc.css('minplayers')[0]['value']\n game.maxplayers = @doc.css('maxplayers')[0]['value']\n game.minplaytime = @doc.css('minplaytime')[0]['value'] \n game.maxplaytime = @doc.css('maxplaytime')[0]['value'] \n game.minage = @doc.css('minage')[0]['value'] \n\n # Pull the various types of item out of <link> into respective arrays\n game.category = @doc.css('link').select{|link| link['type']==\"boardgamecategory\"}.collect{|link| link['value']}\n game.mechanic = @doc.css('link').select{|link| link['type']==\"boardgamemechanic\"}.collect{|link| link['value']}\n game.publisher = @doc.css('link').select{|link| link['type']==\"boardgamepublisher\"}.collect{|link| link['value']}\n game.designer = @doc.css('link').select{|link| link['type']==\"boardgamedesigner\"}.collect{|link| link['value']}\n\n # The URL formula isn't via API. It's just boardgamegeek's URL scheme.\n game.url = \"https://boardgamegeek.com/boardgame/#{game.id}\"\n end",
"def set_game\n @game = Game.includes(game_players: %i[force user]).find(params[:id])\n end",
"def player_stats(player_name)\nplayer_stats = {}\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == player_name\n player_stats = stats\n end\n end\n end\n player_stats\nend",
"def game\n @nukes = Nuke.where(user_id:params[:id])\n @ships = Ship.all\n @ships_sunk = ShipsSunk.where(user_id:params[:id])\n end",
"def player_stats(player_name)\n stat_hash = {}\n game_hash.keys.each do |location|\n if game_hash[location][:players][player_name]\n return game_hash[location][:players][player_name]\n end\n end\nend",
"def create_or_update_user_stats(stats, user)\n stats.each do |date_string, data|\n date = Time.zone.parse(date_string)\n\n user_stat = UserStat.where(user_id: user.id, date: date).first_or_initialize(user_id: user.id, date: date)\n\n user_stat.file_views = data.fetch(:views, 0)\n user_stat.file_downloads = data.fetch(:downloads, 0)\n user_stat.work_views = data.fetch(:work_views, 0)\n user_stat.save!\n end\n end",
"def points_scored_for_player(name,game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\nend",
"def establish_game_session game_data, when_game_id_received\n # get next game id\n game_id = get_next_game_id\n\n # call the procedure when game id is received\n when_game_id_received.call(game_id)\n\n # register new game id into queue for other user to search\n register_game_to_queue(game_id)\n\n # write initial data of the game to the server\n flags = game_data[\"bombs\"] || 10\n width = game_data[\"board_width\"] || 10\n height = game_data[\"board_height\"] || 10\n game_data = {\n # default with easy mode\n \"board_width\" => width,\n \"board_height\" => height,\n \"bombs\" => flags,\n \"game_id\" => game_id\n }\n\n # initialize new session\n new_session = {\n \"host\" => initialize_board_view(width, height),\n \"opponent\" => initialize_board_view(width, height),\n \"data\" => game_data,\n \"who_win\" => -2\n }\n\n # write to server new game data\n craft_firebase_command(\"minesweeper/game#{game_id}.json\", \"PUT\", new_session)\n\n # return new game data\n game_data\nend",
"def featured_stats\n player_data = {\n spec_user: @user,\n summoner: @player.summoner,\n top_played: filter_champs(top_played_champs, TOP_FIVE),\n top_kd: filter_champs(top_kd_champs, TOP_FIVE),\n top_wl: filter_champs(top_wl_champs, TOP_FIVE)\n }\n end",
"def show\n @user = User.find(params[:user_id]) \n @game = @user.games.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def url\n \"#{Steam::API::COMMUNITY_URL}/stats/#{app_id}/leaderboards/#{leaderboard_id}\"\n end",
"def load_game\n\tsettings.game_data = Ben::Game.load\n\tgame_json\nend",
"def player_stats(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, values|\n if attribute == :players\n values.each do |person, data|\n if person.to_s == player_name\n return game_hash[location][:players][person]\n end\n end\n end\n end\n end\nend",
"def new_game(min_bet)\n # Automatically boot player if not enough funds.\n @game_stats = {\n 'hands' => [],\n 'active_hand' => nil,\n 'turn_over' => false,\n 'bet' => 0,\n }\n if !can_bet(min_bet)\n fold\n return\n end\n end",
"def create\n @game = Game.new(game_params)\n assign_for_user\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fetch_data(team, start, end_date)\n team.users.map do |u|\n { capacity: u.capacity(start, end_date),\n gravatar: u.gravatar_url,\n name: u.name }\n end\n end",
"def get_team(game)\n team = 0\n get_participation_by_game game do |participation|\n team = participation.team\n end\n team\n end",
"def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend",
"def show\n @game_stat = GameStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_stat }\n end\n end",
"def player_stats(player)\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if name.to_s == player\n return stats\n end\n end\n end\nend",
"def recent_games\n fetch_games\n end",
"def show\n authorize @game_library\n results = WithGameSummaries::SearchAndPaginate.call(params: params,\n initial_scope: @game_library.game_summaries,\n init_search: {game_library_items_game_library_id_in_all: [@game_library.id]}\n )\n\n @q = results.q\n @game_summaries = results.game_summaries\n end",
"def create\n @game = current_user.games_as_player1.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n populate_players\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game\n\n\t# console - list databases: psql -l\n\t# console - access database: psql rick_rampage_development\n\t# database - list tables: \\d \n\t# database - display table: select * from <table_name>;\n\n \t# all high scores assigned to @scores variable\n\t@high_scores = Score.order('points DESC').limit(5).all\n\n\t# last score of the current player assigned to the @score variable\n\t#@score = Score.where(:user_id => current_user.id).first\n\n\t# best rank\n\t@scores_from_top = Score.order('points DESC, created_at DESC').all\n\n\t# worst rank\n\t@scores_from_bottom = Score.order('points ASC, created_at DESC').all\n\n\t@scores_length = @scores_from_bottom.length;\n\n\t#current_user.nil? ? Score.none : current_user.scores.last\n\t\n\tcurrent_user.nil? ? Score.none : @my_latest_score = Score.where(:user_id => current_user.id).order('created_at DESC').first\n\n\tcurrent_user.nil? ? Score.none : @my_avg_score = Score.where(:user_id => current_user.id).order('created_at DESC').average('points').to_i\n\n\t# last rank of the current player assigned to the @rank variable\n\n\t#@rank = Score.order('points DESC').first.points.inspect\n\t#@rank = Score.where(:user_id => current_user.id)\n\n end",
"def get_or_create_game\n # Since multiple players may attempt to get_or_create_game at the\n # same time, only allow 1 the possibility of creating a new game.\n Game.connection.execute(\"BEGIN EXCLUSIVE\")\n\n # Check if the latest game is active. If so, continue that game.\n # Otherwise create a new game.\n # TODO check the state of the game, anything other than complete\n # should be picked back up\n game = Game.last\n if !game || game.state == \"complete\"\n Game.connection.execute(\"INSERT INTO games (state) VALUES ('config')\")\n\n # If a new game was created, save the name of the player who did\n # the creation\n player = params[:player]\n end\n\n Game.connection.execute(\"END\")\n\n # Indicates that this player just created a new game. Create a new\n # Player and set it to be the active player in charge of the game\n # configuration stage.\n if player\n Game.uncached do\n game = Game.last\n end\n player = Player.create(JSON.parse(player).merge({ :game_id => game.id }))\n game.update_attributes(:active_player_id => player.id)\n end\n\n render :json => {\n :game => game,\n :players => game ? game.players : []\n }\n end",
"def create\n new_user_game = {}\n new_user_game[:game_id] = params[:game_id].to_i\n new_user_game[:user_id] = current_user.id\n @user_game = UserGame.new(new_user_game)\n\n respond_to do |format|\n if @user_game.save\n format.html { redirect_to user_games_url, notice: 'User game was join in game with success.' }\n format.json { render action: 'index', status: :created, location: @user_game }\n else\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @game = @user.games.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to user_game_path(@user,@game), :notice => 'Game was successfully created.' }\n format.json { render :json => @game, :status => :created }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def game_hash \n stats = {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: ['Black', 'White'],\n players: [\n {'Alan Anderson' => { number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, steals: 3, blocks: 1, slam_dunks: 1}},\n {'Reggie Evans' => { number: 30, shoe: 14, points: 12, rebounds: 12, assists: 12, steals: 12, blocks: 12, slam_dunks: 7}},\n {'Brook Lopez' => { number: 11, shoe: 17, points: 17, rebounds: 19, assists: 10, steals: 3, blocks: 1, slam_dunks: 15}},\n {'Mason Plumlee' => { number: 1, shoe: 19, points: 26, rebounds: 11, assists: 6, steals: 3, blocks: 8, slam_dunks: 5}},\n {'Jason Terry' => { number: 31, shoe: 15, points: 19, rebounds: 2, assists: 2, steals: 4, blocks: 11, slam_dunks: 1}}\n ]\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: ['Turquoise', 'Purple'],\n players: [\n {'Jeff Adrien' => { number: 4, shoe: 18, points: 10, rebounds: 1, assists: 1, steals: 2, blocks: 7, slam_dunks: 2}},\n {'Bismack Biyombo' => { number: 0, shoe: 16, points: 12, rebounds: 4, assists: 7, steals: 22, blocks: 15, slam_dunks: 10}},\n {'DeSagna Diop' => { number: 2, shoe: 14, points: 24, rebounds: 12, assists: 12, steals: 4, blocks: 5, slam_dunks: 5}},\n {'Ben Gordon' => { number: 8, shoe: 15, points: 33, rebounds: 3, assists: 2, steals: 1, blocks: 1, slam_dunks: 0}},\n {'Kemba Walker' => { number: 33, shoe: 15, points: 6, rebounds: 12, assists: 12, steals: 7, blocks: 5, slam_dunks: 12}}\n ]\n }\n }\nend",
"def refresh!(data = nil)\n update_time = Time.now\n data ||= Steam::API.leaderboard(app_id, leaderboard_id)[:entries][:entry]\n\n user_ids = data.map { |e| e[:steamid] }.select { |id| User.user(id, request: false).nil? }\n User.from_array Steam::API.user(user_ids) if user_ids.any?\n\n data.each do |e|\n this_user = User.user(e[:steamid])\n next unless entrys.where(user: this_user, time: e[:score]).count.zero?\n\n Entry.create(\n user: this_user,\n rank: e[:rank],\n leaderboard: self,\n time: e[:score],\n timestamp: update_time\n )\n end\n\n update(last_updated: update_time)\n end"
] |
[
"0.7009098",
"0.63882446",
"0.6170086",
"0.6129993",
"0.6085228",
"0.5936688",
"0.5916315",
"0.58934957",
"0.5889802",
"0.58598995",
"0.5858862",
"0.5840439",
"0.5833535",
"0.5817031",
"0.5793984",
"0.57758486",
"0.5762053",
"0.57380074",
"0.57326174",
"0.56929284",
"0.5642656",
"0.56305736",
"0.5624661",
"0.56107885",
"0.5586472",
"0.55298495",
"0.55260324",
"0.5508991",
"0.55077165",
"0.5492869",
"0.5486136",
"0.54818743",
"0.5466827",
"0.5450455",
"0.5437096",
"0.5433455",
"0.5426531",
"0.54237604",
"0.5421804",
"0.5410848",
"0.5398617",
"0.53836703",
"0.53823334",
"0.53772956",
"0.53689176",
"0.5362072",
"0.5348697",
"0.53244466",
"0.5317115",
"0.53115237",
"0.53109056",
"0.5310653",
"0.5304722",
"0.52919555",
"0.5291908",
"0.52897686",
"0.52783823",
"0.5265457",
"0.5258614",
"0.5246072",
"0.52431923",
"0.5240929",
"0.52362347",
"0.52326965",
"0.52298325",
"0.5228723",
"0.52283597",
"0.5225584",
"0.52141607",
"0.5200847",
"0.51953214",
"0.5191478",
"0.5191139",
"0.5190089",
"0.5186733",
"0.5184834",
"0.5184025",
"0.51838946",
"0.5177787",
"0.5174983",
"0.5161536",
"0.5160003",
"0.515628",
"0.5151069",
"0.51441747",
"0.5142496",
"0.5136752",
"0.5129702",
"0.5125723",
"0.5125067",
"0.5122835",
"0.5116349",
"0.5115303",
"0.5114752",
"0.5113001",
"0.5108507",
"0.5106732",
"0.5103589",
"0.5098707",
"0.509847"
] |
0.5481148
|
32
|
Returns the achievements for this stats' user and game. If the achievements haven't been parsed already, parsing is done now.
|
def achievements
return unless public?
if @achievements.nil?
@achievements = Array.new
@xml_data.elements.each('achievements/achievement') do |achievement_data|
@achievements << GameAchievement.new(@steam_id64, @app_id, achievement_data)
end
@achievements_done = @achievements.reject{ |a| !a.unlocked? }.size
end
@achievements
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calc_achievements\n\n #TODO: Use a list of achievements in db with conditions stored in db, iterate and award as necessary. \n if (self.games_won_as_pacman == 10)\n self.user.achievements << Achievement.create(:name => \"The Elusive Pacman\", :desc => \"Win 10 games as Pacman\");\n elsif (self.games_won_as_pacman == 100)\n self.user.achievements << Achievement.create(:name => \"Pacman Supreme\", :desc => \"Win 100 games as Pacman\");\n elsif (self.games_won_as_ghost == 10)\n self.user.achievements << Achievement.create(:name => \"Pacman Killer\", :desc => \"Win 10 games as a Ghost\");\n elsif (self.games_won_as_ghost == 100)\n self.user.achievements << Achievement.create(:name => \"Guardian of all the dots in the world\", :desc => \"Win 100 games as a Ghost\");\n elsif (self.total_ghosts_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"Om nom nom!\", :desc => \"Eat 50 ghosts.\");\n elsif (self.total_pacman_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"He never saw it coming.\", :desc => \"Eat 50 Pacman\");\n end \n end",
"def get_achievement(name)\n if initted?\n val = ' '\n ok = @@dll_SteamAPI_ISteamUserStats_GetAchievement.call(@i_user_stats, name, val) % 256 != 0\n ok ? val.unpack('C')[0] != 0 : nil\n else\n nil\n end\n end",
"def guild_achievements\r\n BnetApi::make_request('/wow/data/guild/achievements')\r\n end",
"def achievement_data(options = {})\n options = options.dup\n perform_with_objects(:get, '/wow/data/character/achievements', options, Armory::Achievement::Category, :achievements)\n end",
"def achievements\n @achievements ||= Achievement.where(subject_id: primary_key_value)\n end",
"def get_num_achievements\n if initted?\n @@dll_SteamAPI_ISteamUserStats_GetNumAchievements.call @i_user_stats\n else\n nil\n end\n end",
"def index\n @achievement = Achievement.get_public_achievements\n # instead of public_access we use get_public_achievements\n end",
"def achievement(name)\n achievements.find_by(name: name)\n end",
"def get_character_achievements(name = @character_name, options = {})\n\t\t options = character_options(name, options)\n\t\t \n\t\t character_achievements = get_xml(@@character_achievements_url, options)\n\t\t \n\t\t return Wowr::Classes::CharacterAchievementsInfo.new(character_achievements, self)\n\t end",
"def achievements( params={} )\n achievements = get_connections(\"achievements\", params)\n return map_connections achievements, :to => Facebook::Graph::Generic\n end",
"def achievements_data\r\n BnetApi.make_request('/sc2/data/achievements')\r\n end",
"def read_achievements\n end",
"def get_achievement_and_unlock_time(name)\n if initted?\n achieved = ' '\n unlock_time = ' ' * 4\n ok = @@dll_SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime.call(@i_user_stats, name, achieved, unlock_time) % 256 != 0\n ok ? [achieved.unpack('C')[0] != 0, Time.at(unlock_time.unpack('L')[0])] : nil\n else\n nil\n end\n end",
"def character_achievements\r\n BnetApi::make_request('/wow/data/character/achievements')\r\n end",
"def csca_update_achievements\r\r\n $csca.achievements.each do |achievement|\r\r\n next if achievement.earned\r\r\n next if achievement.progress.nil?\r\r\n if csca_get_progress_completion(achievement)\r\r\n achievement.earn_achievement\r\r\n $game_map.ach_earned = true\r\r\n $game_map.ach_display = achievement\r\r\n end\r\r\n end\r\r\n end",
"def show\n\t\t@achievements = (@user.achievements.where(level: 1) + Achievement.where(level: 1, hidden: false).order(\"created_at desc\")).uniq.paginate(page: params[:page], per_page: 20)\n\tend",
"def get_achievement(achievement_id, player_id=0)\n achievements = achievements_by_player_id(player_id, [achievement_id])\n raise ActiveRecord::RecordNotFound.new(\n \"Cannot find achievement by id #{achievement_id}!\"\n ) if achievements.size == 0\n achievements[0]\n end",
"def index\n @achievements = Achievement.where(:user_id => current_user.id) # get all achievements for this user\n \n respond_to do |format|\n format.html\n end\n end",
"def achievements_done\n achievements if @achievements_done.nil?\n @achievements_done\n end",
"def load_data\n completes = load_save\n ACHIEVEMENTS.each do |index, content|\n title, passed, description = content\n completed = completes.include?(index)\n @data_achievements[index] = Achievement.new(title, description, completed)\n end\n end",
"def show\n graph = Koala::Facebook::API.new(current_user.oauth_token)\n friends = graph.get_connections(\"me\", \"friends\")\n @friends_count = 0\n @gamers = []\n @ranking = []\n friends.each do |friend|\n unless (User.find_by uid: friend[\"id\"]).nil?\n friend = User.find_by uid: friend[\"id\"]\n if friend.games.include? @game\n @gamers << friend\n @ranking << friend\n end\n @friends_count = @friends_count + 1\n end\n end\n\n @last_achievements = current_user.achievements.where(:game_id => @game.id).all\n\n @user_achievements =[]\n unless @gamers.nil?\n @gamers.each do |gamer|\n gamer.achievements.each do |ach|\n if ach.game_id == @game.id\n user_achievement_new = UserAchievement.new\n user_achievement_new.user = gamer\n user_achievement_new.achievement = ach\n @user_achievements << user_achievement_new\n end\n end\n end\n\n @ranking << current_user\n @ranking = @ranking.sort_by! {|u| u.game_points(@game)}\n @ranking = @ranking.reverse\n\n @gamers = @gamers.sort_by! {|u| u.game_points(@game)}\n @gamers = @gamers.reverse\n end\n\n @game_points = 0\n @last_achievements.each do |ac|\n @game_points = @game_points + ac.points\n end\n\n end",
"def badges\n achievements.reduce({}) do |badges, achievement|\n badges.merge(achievement.name => achievement.badges)\n end\n end",
"def has_achievement?(name)\n achievements.exists?(name: name)\n end",
"def index\n @achievements ||= Achievement.all\n end",
"def achievements_percentage\n @achievements.size.to_f / @schema.achievements.size\n end",
"def achievements_percentage\n achievements_done.to_f / @achievements.size\n end",
"def set_achievement(name)\n if initted?\n ok = @@dll_SteamAPI_ISteamUserStats_SetAchievement.call(@i_user_stats, name) % 256 != 0\n @@dll_SteamAPI_ISteamUserStats_StoreStats.call(@i_user_stats) % 256 != 0 && ok\n else\n false\n end\n end",
"def at_a_glance\n @ag_plus_minus = Player.where('games_played >= ?', 3).order(plus_minus: :desc).limit(5)\n @ag_toughest_opponents = Player.where('games_played >= ?', 3).includes(:rating).order(\"ratings.avg_opp_rating DESC\").limit(5)\n @ag_winning_streak = Player.where('games_played >= ?', 3).order(win_streak: :desc).limit(5)\n @ag_avg_points = Player.where('games_played >= ?', 3).sort_by(&:avg_points).reverse[0..4] #TODO make this a table column instead..\n @ag_win_percent = Player.where('games_played >= ?', 3).sort_by(&:win_percentage).reverse[0..4] #TODO make this a table column instead..\n @ag_highest_ever_rating = Player.where('games_played >= ?', 3).includes(:rating).order(\"ratings.highest_ever DESC\").limit(5)\n end",
"def index\n @achievements = Achievement.all\n end",
"def general\n\t\t@achievements = (@user.achievements.where(level: 1, category: 'general') + Achievement.where(level: 1, hidden: false, category: 'general').order(\"created_at desc\")).uniq.paginate(page: params[:page], per_page: 20)\n\tend",
"def find_achievement(name)\n Achievement.find_by(name: name)\n end",
"def get_achievement_display_attribute(name, key)\n if initted?\n @@dll_SteamAPI_ISteamUserStats_GetAchievementDisplayAttribute.call @i_user_stats, name, key\n else\n nil\n end\n end",
"def get_achievement_name(achievement)\n if initted?\n @@dll_SteamAPI_ISteamUserStats_GetAchievementName.call @i_user_stats, achievement\n else\n nil\n end\n end",
"def index\n\n if(params[:user_id])\n @user = User.find_by(id: params[:user_id])\n authentication_required(@user)\n @achievements = @user.achievements\n end\n end",
"def latest_achievements\n achievements.order('user_achievements.created_at DESC').limit(5)\n end",
"def index\n @team_member_achievements = TeamMemberAchievement.all\n end",
"def achievements_done\n @achievements.size\n end",
"def get(index)\n return @data_achievements[index]\n end",
"def profile\r\n\t\tif User.exists?(id: params[:id])\r\n\t\t\t@user = User.where(id: params[:id])\r\n\t\t\t@name = @user[0].username\r\n\t\t\t@member_since = @user[0].member_since\r\n\t\t\t@email = @user[0].email\r\n\t\t\t@xp = @user[0].xp\r\n\t\t\t@answercount = @user[0].no_comment\r\n\t\t\t@postcount = @user[0].no_thread\r\n\t\t\t\r\n\t\t\t#add achievements\r\n\t\t\tif @u_id == params[:id].to_i\r\n\t\t\t\t@achievements = Achievement.find(:all)\r\n\t\t\t\[email protected] do |a|\r\n\t\t\t\t\tif @xp >= a.condition\r\n\t\t\t\t\t\tif UserAchievement.where(user_id: @u_id, achievement_id: a.id).empty?\r\n\t\t\t\t\t\t\t@ua = UserAchievement.new(:user_id => @u_id, :achievement_id => a.id)\r\n\t\t\t\t\t\t\[email protected]\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t# retrieves achievements to be displayed\r\n\t\t\t@achievement = UserAchievement.where(user_id: params[:id])\r\n\t\t\t\r\n\t\telse\r\n\t\t\tredirect_to root_path\r\n\t\tend\r\n\tend",
"def all_stats_for_player(name, game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats] if player_hash[:player_name] == name\n end\nend",
"def get_game_stats(game)\n agent = Mechanize.new\n html = agent.get(\"http://espn.go.com/ncb/boxscore?gameId=#{game.gameID}\").body\n doc = Nokogiri::HTML(html)\n\n awayRecs = doc.xpath(\"//div[@class = 'team-info']\").css(\"p\")[0].text\n awayOvrRaw = awayRecs.scan(/(\\d+)-(\\d+),.*/)\n if(awayOvrRaw != [] )\n awayOvrPer = awayOvrRaw[0][0].to_f / (awayOvrRaw[0][1].to_f + awayOvrRaw[0][0].to_f)\n else\n awayOvrPer = 0.05\n end\n awayRaw = awayRecs.scan(/.*, (\\d+)-(\\d+)/)\n if(awayRaw != [])\n awayPer = awayRaw[0][0].to_f / (awayRaw[0][1].to_f + awayRaw[0][0].to_f)\n else\n awayPer = 0.05 \n end\n homeRecs = doc.xpath(\"//div[@class = 'team-info']\").css(\"p\")[1].text\n homeOvrRaw = homeRecs.scan(/(\\d+)-(\\d+),.*/)\n if(homeOvrRaw != [])\n homeOvrPer = homeOvrRaw[0][0].to_f / (homeOvrRaw[0][1].to_f + homeOvrRaw[0][0].to_f) \n else\n homeOvrPer = 0.05\n end\n homeRaw = homeRecs.scan(/.*, (\\d+)-(\\d+)/)\n if(homeRaw != [])\n homePer = homeRaw[0][0].to_f / (homeRaw[0][1].to_f + homeRaw[0][0].to_f)\n else\n homePer = 0.05\n end\n # Find the table with information\n table = doc.xpath('//table[@class = \"mod-data\"]')\n rows = table.css('tbody')\n\n # Declare variables\n isHome = false\n homePoints = 0\n awayPoints = 0\n\n # Get data for game\n rows.each do |row|\n col = row.css('td')\n if(col.count == 18)\n fg = col[1].text.scan((/(\\d+)-(\\d+)/)) \n fgm = fg[0][0].to_f\n fga = fg[0][1].to_f\n fgPer = fgm / fga\n\n threeP = col[2].text.scan((/(\\d+)-(\\d+)/))\n threePM = threeP[0][0].to_f\n threePA = threeP[0][1].to_f\n threePer = threePM / threePA\n\n twoPM = fgm - threePM\n twoPA = fga - threePA\n twoPer = twoPM.to_f / twoPA.to_f\n\n ft = col[3].text.scan((/(\\d+)-(\\d+)/))\n ftm = ft[0][0].to_f\n fta = ft[0][1].to_f\n ftPer = ftm / fta\n\n offReb = col[4].text.to_f\n defReb = col[5].text.to_f\n totReb = col[6].text.to_f\n assists = col[7].text.to_f\n steals = col[8].text.to_f\n blocks = col[9].text.to_f\n to = col[10].text.to_f\n pf = col[11].text.to_f\n\n points = col[12].text.to_f\n pps = points / fga\n adjFG = ((points - ftm)/ fga)/ 2\n\n apto = assists / to\n spto = steals / to\n spf = steals / pf\n bpf = blocks / pf\n \n # Updates specific game entry with newly scraped data\n if(isHome)\n game.update(homePoints: points, homefgm: fgm, homefga: fga, homefgPer: fgPer, hometwoMade: twoPM, hometwoAtt: twoPA, hometwoPer: twoPer, homethreeMade: threePM, homethreeAtt: threePA, homethreePer: threePer, homeftm: ftm, homefta: fta, homeftPer: ftPer, homeoffReb: offReb, homedefReb: defReb, hometotalReb: totReb, homepps: pps, homeadjFG: adjFG, homeassist: assists, hometo: to, homeapto: apto, homesteals: steals, homefouls: pf, homestealPerTO: spto, homestealPerFoul: spf, homeblocks: blocks, homeblocksPerFoul: bpf, homeOvrWL: homeOvrPer, homeHomeWL: homePer)\n elsif\n game.update(awaypoints: points, awayfgm: fgm, awayfga: fga, awayfgPer: fgPer, awaytwoMade: twoPM, awaytwoAtt: twoPA, awaytwoPer: twoPer, awaythreeMade: threePM, awaythreeAtt: threePA, awaythreePer: threePer, awayftm: ftm, awayfta: fta, awayftPer: ftPer, awayoffReb: offReb, awaydefReb: defReb, awaytotalReb: totReb, awaypps: pps, awayadjFG: adjFG, awayassist: assists, awayto: to, awayapto: apto, awaysteals: steals, awayfouls: pf, awaystealPerTO: spto, awaystealPerFoul: spf, awayblocks: blocks, awayblocksPerFoul: bpf, awayOvrWL: homeOvrPer, awayAwayWL: awayPer)\n end\n\n # Always two rows, first is away, second is home\n isHome = true\n end\n end \n end",
"def set_achievement\n @achievement ||= Achievement.find(params[:id])\n end",
"def goals_by_game_situation(season = nil)\n stats_request(\"goalsByGameSituation\", season).first\n end",
"def scheduled_achievements\n @scheduled_achievements ||=\n ScheduledAchievement\n .joins(:achievement)\n .where(achiever_achievements: { subject_id: primary_key_value })\n end",
"def achievement_status_class(achievement, current_course_user)\n if current_course_user.nil? || current_course_user.staff?\n []\n elsif achievement.course_users.include?(current_course_user)\n ['granted']\n else\n ['locked']\n end\n end",
"def parse_scores(games)\n games.each do |game|\n puts \"#{game['date']} #{game['away_team']}: #{game['away_score']} #{game['home_team']}: #{game['home_score']}\"\n end\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def reload\n info = @user.get \"users/me/goals/#{@slug}.json\"\n _parse_info info\n end",
"def index\n @games = Game.accessible_by(current_ability, :manage).actual\n end",
"def achievement_params\n params.require(:achievement).permit(:game_id, :points, :image, :name, :description, :active)\n end",
"def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end",
"def profile_achievement_url(achievement = nil)\n \"#{world.url}internal/achiev.php?act_user_id=#{user_id}##{achievement.try(:link_anchor)}\"\n end",
"def clear_achievement(name)\n if initted?\n ok = @@dll_SteamAPI_ISteamUserStats_ClearAchievement.call(@i_user_stats, name) % 256 != 0\n @@dll_SteamAPI_ISteamUserStats_StoreStats.call(@i_user_stats) % 256 != 0 && ok\n else\n false\n end\n end",
"def set_achievement\n @achievement = Achievement.find(params[:id])\n end",
"def set_achievement\n @achievement = Achievement.find(params[:id])\n end",
"def set_achievement\n @achievement = Achievement.find(params[:id])\n end",
"def fetch_games\n game_csv = nil\n DGS::ConnectionPool.with do |dgs|\n game_csv = dgs.get(session, '/quick_status.php?version=2')\n end\n new_games = GameCSVParser.new(game_csv).games\n game_merger = GameMerger.new(self.games, new_games)\n self.games = game_merger.current_games\n create_notifications_for_games!(game_merger)\n game_merger.added_games\n # rescue others => report & ignore, blow transaction?\n rescue DGS::NotLoggedInException\n handle_expired_session\n end",
"def create\n @achievement = Achievement.new(params[:achievement])\n if params[:user_ids]\n @achievement.users = User.find(params[:user_ids])\n end\n respond_to do |format|\n if @achievement.save\n format.html { redirect_to(@achievement, :notice => 'Achievement was successfully created.') }\n format.xml { render :xml => @achievement, :status => :created, :location => @achievement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @achievement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @achievement = Achievement.find(params[:id])\n if params[:user_ids]\n @achievement.users = User.find(params[:user_ids])\n end\n respond_to do |format|\n if @achievement.update_attributes(params[:achievement])\n format.html { redirect_to(@achievement, :notice => 'Achievement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @achievement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @user = current_user # Needed for Merit\n\n if current_user.badges.size == 0\n award_badge(1)\n end\n\n if current_user.sign_in_count == 5\n award_badge(2)\n end\n\n if current_user.role.nil? || current_user.role.blank?\n current_user.role = 'Player'\n current_user.correct_answers_in_a_row = 0\n current_user.save\n end\n\n if Statistic.where(:email => current_user.email).blank?\n Statistic.create email: current_user.email, action_correct: 0, action_total: 0, adventure_correct: 0, adventure_total: 0, arcade_correct: 0, arcade_total: 0, fps_correct: 0, fps_total: 0, racing_correct: 0, racing_total: 0, role_playing_correct: 0, role_playing_total: 0, wins: 0, loses: 0\n end\n\n @opponent_turn_games = Game.where('user_email = ? OR opponent_user_email = ?', current_user.email, current_user.email).where.not(:user_turn_email => current_user.email).where(:is_game_over => false)\n @user_turn_games = Game.where(:user_turn_email => current_user.email).where(:is_game_over => false)\n @past_games = Game.where('user_email = ? OR opponent_user_email = ?', current_user.email, current_user.email).where(:is_game_over => true)\n end",
"def complete_achievements(options={})\n options.reverse_merge!(:count => 1)\n\n @objectives.push([\n Objective::CompleteAchievements,\n {:key => Objective::CompleteAchievements::KEY,\n :count => options[:count]}\n ])\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def create\n @achievement = Achievement.new(achievement_params)\n @remaining_points = 2000\n current_game_owner.game.achievements.each do |achievement|\n @remaining_points = @remaining_points - achievement.points\n end\n\n respond_to do |format|\n if @achievement.points.nil?\n points = @remaining_points\n else\n points =@remaining_points - @achievement.points\n end\n\n if points > 0\n if @achievement.save\n format.html { redirect_to edit_game_path(current_game_owner.game), notice: 'Se ha guardado el logro correctamente.' }\n format.json { render :show, status: :created, location: @achievement }\n else\n format.html { render :new }\n format.json { render json: @achievement.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new, alert: \"No te quedan suficientes puntos disponibles.\" }\n format.json { render json: \"not enough points\", status: :unprocessable_entity }\n end\n\n\n end\n end",
"def index\n @achievements = Achievement.all\n respond_with @achievements\n end",
"def parse_all_scores(games)\n sorted = games.sort_by {|date, games| date }\n sorted.each do |date, games|\n games.each do |game|\n puts \"#{date} #{game['away_team']}: #{game['away_score']} #{game['home_team']}: #{game['home_score']}\"\n end\n end\n end",
"def set_achievement\n @achievement = Achievement.find(params[:id])\n end",
"def stats_for_grader(submissions)\n result = []\n problem_id_to_name = @assessment.problem_id_to_name\n stats = Statistics.new\n\n grader_scores = {}\n submissions.each do |submission|\n next unless submission.special_type == Submission::NORMAL\n\n submission.scores.each do |score|\n next if score.grader_id.nil?\n if grader_scores.has_key? score.grader_id\n grader_scores[score.grader_id] << score\n else\n grader_scores[score.grader_id] = [score]\n end\n end\n end\n\n grader_ids = grader_scores.keys\n print grader_scores\n def find_user(i)\n print \"\\n FIND USER I \\n\"\n print i\n if 0 == i\n return Hash[\"full_name\", \"Autograder\", \n \"id\", 0,\n \"full_name_with_email\", \"Autograder\"]\n else\n return User.find(i)\n end\n end\n graders = grader_ids.map(&method(:find_user))\n graders = graders.compact\n graders.sort! { |g1, g2| g1.full_name <=> g2.full_name }\n\n\n graders.each do |grader|\n scores = grader_scores[grader[\"id\"]]\n print \"\\n SCORES \\n\"\n print grader[:id]\n print \"\\n\"\n print scores\n\n problem_scores = {}\n @assessment.problems.each do |problem|\n problem_scores[problem.id] = []\n end\n\n scores.each do |score|\n problem_scores[score.problem_id] << score.score\n end\n\n problem_stats = []\n @assessment.problems.each do |problem|\n problem_stats << [problem.name, stats.stats(problem_scores[problem.id])]\n end\n\n result << [grader[\"full_name_with_email\"], problem_stats]\n end\n return result\n end",
"def getStats (player)\n if player == \"me\"\n my_hits = self.my_hits\n my_misses = self.my_misses\n my_sunk_ships = sunkShips(\"me\")\n finished = self.finished\n stats = {my_hits: my_hits,\n my_misses: my_misses,\n my_sunk_ships: my_sunk_ships,\n finished: finished}\n statsRet = stats.to_json\n return statsRet\n\n else # player == \"enemy\"\n enemy_hits = self.enemy_hits\n enemy_misses = self.enemy_misses\n enemy_sunk_ships = sunkShips(\"enemy\")\n finished = self.finished\n stats = {enemy_hits: enemy_hits,\n enemy_misses: enemy_misses,\n enemy_sunk_ships: enemy_sunk_ships,\n finished: finished}\n statsRet = stats.to_json\n return statsRet\n end\n end",
"def games\n @games ||= populate_game_array\n end",
"def goals_by_hoa_id_suite\n goals_by_away_id\n goals_by_home_id\n average_score_per_away_game_by_team_id\n average_score_per_home_game_by_team_id\n end",
"def goals_by_hoa_id_suite\n goals_by_away_id\n goals_by_home_id\n average_score_per_away_game_by_team_id\n average_score_per_home_game_by_team_id\n end",
"def index\n @available_games = Game.available(current_user)\n @users_games = Game.users_games(current_user)\n end",
"def get_character_achievements_category(achievement_category, name = @character_name, options = {})\n\t\t options = character_options(name, options)\n\t\t\toptions[:achievement_category] = achievement_category.to_i\n\t\t \n\t\t character_achievements_category = get_xml(@@character_achievements_url, options)\n\t\t \n\t\t return Wowr::Classes::AchievementsList.new(character_achievements_category, self)\n\t end",
"def new_badges\n achievements.map(&:new_badges).flatten\n end",
"def achievement(title, options={}, &hook)\n hook_method_name = \"#{title}_hook\"\n hooked_achievement = HookedAchievement.new(title, hook_method_name, options)\n \n # Add hook method to model\n define_method(hook_method_name, &hook)\n \n write_inheritable_hash(:achievements, title => hooked_achievement)\n end",
"def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end",
"def players\n all_players = {}\n game_hash.each do |home_or_away, team_stats|\n all_players.merge!(team_stats[:players])\n end\n all_players\nend",
"def mission_stats\n return unless public?\n\n if @mission_stats.nil?\n @mission_stats = {}\n @xml_data['stats']['missions'].each do |mission_data|\n mission = AlienSwarmMission.new *mission_data\n @mission_stats[mission.name] = mission\n end\n end\n\n @mission_stats\n end",
"def per_game_stats(season = nil)\n season_id = season ? season.id : Season.current.id\n StatLine.find_by_sql('SELECT AVG(fgm) as fgm, AVG(fga) as fga, coalesce(AVG(fgm)/nullif(AVG(fga), 0), 0) as fgpct, AVG(twom) as twom, AVG(twoa) as twoa, coalesce(AVG(twom)/nullif(AVG(twoa), 0), 0) as twopct, AVG(threem) as threem, AVG(threea) as threea, coalesce(AVG(threem)/nullif(AVG(threea), 0), 0) as threepct,' \\\n 'AVG(ftm) as ftm, AVG(fta) as fta, coalesce(AVG(ftm)/nullif(AVG(fta), 0), 0) as ftpct, AVG(orb) as orb, AVG(drb) as drb, AVG(trb) as trb, AVG(ast) as ast, AVG(stl) as stl, AVG(blk) as blk, AVG(fl) as fl, AVG(\"to\") as to,' \\\n 'AVG(points) as points, COUNT(*) as game_count, sums.league_id FROM (SELECT SUM(fgm) as fgm, SUM(fga) as fga, SUM(twom) as twom, SUM(twoa) as twoa, SUM(threem) as threem, SUM(threea) as threea,' \\\n 'SUM(ftm) as ftm, SUM(fta) as fta, SUM(orb) as orb, SUM(drb) as drb, SUM(trb) as trb, SUM(ast) as ast, SUM(stl) as stl, SUM(blk) as blk, SUM(fl) as fl, SUM(\"to\") as to,' \\\n \"SUM(points) as points, g.league_id as league_id FROM stat_lines sl INNER JOIN games g ON sl.game_id = g.id \" \\\n \"WHERE g.winner is not null AND (g.forfeit is null or not g.forfeit) AND (sl.dnp is null OR not sl.dnp) AND team_id = #{self.id} AND g.season_id = #{season_id} GROUP BY game_id, g.league_id) sums GROUP BY sums.league_id\")\n end",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def draw_achievement(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n achievement = @data[index]\n if achievement != nil\n rect.width -= 4\n self.contents.font.color = normal_color\n self.contents.font.color.alpha = @data[index].completed? ? 255 : 128\n self.contents.draw_text(rect.x + 24, rect.y, 172, WLH, @data[index].title)\n end\n end",
"def index\n @achievements = Achievement.where(:category_id => 168).order(:title)\n @members = Member.active.order(:name).includes(:achievements)\n\n respond_to do |wants|\n wants.html\n end\n end",
"def total_score\n @all_games.map do |games|\n games[\"home_goals\"].to_i + games[\"away_goals\"].to_i\n end\n end",
"def games(complete = nil)\n games_scope = Game.where('challenger_id = ? OR challenged_id = ?', self.id, self.id)\n games_scope.includes(:challenged, :challenger)\n games_scope.where('complete = ?', complete) if complete\n games_scope = games_scope.order('created_at DESC')\n\n games_scope\n end",
"def average_goals_by_season\n goals_by_season = @games.group_by { |game| game.season.to_s }\n goals_by_season.each do |season, games|\n season_goals = games.map { |game| game.home_goals + game.away_goals }.sum\n goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2)\n end\n end",
"def achievements_count\n completed_count = Bet.where('owner = ? AND status = ?', params[:id], \"won\").to_a.count\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n won_count = completed_count\n # count all the bets that user accepted, and then the owner failed on\n invs.each do |i|\n won_count += 1 if i.bet.status == 'lost'\n end\n render json: {completed: completed_count, won: won_count}\n end",
"def get_advanced_team_game_stats(opts = {})\n data, _status_code, _headers = get_advanced_team_game_stats_with_http_info(opts)\n data\n end",
"def user_badges user_id=\"self\"\n response = get(\"/users/#{user_id}/badges\")[\"response\"]\n if response[\"sets\"] and response[\"sets\"][\"groups\"]\n response[\"sets\"][\"groups\"].map!{|group| Foursquared::Response::BadgeGroup.new(self, group)}\n end\n\n if response[\"badges\"]\n response[\"badges\"].each_key do |badge_id|\n response[\"badges\"][badge_id] = badge(badge_id)\n end\n end\n response\n end",
"def show\n @achievementuser = Achievementuser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievementuser }\n end\n end",
"def goals(player_id)\n Stat.where(player_id: player_id).sum(:goals)\n end",
"def player_stats(name)\n# player_stats start at nil (nothing)\n player_stats = nil\n# game_hash.each do |home_away, team_info| iterates over the hash to return all player_stats\n game_hash.each do |home_away, team_info|\n team_info.each do |data_label, data|\n if data_label == :players\n data.each do |player_name, stats|\n if player_name == name\n player_stats = stats\n end\n end\n end\n end\n end\n player_stats\nend",
"def update!(**args)\n @achievement_name = args[:achievement_name] if args.key?(:achievement_name)\n @achievement_unlocked_icon_url = args[:achievement_unlocked_icon_url] if args.key?(:achievement_unlocked_icon_url)\n @rarity_percentage = args[:rarity_percentage] if args.key?(:rarity_percentage)\n end",
"def announces\n load_page(\"http://#{@domain}/\").css('#boxCenterComingGames #lnkGameTitle')\n .map { |a| parse_game(a) }\n end",
"def all_players\n home_players = game_hash[:home][:players] # Array of player Hashes\n away_players = game_hash[:away][:players] # Array of player Hashes\n home_players + away_players # Array of player Hashes\nend",
"def all_players\n home_players = game_hash[:home][:players] # Array of player Hashes\n away_players = game_hash[:away][:players] # Array of player Hashes\n home_players + away_players # Array of player Hashes\nend",
"def badges(options={})\n self.class.parse_badges(request(singular(user_id) + \"/badges\", options))\n end",
"def games(complete = nil)\n games_scope = Game.where('challenger_id = ? OR challenged_id = ?', id, id)\n games_scope.includes(:challenged, :challenger)\n games_scope.where('complete = ?', complete) if complete\n games_scope = games_scope.order('created_at DESC')\n\n games_scope\n end",
"def authorize_achievement!\n authorize!(:award, @achievement) if achievement_params.include?(:course_user_ids)\n end",
"def update\n respond_to do |format|\n if @achievement.update(achievement_params)\n format.html { redirect_to @achievement, notice: 'Achievement was successfully updated.' }\n format.json { render :show, status: :ok, location: @achievement }\n else\n format.html { render :edit }\n format.json { render json: @achievement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @achievements = Achievement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @achievements }\n end\n end"
] |
[
"0.65684885",
"0.6397081",
"0.6334587",
"0.6323498",
"0.630337",
"0.626555",
"0.6222719",
"0.6204567",
"0.6124604",
"0.60512006",
"0.6031974",
"0.58580565",
"0.5852766",
"0.57708806",
"0.5687688",
"0.56250644",
"0.55900407",
"0.55871034",
"0.5569041",
"0.5567442",
"0.5533525",
"0.5505622",
"0.54013264",
"0.53949225",
"0.5320716",
"0.5308027",
"0.52686715",
"0.5263607",
"0.52620804",
"0.5250312",
"0.5218884",
"0.5211655",
"0.51735663",
"0.5171675",
"0.51432264",
"0.5112596",
"0.509021",
"0.50856996",
"0.5073745",
"0.50734156",
"0.49508962",
"0.49401194",
"0.49389985",
"0.49360377",
"0.493131",
"0.4927818",
"0.4897266",
"0.4869257",
"0.48660332",
"0.48587286",
"0.48164555",
"0.4804745",
"0.47935724",
"0.4792903",
"0.4792903",
"0.4792903",
"0.47891653",
"0.47834912",
"0.47821558",
"0.47753176",
"0.47697866",
"0.4767685",
"0.47531688",
"0.4744107",
"0.47336656",
"0.47291306",
"0.47131115",
"0.4711145",
"0.4687586",
"0.46281546",
"0.46281546",
"0.46249473",
"0.4601101",
"0.4577215",
"0.45744428",
"0.45724273",
"0.45683676",
"0.4556486",
"0.45347127",
"0.45289582",
"0.4520929",
"0.45060855",
"0.44976202",
"0.4476431",
"0.4472845",
"0.44667888",
"0.44654912",
"0.4456879",
"0.44538635",
"0.44451255",
"0.4435287",
"0.44336402",
"0.4419589",
"0.44156826",
"0.44156826",
"0.4412848",
"0.4410501",
"0.44080904",
"0.44048604",
"0.43979624"
] |
0.7600278
|
0
|
Returns the count of achievements done by this player. If achievements haven't been parsed yet, parsing is done now.
|
def achievements_done
achievements if @achievements_done.nil?
@achievements_done
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def achievements_done\n @achievements.size\n end",
"def get_num_achievements\n if initted?\n @@dll_SteamAPI_ISteamUserStats_GetNumAchievements.call @i_user_stats\n else\n nil\n end\n end",
"def achievements\n return unless public?\n\n if @achievements.nil?\n @achievements = Array.new\n @xml_data.elements.each('achievements/achievement') do |achievement_data|\n @achievements << GameAchievement.new(@steam_id64, @app_id, achievement_data)\n end\n\n @achievements_done = @achievements.reject{ |a| !a.unlocked? }.size\n end\n\n @achievements\n end",
"def achievements_percentage\n achievements_done.to_f / @achievements.size\n end",
"def achievements_count\n completed_count = Bet.where('owner = ? AND status = ?', params[:id], \"won\").to_a.count\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n won_count = completed_count\n # count all the bets that user accepted, and then the owner failed on\n invs.each do |i|\n won_count += 1 if i.bet.status == 'lost'\n end\n render json: {completed: completed_count, won: won_count}\n end",
"def achievements_percentage\n @achievements.size.to_f / @schema.achievements.size\n end",
"def size\n return @data_achievements.length\n end",
"def complete_achievements(options={})\n options.reverse_merge!(:count => 1)\n\n @objectives.push([\n Objective::CompleteAchievements,\n {:key => Objective::CompleteAchievements::KEY,\n :count => options[:count]}\n ])\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def guild_achievements\r\n BnetApi::make_request('/wow/data/guild/achievements')\r\n end",
"def count_ai_battler\n count = -1\n @battle_info.parties.each do |bank|\n count += bank.size\n end\n log_debug(\"Found #{count} AI\")\n return count\n end",
"def number_of_completed_responses\n if statistics && !statistics.empty? && (completed_data = statistics.find {|a| a[0] == 'Complete'})\n completed_data[1]\n else\n 0\n end\n end",
"def csca_update_achievements\r\r\n $csca.achievements.each do |achievement|\r\r\n next if achievement.earned\r\r\n next if achievement.progress.nil?\r\r\n if csca_get_progress_completion(achievement)\r\r\n achievement.earn_achievement\r\r\n $game_map.ach_earned = true\r\r\n $game_map.ach_display = achievement\r\r\n end\r\r\n end\r\r\n end",
"def read_achievements\n end",
"def character_achievements\r\n BnetApi::make_request('/wow/data/character/achievements')\r\n end",
"def calc_achievements\n\n #TODO: Use a list of achievements in db with conditions stored in db, iterate and award as necessary. \n if (self.games_won_as_pacman == 10)\n self.user.achievements << Achievement.create(:name => \"The Elusive Pacman\", :desc => \"Win 10 games as Pacman\");\n elsif (self.games_won_as_pacman == 100)\n self.user.achievements << Achievement.create(:name => \"Pacman Supreme\", :desc => \"Win 100 games as Pacman\");\n elsif (self.games_won_as_ghost == 10)\n self.user.achievements << Achievement.create(:name => \"Pacman Killer\", :desc => \"Win 10 games as a Ghost\");\n elsif (self.games_won_as_ghost == 100)\n self.user.achievements << Achievement.create(:name => \"Guardian of all the dots in the world\", :desc => \"Win 100 games as a Ghost\");\n elsif (self.total_ghosts_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"Om nom nom!\", :desc => \"Eat 50 ghosts.\");\n elsif (self.total_pacman_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"He never saw it coming.\", :desc => \"Eat 50 Pacman\");\n end \n end",
"def get_achievement(name)\n if initted?\n val = ' '\n ok = @@dll_SteamAPI_ISteamUserStats_GetAchievement.call(@i_user_stats, name, val) % 256 != 0\n ok ? val.unpack('C')[0] != 0 : nil\n else\n nil\n end\n end",
"def goals(player_id)\n Stat.where(player_id: player_id).sum(:goals)\n end",
"def games_played\n self.results.to_a.count\n end",
"def get_total_games_played\n return games.size\n end",
"def completed\n @completed ||= count('completed')\n end",
"def achievements\n @achievements ||= Achievement.where(subject_id: primary_key_value)\n end",
"def get_game_count(username)\n get_count(username, 'Played')\n end",
"def total_goals\n Score.joins(:player).where(players: { user_id: self.id }).count\n end",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def achievements( params={} )\n achievements = get_connections(\"achievements\", params)\n return map_connections achievements, :to => Facebook::Graph::Generic\n end",
"def get_total_games_played\n\t\treturn games.size\n\tend",
"def achievements_data\r\n BnetApi.make_request('/sc2/data/achievements')\r\n end",
"def total_completed(db_connection=nil)\n\t\t\t\t\tcompleted = Stats.completed(db_connection)\n\t\t\t\t\tcompleted.nil? ? 0 : completed\n\t\t\tend",
"def has_achievement?(name)\n achievements.exists?(name: name)\n 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 index\n @achievement = Achievement.get_public_achievements\n # instead of public_access we use get_public_achievements\n end",
"def appearances(player_id)\n appearances = 0\n Stat.where(player_id: player_id, appearance:true).each do |stat|\n if stat.match.status\n appearances += 1\n end\n end\n appearances\n end",
"def count_quiz_completions(quiz_results)\n no_quiz = quiz_results.count(0)\n total = quiz_results.count\n \"The number of participants who did not attempt Quiz 1\"\\\n \" is #{no_quiz} out of #{total} total participants.\"\nend",
"def get_achievement_and_unlock_time(name)\n if initted?\n achieved = ' '\n unlock_time = ' ' * 4\n ok = @@dll_SteamAPI_ISteamUserStats_GetAchievementAndUnlockTime.call(@i_user_stats, name, achieved, unlock_time) % 256 != 0\n ok ? [achieved.unpack('C')[0] != 0, Time.at(unlock_time.unpack('L')[0])] : nil\n else\n nil\n end\n end",
"def completed_user_count\n return @completed_user_count\n end",
"def get_character_achievements(name = @character_name, options = {})\n\t\t options = character_options(name, options)\n\t\t \n\t\t character_achievements = get_xml(@@character_achievements_url, options)\n\t\t \n\t\t return Wowr::Classes::CharacterAchievementsInfo.new(character_achievements, self)\n\t end",
"def played_count\n @ole.PlayedCount\n end",
"def achievement(name)\n achievements.find_by(name: name)\n end",
"def achievement_data(options = {})\n options = options.dup\n perform_with_objects(:get, '/wow/data/character/achievements', options, Armory::Achievement::Category, :achievements)\n end",
"def number_of_game_room_completed_missions(game_room)\n game_room_completed_missions(game_room).count\n end",
"def challenge_accepted_count\n self.challenges.where.not(status: \"pending\").order(updated_at: :desc).count\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 create\n @achievement = Achievement.new(achievement_params)\n @remaining_points = 2000\n current_game_owner.game.achievements.each do |achievement|\n @remaining_points = @remaining_points - achievement.points\n end\n\n respond_to do |format|\n if @achievement.points.nil?\n points = @remaining_points\n else\n points =@remaining_points - @achievement.points\n end\n\n if points > 0\n if @achievement.save\n format.html { redirect_to edit_game_path(current_game_owner.game), notice: 'Se ha guardado el logro correctamente.' }\n format.json { render :show, status: :created, location: @achievement }\n else\n format.html { render :new }\n format.json { render json: @achievement.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new, alert: \"No te quedan suficientes puntos disponibles.\" }\n format.json { render json: \"not enough points\", status: :unprocessable_entity }\n end\n\n\n end\n end",
"def goals_favor_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n count += match.goals_favor(self) if match.finished?\n end\n\n count\n end",
"def total_ounces\n data[:total_ounces]\n end",
"def num_players_missing\n num_players - game_players.count\n end",
"def goals_for()\n\t self.as_regular_contestants.select{|c| c.score}.collect{|c| c.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def remaining_points\n stories.not_completed.inject(0) do |accumulator, story|\n accumulator += story.points\n end\n end",
"def num_points_scored(playerName)\n player_stats(playerName)[:points]\nend",
"def progress\n total = asset.pieces.count\n downloaded = total - piece_downloads.incomplete.count\n [downloaded, total]\n end",
"def rankings\n self.total_against_goals = 0\n self.total_goals = 0\n if self.players != []\n self.players.each do |player|\n if player.scores.first != nil\n Game.all.each do |game|\n unless self.total_goals.nil? || self.total_against_goals.nil? || game.scores.last.goals.nil? || game.scores.first.goals.nil?\n if game.scores.first.player == player\n self.total_goals += game.scores.first.goals\n self.total_against_goals += game.scores.last.goals\n else\n self.total_goals += game.scores.last.goals\n self.total_against_goals += game.scores.first.goals\n end\n self.save\n end\n end\n end\n end\n end\n end",
"def life_count\n puts \"#{@player1.name}'s lives: #{@player1.lives}\\n#{@player2.name}'s lives: #{@player2.lives}\"\n end",
"def count\n\t\treturn UserAssoziation.where(:assoziation_id => self.id).count\n\tend",
"def score\n goals = self.match_events.select { |e| e.event_type == MatchEvent::EventType::GOAL }\n goals.reduce({away: 0, home: 0}) do |score, e|\n if e.event_author == MatchEvent::EventAuthor::HOME\n score[:home] += 1\n elsif e.event_author == MatchEvent::EventAuthor::AWAY\n score[:away] += 1\n end\n score\n end\n end",
"def num_points_scored(name)\n player_stats(name)[:points]\nend",
"def goals_against(club)\n if finished?\n if club == local\n return guest_goals\n end\n\n if club == guest\n return local_goals\n end\n end\n\n 0\n end",
"def set_achievement(name)\n if initted?\n ok = @@dll_SteamAPI_ISteamUserStats_SetAchievement.call(@i_user_stats, name) % 256 != 0\n @@dll_SteamAPI_ISteamUserStats_StoreStats.call(@i_user_stats) % 256 != 0 && ok\n else\n false\n end\n end",
"def assignation_count(options = {})\n assignations = options[:assignations]\n \n if assignations.present?\n return assignations.count\n end\n \n #puts \"START COUNTING!\"\n assignation_count = inorder_assignation_count(self) \n end",
"def getCount()\n\t\t#begin\n\t\t\tcounter = 0\n\t\t\[email protected] do |username|\n\t\t\t\tcounter = counter + TwitterClient.user(username).followers_count\n\t\t\tend\n\t\t\tcounter\n\t\t#rescue\n\t\t#\t-1\n\t\t#end\n\tend",
"def games_played\n games.size\n end",
"def games_played\n games.size\n end",
"def total_score\n @all_games.map do |games|\n games[\"home_goals\"].to_i + games[\"away_goals\"].to_i\n end\n end",
"def num_points_scored(player_name)\n return find_player_value(player_name, game_hash, :points)\nend",
"def omission_count\n @omissions.size\n end",
"def total_participation\n self.arguments.published.size + self.votes_count\n end",
"def count_item\n count = 0\n @g_net.each do |followers|\n count += 1 unless !followers or followers.empty?\n end\n count\n end",
"def flow_completion_count\n 0\n end",
"def flow_completion_count\n 0\n end",
"def how_many_active_announcements\n return announcements.where('expires_at >= ?', Date.today).count\n end",
"def num_successful_attacks\n return @successful_attacks\n end",
"def get_players_num\n\t\treturn @players.length\n\tend",
"def parse_items_available_and_total_count(response)\n available_count = 0\n total_count = 0\n item_status_codes = ['w', 'm', 'k', 'u']\n response['data'].each do |item|\n total_count += 1 unless (item['status']['code'].present? && item_status_codes.include?(item['status']['code']))\n available_count += 1 if (item['status']['code'].present? && item['status']['code'] == '-') && (!item['status']['duedate'].present?)\n end\n LogWrapper.log('INFO','message' => \"TeacherSet available_count: #{available_count}, total_count: #{total_count}\")\n return total_count, available_count\n end",
"def progress\n total_steps_count = self.steps.count\n\n if total_steps_count.zero?\n 0.0\n else\n approved_steps_count = self.steps.where(state: 'approved').count\n (approved_steps_count * 100.0 / total_steps_count).round(2)\n end\n end",
"def remaining_count\n raw_history['results_remaining']\n end",
"def clear_achievement(name)\n if initted?\n ok = @@dll_SteamAPI_ISteamUserStats_ClearAchievement.call(@i_user_stats, name) % 256 != 0\n @@dll_SteamAPI_ISteamUserStats_StoreStats.call(@i_user_stats) % 256 != 0 && ok\n else\n false\n end\n end",
"def incomplete_count\n incomplete.count\n end",
"def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end",
"def getCount()\r\n available = @emojiFiles.size()\r\n used = @usedEmojis.size()\r\n return available, used\r\n end",
"def move_count; @move_count ||= match.moves.count; end",
"def num_points_scored(player_name)\n player = player_by_name(player_name)\n player.values[0][:points]\n end",
"def amount_kills\n mutations.select(&:success?).length\n end",
"def get_num_players\n return prompt_positive_integer(\"Number of players? [1]\",1)\n end",
"def completion_stats\n \n stats = { :self => \"0.0\", :peer => \"0.0\" }\n total_checks = self.check_count\n \n if total_checks[:designer] > 0\n stats[:self] = self.designer_completed_checks * 100.0 / total_checks[:designer]\n end\n if total_checks[:peer] > 0\n stats[:peer] = self.auditor_completed_checks * 100.0 / total_checks[:peer]\n end\n\n stats\n \n end",
"def count\n Integer(parsed_body['meta']['total_results'])\n end",
"def total_count #:nodoc:\n total == 1 && [email protected]? && @group['matches'] > 1 ? @group['matches'] : total\n end",
"def responses_count\n @responses_count ||= self.responses.visible.count || 0\n end",
"def num_points_scored(name)\n players = get_all_players\n find_player(players, name)[:points]\nend",
"def parse_and_set_attempt_count(attempts)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunEditor_parse_and_set_attempt_count(@handle.ptr, attempts)\n result\n end",
"def count_incomplete\n return self.incomplete_tests.size\n end",
"def parse_counts\n return if @section_count || @question_count\n\n node = Nokogiri::XML(xml_with_answers)\n @section_count = node.css('section section').count\n if default_settings && default_settings[:per_sec]\n @question_count = @section_count * default_settings[:per_sec].to_i\n else\n @question_count = node.css('item').count\n end\n end",
"def total_complete\n tasks.select { |task| task.complete? }.count\n end",
"def follow_count\n Follow.unblocked.approved.for_follower(self).count\n end",
"def num_successful_attacks\n return @num_success_attacks\n end",
"def index\n @achievements ||= Achievement.all\n end",
"def number_of_commits\n GitHub::Errors.with_error_handling do\n result = @client.contributors_stats(full_name, retry_timeout: 2)\n return 0 unless result\n\n result.sum do |user|\n user[\"total\"]\n end\n end\n rescue GitHub::Error\n 0\n end",
"def complete_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.job_status = JobStatus::COMPLETED\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def followers_count\n follow_count_for_a(:follower)\n end",
"def load_data\n completes = load_save\n ACHIEVEMENTS.each do |index, content|\n title, passed, description = content\n completed = completes.include?(index)\n @data_achievements[index] = Achievement.new(title, description, completed)\n end\n end",
"def countPlayerPieces(owner)\n # well im pretty sure the design team is braindead.\n # I dont think i can write this without clarification of the nature of player\n # Maybe need new methods in player or does it really want me to call validateOwner\n # like 4 dozen times and then how do i get at their hand\n # Am i counting their hand or just the ones on the board\n \n end"
] |
[
"0.78981143",
"0.72493595",
"0.7097341",
"0.6803785",
"0.65524167",
"0.63763344",
"0.6237372",
"0.59215206",
"0.5874091",
"0.58633",
"0.5823148",
"0.5783102",
"0.56455743",
"0.5617858",
"0.5589296",
"0.54715437",
"0.5467653",
"0.5427132",
"0.54137695",
"0.53786796",
"0.535248",
"0.5334656",
"0.5309896",
"0.530841",
"0.52877057",
"0.5280253",
"0.52774715",
"0.5258917",
"0.5202974",
"0.5183729",
"0.51768744",
"0.5159164",
"0.51412827",
"0.5140125",
"0.5115279",
"0.5104626",
"0.5098673",
"0.5085291",
"0.5080753",
"0.50794506",
"0.5077078",
"0.5074744",
"0.50565493",
"0.50173736",
"0.50031537",
"0.49963266",
"0.49941626",
"0.4991131",
"0.49829",
"0.49792287",
"0.49455282",
"0.4943375",
"0.49354517",
"0.49019718",
"0.48920155",
"0.48827592",
"0.48824254",
"0.486156",
"0.4859189",
"0.48562142",
"0.48506632",
"0.48506632",
"0.4849237",
"0.4845279",
"0.48439628",
"0.48286256",
"0.48232815",
"0.4814526",
"0.4814526",
"0.48125464",
"0.48059186",
"0.47958115",
"0.4793409",
"0.47751862",
"0.47735173",
"0.47566095",
"0.47553527",
"0.47526574",
"0.47518858",
"0.4743261",
"0.47401416",
"0.4736403",
"0.47350726",
"0.47326156",
"0.47235134",
"0.47216132",
"0.4718664",
"0.47182885",
"0.4712067",
"0.47104388",
"0.47102556",
"0.47094762",
"0.47079566",
"0.46988946",
"0.4696548",
"0.46944204",
"0.4673383",
"0.4672058",
"0.46641597",
"0.46634433"
] |
0.69771576
|
3
|
Returns a float value representing the percentage of achievements done by this player. If achievements haven't been parsed yet, parsing is done now.
|
def achievements_percentage
achievements_done.to_f / @achievements.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def achievements_percentage\n @achievements.size.to_f / @schema.achievements.size\n end",
"def achievements_done\n achievements if @achievements_done.nil?\n @achievements_done\n end",
"def percent_complete\n (accepted_points.to_f / total_points * 100.0).round(1)\n end",
"def get_num_achievements\n if initted?\n @@dll_SteamAPI_ISteamUserStats_GetNumAchievements.call @i_user_stats\n else\n nil\n end\n end",
"def completion_percentage\n fields = %w(first_name last_name address postal_code city country birthday phone_number avatar.present? )\n sum_add = 100.0 / fields.count\n fields.inject(0) { |sum, field| sum + (field.split('.').inject(self) { |us, o| us.send(o) }.blank? ? 0 : sum_add) }.round.to_i\n end",
"def achievements_done\n @achievements.size\n end",
"def pick_percentage\n self.score.to_f / Matchup.amount_finished.to_f\n end",
"def achievements\n return unless public?\n\n if @achievements.nil?\n @achievements = Array.new\n @xml_data.elements.each('achievements/achievement') do |achievement_data|\n @achievements << GameAchievement.new(@steam_id64, @app_id, achievement_data)\n end\n\n @achievements_done = @achievements.reject{ |a| !a.unlocked? }.size\n end\n\n @achievements\n end",
"def pri_goal_percentage\n shots_on_goal > 0 ? goals.to_f / shots_on_goal : 1.0\n end",
"def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end",
"def complete_percent\n if learner\n # check if this is a reportable thing, if not then base the percent on the existance of the learner\n if offering_reportable?\n learner.report_learner.complete_percent || 0\n else\n # Offering is not reportable, but it has been started. Return 100%.\n 100\n end\n else\n 0\n end\n end",
"def percent_complete(user)\n\t\tcompletedWorth = 0.0\n\t\ttotalWorth = 0.0\n\t\t\n\t\tself.assignments.each do |assignment|\n\t\t\ttotalWorth += assignment.worth\n\t\t\t\n\t\t\tif assignment.user_grade(user)\n\t\t\t\tcompletedWorth += assignment.worth\n\t\t\tend\n\t\tend\n\t\t\n\t\tif totalWorth != 0\n\t\t\treturn completedWorth / totalWorth\n\t\tend\n\tend",
"def percent_complete\n self.completeness_score.to_f / self.class.max_completeness_score.to_f * 100\n end",
"def percent_complete\n self.completeness_score.to_f / self.class.max_completeness_score.to_f * 100\n end",
"def completed_percentage(feat)\n # Special case where there are no users\n return 0 if User.all.count == 0\n\n completed_num = CompletedFeat.find_all_by_feat_id(feat.id).count\n ((completed_num.to_f / User.all.count.to_f) * 100)\n end",
"def percent_complete\n @percent_complete ||= calculate_percent_complete\n end",
"def percent_correct\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0\n 0.0\n else\n # Calculate percentage, truncate value to one decimal place.\n ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)\n end\n end",
"def profile_completion\n percentage = 0\n percentage += 25 if self.full_name.present?\n percentage += 25 if self.has_avatar? and self.city\n percentage += 25 if self.subjects.any?\n percentage += 25 if self.favorites.any?\n percentage\n end",
"def percent_complete\n # return 0 if there is no tasks\n return 0 if tasks.none?\n ((total_complete.to_f / total_tasks) * 100).round\n end",
"def peer_percent_complete\n if !self.peer_check_count.blank?\n if self.auditor_completed_checks <= self.peer_check_count\n self.auditor_completed_checks * 100.0 / self.peer_check_count\n else\n 100.0\n end\n else\n 0\n end\n end",
"def remaining_percent\n (remaining_pints.to_f)/(124.to_f)\n end",
"def csca_update_achievements\r\r\n $csca.achievements.each do |achievement|\r\r\n next if achievement.earned\r\r\n next if achievement.progress.nil?\r\r\n if csca_get_progress_completion(achievement)\r\r\n achievement.earn_achievement\r\r\n $game_map.ach_earned = true\r\r\n $game_map.ach_display = achievement\r\r\n end\r\r\n end\r\r\n end",
"def percent_of_total\n # Prevents a error caused by attempting to round the value NaN\n poll.total_points == 0 ? 0 : (score.to_f/poll.total_points.to_f * 100).round\n end",
"def vote_percentage \n if self.filed? || self.finished? # Makes sure the threshold hasn't already been hit. \n return 100 # Return 100, meaning 100% goal. \n elsif self.pending? # PEtition is pending still \n petition_votes = self.votes_for.count\n petition_votes.to_f\n percentage = petition_votes / 500.00 # Finds percentage of the vote goal \n percentage *= 100 # Turns the float percentage into a whole number percentage.\n return percentage.round(1) \n else \n puts \"Something is wrong with this petition.\"\n end \n end",
"def average_percentage_passed_float\n return self.data[\"average_percent_passed\"].to_f\n end",
"def alive_percentage\n hp.to_f / hit_points\n end",
"def percentage\n 0.0\n end",
"def calc_achievements\n\n #TODO: Use a list of achievements in db with conditions stored in db, iterate and award as necessary. \n if (self.games_won_as_pacman == 10)\n self.user.achievements << Achievement.create(:name => \"The Elusive Pacman\", :desc => \"Win 10 games as Pacman\");\n elsif (self.games_won_as_pacman == 100)\n self.user.achievements << Achievement.create(:name => \"Pacman Supreme\", :desc => \"Win 100 games as Pacman\");\n elsif (self.games_won_as_ghost == 10)\n self.user.achievements << Achievement.create(:name => \"Pacman Killer\", :desc => \"Win 10 games as a Ghost\");\n elsif (self.games_won_as_ghost == 100)\n self.user.achievements << Achievement.create(:name => \"Guardian of all the dots in the world\", :desc => \"Win 100 games as a Ghost\");\n elsif (self.total_ghosts_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"Om nom nom!\", :desc => \"Eat 50 ghosts.\");\n elsif (self.total_pacman_eaten == 50)\n self.user.achievements << Achievement.create(:name => \"He never saw it coming.\", :desc => \"Eat 50 Pacman\");\n end \n end",
"def answered_percentage\n answered = num_answered_calls\n missed = num_missed_calls\n return 100.0 if (answered + missed) == 0\n (answered.to_f / (answered + missed) * 100).round(1)\n end",
"def percent_of_goal_raised\n ( ( 100.0 * self.funds_raised ) / self.fundraising_goal ).round\n end",
"def profile_completion_score\n attrs = [:name, :bio, :telephone]\n (attrs.reject { |attr| self.send(attr).blank? }.count.to_f / attrs.count) * 100\n end",
"def percentage_of_passives\n calculator.percentage_of_passives\n end",
"def get_percentage\n r = get_status[:percent]\n r.blank? ? nil : r.to_i\n end",
"def percentage_budget_complete\n if estimated_units == 0\n 0.0\n else\n (completed_units / estimated_units) * 100\n end\n end",
"def percentage_complete\n percent =\n if required_approver_count > 0\n (required_approved_count / required_approver_count) * 100\n else\n 0\n end\n \"#{percent}%\"\n end",
"def input_completed_percentage\n total_input_days = 0\n total_pending_input = 0\n self.users.each do |user|\n pending_input, input_days = user.pending_input\n total_pending_input += pending_input\n total_input_days += input_days\n end\n # If no users, then input is OK\n return 1 if total_input_days == 0\n ((total_input_days - total_pending_input) / total_input_days.to_f).round(2)\n end",
"def player_win_percentage\n (games_won/user_games)\n end",
"def progress\n total_steps_count = self.steps.count\n\n if total_steps_count.zero?\n 0.0\n else\n approved_steps_count = self.steps.where(state: 'approved').count\n (approved_steps_count * 100.0 / total_steps_count).round(2)\n end\n end",
"def percent_progress\n data[:percent_progress]\n end",
"def percent_progress\n data[:percent_progress]\n end",
"def percent_complete\n propinteger 'PERCENT-COMPLETE'\n end",
"def guild_achievements\r\n BnetApi::make_request('/wow/data/guild/achievements')\r\n end",
"def damaged_percentage\n 1 - alive_percentage\n end",
"def badge_percentage(user, badge) \n case badge \n when \"ownership\"\n score = user.ownership.score \n when \"persistence\"\n score = user.persistence.score \n when \"communication\"\n score = user.communication.score \n when \"gratitude\"\n score = user.gratitude.score \n else\n #Failsafe\n end\n level = user.badge_ding_threshold(badge)\n value = score.to_f / level.to_f\n percentage = value * 100\n return percentage.to_i\n end",
"def profile_completeness_percent\n Cache.get(['profile_c', self], nil, true){\n total = completed = 0.0\n self.profile_elements.each do |element, is_completed|\n total += 1.0\n completed += 1.0 if is_completed\n end\n (completed / total).round(2)\n }.to_f\n end",
"def get_achievement(name)\n if initted?\n val = ' '\n ok = @@dll_SteamAPI_ISteamUserStats_GetAchievement.call(@i_user_stats, name, val) % 256 != 0\n ok ? val.unpack('C')[0] != 0 : nil\n else\n nil\n end\n end",
"def calculate_profile_percentage\n fields = ['gender', 'seeking', 'min_age', 'max_age', 'address_zip', 'address_country',\n 'biography', 'occupation', 'education', 'ethnicity', 'religion', 'likes', 'search_radius',\n 'photos', 'birthday', 'address_state', 'address_city', 'distance_type', 'marital_status', 'outdoor_activities', 'health_fitness',\n 'children', 'drinking', 'eating', 'politics', 'reading', 'nightlife', 'travel', 'career'\n ]\n percent = (filled_in_fields(fields) / fields.size).round(2) * 100\n self.percent_complete = percent.to_i\n end",
"def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end",
"def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end",
"def user_percentage(user)\n\t\tworth \t\t= self.worth\n\t\tgrade \t\t= self.user_grade(user)\n\t\t\n\t\tif !grade.blank? && !worth.blank? && worth != 0\n\t\t\tpercent \t= (grade.to_f / worth.to_f) * 100\n\t\t\treturn percent\n\t\tend\n\tend",
"def self_percent_complete\n if !self.self_check_count.blank?\n if self.designer_completed_checks <= self.self_check_count\n self.designer_completed_checks * 100.0 / self.self_check_count\n else\n 100.0\n end\n else\n 0\n end\n end",
"def percent_complete\n xml = @client.get_request(\"/services/search/jobs/#{@sid}\")\n doc = Nokogiri::XML(xml)\n progress = doc.xpath(\"//s:key[@name='doneProgress']\").text\n return \"#{progress}/1.0\"\n end",
"def getPercentComplete\r\n\t\t\t\t\treturn @percentComplete\r\n\t\t\t\tend",
"def percentage; end",
"def progress(lesson)\n \"%0.2f%\" % (chapters_completed.where(lesson: lesson).count / lesson.chapters.count.to_f * 100)\n end",
"def next_percent_complete\n (self.completeness_score.to_f + self.failed_checks.first[:weighting]) / self.class.max_completeness_score.to_f * 100\n end",
"def score\n return self.progress - self.budget_ratio\n end",
"def power_play_goal_percentage(seasonasstring) # power_play info in game team stat\n #find list of all games in season given by arg\n #sum all power play goals\n #sum all power play oppertunities\n #divide line 146 and line 147\n #return total of above\n end",
"def percent\n self[:percentage] = (self[:current] <= self[:max] ? self[:current]/self[:max]*100 : self[:max])\n end",
"def match_percentage(other_username)\n other_user = User.includes(:answers).find_by(username: other_username)\n my_total = 0\n my_running_total = 0\n their_total = 0\n their_running_total = 0\n\n if other_user\n mutual_answers(other_user).each do |answer_pair|\n mine = answer_pair.first\n theirs = answer_pair.last\n\n my_total += mine.importance\n their_total += theirs.importance\n\n if ids_checker(mine.acceptable_ids, theirs.chosen_ids)\n my_running_total += mine.importance\n end\n\n if ids_checker(theirs.acceptable_ids, mine.chosen_ids)\n their_running_total += theirs.importance\n end\n end\n\n if my_total == 0 || their_total == 0\n return 0\n end\n\n my_ratio = my_running_total.to_f / my_total\n their_ratio = their_running_total.to_f / their_total\n\n Math.sqrt(my_ratio * their_ratio) * 100\n else\n nil\n end\n end",
"def proteinsPercent()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotalEnergy = 0.0\n\t\t\t\ttotalProteinsEnergy = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotalEnergy += (plato.value.get_energia * grams.value) / 100\n\t\t\t\t\ttotalProteinsEnergy += (plato.value.get_energia_proteins * grams.value) / 100\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn (totalProteinsEnergy * 100) / totalEnergy\n\t\t\tend",
"def info_progress_as_percentaje\n\t\tif self.resources\n\t\t\treal = resources_progress_as_percentage\n\t\t\texpected = resources_estimated_progress_as_percentage\n\t\telse\n\t\t\treal = progress_as_percentage\n\t\t\texpected = estimated_progress_as_percentage\n\t\tend\n\n\t\treturn [real, expected]\n\tend",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def quality_percentage\n require 'hpricot'\n doc = Hpricot(File.read(\"#{Continuous4r::WORK_DIR}/flog/index.html\"))\n doc.search('//h3') do |h3|\n if h3.inner_text.match(/^Project average score/)\n score = h3.inner_text.split(/Project average score : /)[1].to_f\n if score > 100.0\n percent = 0\n elsif score < 11.0\n percent = 100\n else\n percent = ((100.0 - score) * 100.0) / 89.0\n end\n return percent\n end\n end\n end",
"def progress_percentage\n progress = $redis.hgetall(redis_key)\n\n if progress.present?\n return 100 if progress['total_items'] == '0'\n (progress['processed_items'].to_f / progress['total_items'].to_f) * 100\n else\n 100\n end\n end",
"def percent_of_total\n VoteCount.total.blank? ? 0 : ((count.to_f / VoteCount.total)*100)\n end",
"def response_percentage\n return 0 unless self.response_count >= 1\n sprintf(\"%0.1f\", (self.response_count / self.poll.response_count.to_f) * 100.0)\n end",
"def percent_for\n (votes_for.to_f * 100 / (self.votes.size + 0.0001)).round\n end",
"def grade_percentage\n # get the number of passing tests as a float\n passing_tests = tests.select { |test| test.test_status == \"passed\" }.length.to_f\n # get total number of all that students tests\n all_tests = tests.length.to_f\n # calculate their passing_tests as a % of their total tests\n passing_tests / all_tests * 100\n end",
"def get_percentage(report)\n percent = (report[:position] / report[:length]) * 100\n percent.round\n end",
"def vote_percent\n Vote.percent(vote_cache)\n end",
"def overall_aroma_percentage\n overall_aroma = self.aroma_bundles.inject(0) do |memo, bundle|\n memo += bundle.percent if bundle.percent.is_a?(Integer) || bundle.percent.is_a?(BigDecimal)\n memo\n end\n\n return overall_aroma\n end",
"def character_achievements\r\n BnetApi::make_request('/wow/data/character/achievements')\r\n end",
"def read_achievements\n end",
"def pct()\n\t (self.wins()==0) ? 0 : self.wins().to_f/(self.wins()+self.losses()) \n\tend",
"def grade_percentage\n passed_tests = boating_tests.select { |tests| tests.test_status == \"Pass\" }\n (passed_tests.count.to_f / boating_tests.count.to_f) * 100\n end",
"def calculate_progress\n result = self.progress_status\n (100 * result.values.count(true) / result.values.compact.count).to_s\n end",
"def win_percent\n matchmade_games < 1 ? 0 : ((total_exp.to_f/matchmade_games.to_f) * 100).to_d\n end",
"def percent_wins(wins)\n ((wins.to_f / @num_games.to_f) * 100).round(4)\n end",
"def character_percent_complete(character)\n level_total=self.levels.select{|level| character.levels.include?(level) }\n (level_total.length/7.0*100).round\n end",
"def index\n @goals = current_user.goals\n \n @goals.each do |g|\n completed_milestone=0\n @milestones=g.milestones \n if(@milestones.count>0)\n @milestones.each do |m|\n if(m.completed)\n completed_milestone=completed_milestone+1\n end\n \n\n end\n g.percentage=(completed_milestone/@milestones.count)*100\n else\n g.percentage=0\n end\n \n end\n\n end",
"def progress_percentage\n total_amount = 0\n # proceed_amount = 0\n total_amount = card_sub_tasks.map(&:service_card_count).reduce(:+)\n # card_sub_tasks.each do |card_sub_task|\n # if card_sub_task.proceed == CardSubTask::PROCEED_FINISHED || card_sub_task.proceed == CardSubTask::PROCEED_ERROR\n # proceed_amount += card_sub_task.service_card_count\n # elsif card_sub_task.proceed == CardSubTask::PROCEED_PROCESSING\n # proceed_amount += card_sub_task.service_cards.count\n # end\n # end\n return percentagere = \"#{sprintf(\"%.1f\", proceed_amount.to_i / total_amount.to_f * 100)}%\"\n end",
"def percentage_of_votes\n if total_votes > 0\n 100 * (number_of_votes.to_f / total_votes.to_f)\n else\n 0\n end\n end",
"def percent_full\n return 0.0 if capacity.nil?\n return 0.0 if mentor_terms_count.nil?\n mentor_terms_count.to_f / capacity.to_f * 100\n end",
"def current_average\n earned = self.current_points\n possible = self.section.points_assigned\n \n (earned.to_f / possible)*100\n end",
"def stat_total\n (self.health + self.hunger + self.happiness) / 3\n end",
"def grade_percentage\n (self.passed_tests.length.to_f / self.tests.length * 100).round(2)\n end",
"def grade_percentage\n\t\t#1. Collect all of the tests a student has taken \n\t\t#2. Find the percentage of tests the student has passed.\n\t\t#3. Return the amount as a float.\n\t\tgrade_arr = BoatingTest.all.select do |test|\n\t\t\ttest.student == self\n\t\tend\n\t\t\n\t\tgrade_arr = grade_arr.collect do |test|\n\t\t\ttest.status\n\t\tend\n\t\t(grade_arr.count(\"passed\").to_f/grade_arr.count.to_f) * 100\n\tend",
"def to_percentage\n percentage = (object.popularity * 100).round(1)\n precision = if (object.popularity * 100).to_i == percentage\n 0\n else\n 1\n end\n number_to_percentage(percentage, precision: precision)\n end",
"def eligible_percent\n (eligible_jobs.to_f / available_jobs.to_f) * 100\n end",
"def grade_percentage\n tests = BoatingTest.all.select {|test| test.student.first_name == self.first_name}\n passed_tests = tests.select {|test| test.test_status == \"passed\"}\n per = (passed_tests.length.to_f / tests.length.to_f)*100\n \n end",
"def percentage_of_promoters\n calculator.percentage_of_promoters\n end",
"def percentage_abd\r\n\t\t\t\tall_survivors = Survivor.count()\r\n\t\t\t\tabd_survivors = Survivor.where(abducted: true).count\r\n\t\t\t\tpercentage = (abd_survivors.to_f/all_survivors.to_f) * 100\r\n\t\t\t\trender json: {status: 'SUCCESS', message:'Porcentagem de sobreviventes Abduzidos', percentage:percentage},status: :ok\r\n\t\t\tend",
"def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end",
"def badge_progress(user, badge)\n case badge\n when \"ownership\"\n score = \"#{user.ownership.score}\"\n when \"persistence\"\n score = \"#{user.persistence.score}\"\n when \"communication\"\n score = \"#{user.communication.score}\"\n when \"gratitude\"\n score = \"#{user.gratitude.score} \"\n else \n # Renders a failsafe\n end\n \"#{score} / #{user.badge_ding_threshold(badge)}\"\n end",
"def grade_percentage\n studentTests= BoatingTest.all.find_all{|test| test.student.first_name == self.first_name}\n totalTests= studentTests.length.to_f\n totalPassed= studentTests.find_all{|test| test.status == \"passed\"}\n numPassed= totalPassed.length.to_f\n percent= (numPassed/totalTests)*100\n end",
"def calculate_percentage_completion\n result = {}\n result[:pc] = ideal_completion[:pc]\n if %w(green amber).include?(status)\n result[:pve] = ideal_completion[:pve]\n # elsif status == \"red\"\n # result[:pve] = 20\n end\n result[:pdl] = ideal_completion[:pdl] if !documents.empty? || !personal_links.empty?\n return result\n end"
] |
[
"0.7739478",
"0.6711216",
"0.66586816",
"0.6573813",
"0.6461194",
"0.64467686",
"0.64325994",
"0.6381152",
"0.63409287",
"0.6304703",
"0.62893283",
"0.6215041",
"0.62057483",
"0.62057483",
"0.617332",
"0.616534",
"0.61529654",
"0.61512697",
"0.6124935",
"0.61173296",
"0.6105831",
"0.61013013",
"0.60932475",
"0.6088108",
"0.60701615",
"0.6059032",
"0.6050719",
"0.5979634",
"0.5963473",
"0.5957507",
"0.5955147",
"0.5924145",
"0.59210235",
"0.59157383",
"0.59136647",
"0.58899933",
"0.5881276",
"0.58810484",
"0.5874163",
"0.5874163",
"0.58740664",
"0.58688307",
"0.58366084",
"0.58224434",
"0.58062476",
"0.5793481",
"0.57614535",
"0.5758953",
"0.57419735",
"0.57419735",
"0.57410765",
"0.57410765",
"0.5737734",
"0.5732132",
"0.5716039",
"0.5698684",
"0.56963265",
"0.56898034",
"0.5676861",
"0.56714576",
"0.5661289",
"0.564684",
"0.56379086",
"0.5626453",
"0.5624992",
"0.56090623",
"0.56090206",
"0.56053776",
"0.5598048",
"0.5594973",
"0.55895",
"0.55838716",
"0.5583447",
"0.55827934",
"0.55688983",
"0.55683845",
"0.55678946",
"0.55661374",
"0.5565067",
"0.55494785",
"0.5535669",
"0.553302",
"0.55309236",
"0.5527689",
"0.5525221",
"0.55139655",
"0.5510635",
"0.551015",
"0.5507372",
"0.5506257",
"0.54945326",
"0.54828346",
"0.547519",
"0.54735017",
"0.54712224",
"0.54710054",
"0.5470925",
"0.5470795",
"0.5464277",
"0.5458079"
] |
0.8348275
|
0
|
Returns the base URL for this Steam Communtiy object
|
def base_url
if @custom_url.nil?
"http://steamcommunity.com/profiles/#{@steam_id64}/stats/#{@game_friendly_name}"
else
"http://steamcommunity.com/id/#{@custom_url}/stats/#{@game_friendly_name}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def base\n\t\t\t\tif @api\n\t\t\t\t\treturn @api.base_url\n\t\t\t\telse\n\t\t\t\t\treturn 'http://masterserver.hon.s2games.com/'\n\t\t\t\tend\n\t\t\tend",
"def base_url\n if @custom_url.nil?\n \"http://steamcommunity.com/gid/#{@group_id64}\"\n else\n \"http://steamcommunity.com/groups/#{@custom_url}\"\n end\n end",
"def base_url\n self.class.base_url\n end",
"def base_url\n \"#{scheme}://#{host}\"\n end",
"def base_url\n @client.instance_variable_get(:@base_url)\n end",
"def base_url\n return url\n end",
"def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end",
"def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end",
"def base_url\n @base_url||=@options['base_url']\n end",
"def base_url\n File.join(host, path)\n end",
"def base_url\n service.base_url\n end",
"def base_url\n base_href || url\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_uri\t\t\t\n\t\tURI.parse( \"http://\" + @factory.site_name + \".\" + @factory.api_host_base + @path )\n\tend",
"def base_url\n @base_url || ENV.fetch(\"BOOKINGSYNC_URL\", \"https://www.bookingsync.com\")\n end",
"def base_url\n @url.to_s.split('?').first\n end",
"def _base_url\n r = @_request\n scheme = r.scheme\n port = r.port\n \"#{scheme}://#{r.host}#{\":#{port}\" unless DEFAULT_PORTS[scheme] == port}\"\n end",
"def base_url\n if ENV['BASE_URL']\n ENV['BASE_URL']\n else\n 'https://beam.pro/'\n end\n end",
"def base_url\n Thread.current[\"GopDataTrust/Api/@base_url\"] || connect\n raise \"Must Connect To GOP Data Trust\" if Thread.current[\"GopDataTrust/Api/@base_url\"].nil?\n Thread.current[\"GopDataTrust/Api/@base_url\"]\n end",
"def url\n @url = \"#{@http_mode}://#{self.config.servers[0]}\"\n @url << \"/#{self.config.context}\" if(!self.config.context.empty?)\n #self.config.log.debug_msg(\"Request base URL: #{@url}\")\n @url\n end",
"def base_url\n context[:base_url] || \"/\"\n end",
"def base_url\n self.mode == 'production' ? Ebay::Search::Api::PRODUCTION_URL : Ebay::Search::Api::SANDBOX_URL\n end",
"def base_uri\n if mode == 'sandbox'\n @base_uri = 'https://sandbox.fundamerica.com/api/'\n else\n @base_uri = 'https://apps.fundamerica.com/api/'\n end\n end",
"def base_uri\n @base_uri\n end",
"def base_url\n \"http://#{@host}:#{@port}\"\n end",
"def base_url\n GlobalConstant::CompanyOtherProductUrls.kit_root_url\n end",
"def base_url\n self.class.base_url\n end",
"def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end",
"def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def http_url\n context[:http_url] || context[:base_url]\n end",
"def base_uri\n @base_uri ||= guess_base_uri\n end",
"def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def api_url\n base_url.concat api_query_parameter\n end",
"def full_url\n [ self.class.base, normalize_uri ].join('')\n end",
"def base_api_uri\n \"#{self.class.base_uri}/#{@account_id}\"\n end",
"def base_uri\n suite_configuration.core_uri\n end",
"def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end",
"def base_url\n @is_sub_env_specific ? \"#{GlobalConstant::CompanyApi.root_url}#{GlobalConstant::Environment.url_prefix}/api/\"\n : \"#{GlobalConstant::CompanyApi.root_url}api/\"\n end",
"def base_uri\n @options[:base_uri]\n end",
"def base_uri\n @options[:base_uri]\n end",
"def base_url_path; end",
"def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend",
"def url\n connection.build_url(url_chunk, params).to_s\n end",
"def base_url(info)\n main_url(info[:booking])\n end",
"def base_uri\n url = URI.parse( @config[\"portal_url\"] )\n if url.path === \"/\"\n return \"\"\n else\n return url.path\n end\n end",
"def baseurl; end",
"def base_uri\n attributes.fetch(:baseUri)\n end",
"def base_uri\n @base_uri = \"https://api.findface.pro/v0/\"\n end",
"def request_url\n base_url = \"http://#{api_host}#{PATH}?\"\n base_url << \"appid=#{app_id}\"\n base_url << \"&callname=#{call_name}\"\n base_url << \"&siteid=#{site_id}\"\n base_url << \"&version=#{API_VERSION}\"\n base_url\n end",
"def base_url\n \"http://sms.yunpian.com/#{SmartSMS.config.api_version}/\"\n end",
"def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end",
"def base_url\n ENV.fetch(\"FREEFEED_BASE_URL\")\n end",
"def ui_base_url\n request.env[\"pactbroker.base_url\"] || \"\"\n end",
"def getBaseURL\r\n\t\t \t\t\treturn @@baseURL+\"portal/\"+String(portalId)+\"/\";\r\n\t\t \t\tend",
"def raplet_base_url\n \"#{request.scheme}://#{request.host}:#{request.port}\"\n end",
"def url\n @client.url + self.class.path + @sport.to_s\n end",
"def base_url\n \"https://api.beezup.com/\"\n end",
"def get_base_uri(server = Server::DEFAULT)\r\n parameters = {\r\n 'base_url' => { 'value' => base_url, 'encode' => false }\r\n }\r\n APIHelper.append_url_with_template_parameters(\r\n ENVIRONMENTS[environment][server], parameters\r\n )\r\n end",
"def base_url\n # Using the X-Forwarded headers in the UI can leave the app vulnerable\n # https://www.acunetix.com/blog/articles/automated-detection-of-host-header-attacks/\n # Either use the explicitly configured base url or an empty string,\n # rather than request.base_url, which uses the X-Forwarded headers.\n env[\"pactbroker.base_url\"] || \"\"\n end",
"def base_uri\n \"#{self.class.base_uri}/#{name}\"\n end",
"def base_url\n ENV['HERMES_API_URL'] || 'https://hermes.mythcoders.net/api'\n end",
"def base_url\n GlobalConstant::Base.cms[:url] + \"api/preview/\"\n end",
"def api_url\n ensure_full_data!\n @gapi[\"selfLink\"]\n end",
"def url\n url = \"#{config.url[config.env]}/#{@path}\"\n url = \"#{url}?#{@params.to_param}\" unless @params.empty?\n url\n end",
"def base_url(operation = nil)\n index = server_operation_index.fetch(operation, server_index)\n return \"#{scheme}://#{[host, base_path].join('/').gsub(/\\/+/, '/')}\".sub(/\\/+\\z/, '') if index == nil\n\n server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])\n end",
"def base_url\n GlobalConstant::Base.aml_config[:search][:base_url]\n end",
"def url\n return @url if @url\n\n case environment\n when :production\n PRODUCTION_API_ENDPOINT\n when :sandbox\n SANDBOX_API_ENDPOINT\n end\n end",
"def api_url\n api_key? ? base_url.concat(api_query_parameter) : base_url\n end",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def api_base_url\n \"https://#{platform}.api.riotgames.com\"\n end",
"def account_site_assets_base_url\n Account.current.url_base + account_site_assets_base(true)\n end",
"def api_url\n @api_url ||= URI.parse(\"#{super}?#{URI.encode_www_form(query_params)}\")\n end",
"def server_url\n @uri\n end",
"def url\n return @@nfg_urls['sandbox']['url'] if @use_sandbox\n @@nfg_urls['production']['url']\n end",
"def url\n [ Configuration.url, @path ].join\n end",
"def url\n @url || File.join(host, \"v1\")\n end",
"def base_url(operation = nil)\n index = server_operation_index.fetch(operation.to_sym, server_index)\n return \"#{scheme}://#{[host, base_path].join('/').gsub(/\\/+/, '/')}\".sub(/\\/+\\z/, '') if index == nil\n\n server_url(index, server_operation_variables.fetch(operation.to_sym, server_variables), operation_server_settings[operation.to_sym])\n end",
"def base_url\n case mode&.to_sym\n when :production\n ::Deepblue::DoiMintingService.production_base_url\n when :testing\n ::Deepblue::DoiMintingService.test_base_url\n when :test\n ::Deepblue::DoiMintingService.test_base_url\n else\n raise Error.new\"Unrecognized mode #{mode}\"\n end\n # mode&.to_sym == :production ? ::Deepblue::DoiMintingService.production_base_url\n # : ::Deepblue::DoiMintingService.test_base_url\n end",
"def url\n Config.site.url.chomp('/') + self.path\n end",
"def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end",
"def base_url(locale = @locale, options = {})\n\t\t\tstr = \"\"\n\t\t\t\n\t\t\tif (options[:secure] == true)\n\t\t\t\tstr += 'https://'\n\t\t\telse\n\t\t\t\tstr += 'http://'\n\t\t\tend\n\t\t\t\n\t\t\tif (locale == 'us')\n\t\t\t\tstr += 'www.'\n\t\t\telse\n\t\t\t\tstr += locale + \".\"\n\t\t\tend\n\t\t\t\n\t\t\tif (options[:login] == true)\n\t\t\t str += @@login_base_url\n\t\t\telse\n\t\t\t\tstr += @@armory_base_url\n\t\t\tend\n\t\t\t\n\t\t\treturn str\n\t\tend",
"def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end",
"def base_url(locale = @locale, options = {})\n\t\t\tstr = \"\"\n\t\t\t\n\t\t\tif (options[:secure] == true)\n\t\t\t\tstr += 'https://'\n\t\t\telse\n\t\t\t\tstr += 'http://'\n\t\t\tend\n\t\t\t\n\t\t\tif (locale == 'us')\n\t\t\t\tstr += 'www.' + @@armory_url_base\n\t\t\telse\n\t\t\t\tstr += locale + '.' + @@armory_url_base\n\t\t\tend\n\t\t\t\n\t\t\treturn str\n\t\tend",
"def api_url\n @api_url ||=\"#{base_url}#{@options['api_url']}\"\n end",
"def url\n sprintf(\"%s/%s\",\n ::Configuration.instance.handles[:base_url],\n self.handle)\n end",
"def asset_base_uri\n \"/#{File.basename(Engines.public_dir)}/#{name}\"\n end",
"def base_url\n current_base_href = base_href.to_s.strip.empty? ? nil : URL.absolutify(base_href, URL.new(url).root_url)\n current_base_href || url\n end",
"def base_url(arg = nil)\n # TODO: Better URL validation\n set_or_return(:base_url, arg, kind_of: String, default: DEFAULT_BASE_URL)\n end",
"def api_base_url(environment)\n GlobalConstant::KycApiBaseDomain.get_base_domain_url_for_environment(environment)\n end",
"def api_url\n @@API_URL\n end",
"def url\n @url || API_ENDPOINT\n end",
"def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end",
"def base_path\n if debug\n \"/#{debug_prefix}/\"\n else\n \"/#{digest_prefix}/\"\n end\n end",
"def base_uri\n \"#{api}/provider\"\n end"
] |
[
"0.7727005",
"0.766897",
"0.7629012",
"0.76214135",
"0.76059353",
"0.7595587",
"0.75783515",
"0.75397927",
"0.74995184",
"0.74571794",
"0.7441903",
"0.744091",
"0.7427219",
"0.7427219",
"0.7414",
"0.7377704",
"0.7376052",
"0.736486",
"0.73597",
"0.73528",
"0.73272604",
"0.7295781",
"0.7243985",
"0.7231913",
"0.7222494",
"0.71574014",
"0.71103466",
"0.70931846",
"0.7092623",
"0.7073223",
"0.7054359",
"0.70220023",
"0.70111305",
"0.7007543",
"0.7007543",
"0.69966155",
"0.6982023",
"0.6970007",
"0.6967698",
"0.69478756",
"0.69394886",
"0.69394886",
"0.69316864",
"0.69277644",
"0.6920886",
"0.69124794",
"0.68940157",
"0.68875736",
"0.68769807",
"0.6847063",
"0.68461776",
"0.6831894",
"0.68303776",
"0.68293667",
"0.6828028",
"0.68040997",
"0.67614526",
"0.6758536",
"0.6752138",
"0.67519313",
"0.67383724",
"0.6737716",
"0.67151815",
"0.6709609",
"0.66989255",
"0.66879374",
"0.66869897",
"0.6684935",
"0.6683903",
"0.66781646",
"0.6670448",
"0.6670448",
"0.6670448",
"0.6670448",
"0.6670448",
"0.66375357",
"0.6628857",
"0.6623001",
"0.6620331",
"0.66159666",
"0.65935254",
"0.6593138",
"0.6589942",
"0.65862256",
"0.65723324",
"0.65689886",
"0.6566473",
"0.65650105",
"0.65627056",
"0.65584433",
"0.6552054",
"0.654857",
"0.65469843",
"0.6544296",
"0.6543534",
"0.653297",
"0.6529668",
"0.65292525",
"0.652352",
"0.6517764"
] |
0.7772089
|
0
|
A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four). If red tiles are chosen there are exactly seven ways this can be done. If green tiles are chosen there are three ways. And if blue tiles are chosen there are two ways. (See problem_0116.png.) Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of re placing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used? NOTE: This is related to Problem 117.
|
def fill( len, row, memo )
return memo[row] if memo[row]
total = 0
if len <= row
total += row - len + 1
(row - len).downto( len ) do |sub|
total += fill( len, sub, memo )
end
end
memo[row] = total
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tile_number_generator(board)\n count_hash = {\n 0 => 0,\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n 6 => 0,\n 7 => 0,\n 8 => 0,\n 9 => 1\n }\n \n y_pos = 1\n self.height.times do\n x_pos = 0\n \n column1 = count_hash[board[y_pos-1][x_pos-1]] + count_hash[board[y_pos][x_pos-1]] + count_hash[board[y_pos+1][x_pos-1]]\n column2 = count_hash[board[y_pos-1][x_pos]] + count_hash[board[y_pos][x_pos]] + count_hash[board[y_pos+1][x_pos]]\n column3 = count_hash[board[y_pos-1][x_pos+1]] + count_hash[board[y_pos][x_pos+1]] + count_hash[board[y_pos+1][x_pos+1]]\n \n self.width.times do\n x_pos += 1\n \n column1 = column2\n column2 = column3\n column3 = count_hash[board[y_pos-1][x_pos+1]] + count_hash[board[y_pos][x_pos+1]] + count_hash[board[y_pos+1][x_pos+1]]\n if board[y_pos][x_pos] != 9\n board[y_pos][x_pos] = column1 + column2 + column3\n end\n end\n y_pos += 1\n end\n \n return board\n end",
"def count_black_tiles_around(in_tiles, tile_x, tile_y)\n black_tile_count = 0\n MOVE.each do |dir, deltas|\n other_tile_x = tile_x + deltas[0]\n other_tile_y = tile_y + deltas[1]\n hash_key = \"#{other_tile_x}_#{other_tile_y}\"\n black_tile_count += 1 if (in_tiles[hash_key] % 2 == 1)\n end\n black_tile_count\nend",
"def chess_board(board)\n pieza = [ \"T-\", \"H-\", \"B-\", \"Q-\", \"K-\", \"B-\", \"H-\", \"T-\" ]\n color = [\"W\", \"B\"]\n peon = [\"P-\", \"P-\", \"P-\", \"P-\", \"P-\", \"P-\", \"P-\", \"P-\"]\n \n\n for i in 0..7\n for j in 0..7 \n if i == 0 \n (board[i][j] = pieza[j] + color[0])\n elsif i == 1 \n board[i][j] = peon[j] + color[0] \n elsif i == 6 \n board[i][j] = peon[j] + color[1] \n elsif i == 7 \n board[i][j] = pieza[j] + color[1] \n elsif i == 2..5 \n board[i][j] = \" * \" \n end \n end \n end\n board.each do |x|\n puts \"#{x}\"\n end \nend",
"def test_first_legal_moves_red\n\t\tred_columns=%w[2 4 6 8]\n\t\tfor i in 0...4\n\t\t\tmygame=CheckersGame.new\n\t\t\tmygame.move('c3','d4')\n\t\t\t#Game now looks like:\n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#h | | r | | r | | r | | r | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#g | r | | r | | r | | r | | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#f | | r | | r | | r | | r | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#e | . | | . | | . | | . | | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#d | | . | | b | | . | | . | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#c | b | | . | | b | | b | | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#b | | b | | b | | b | | b | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t#a | b | | b | | b | | b | | \n\t\t\t# +---+---+---+---+---+---+---+---+\n\t\t\t# 1 2 3 4 5 6 7 8 \n\n\t\t\t\n\t\t\tassert_equal(\\\n\t\t\t\tCheckersGame.new.move('c3','d4').remove('f',red_columns[i]).\\\n\t\t\t\tplace('e',String(Integer(red_columns[i])-1),\\\n\t\t\t\tCheckersGame::Square::RED,false).toggle_turn,\\\n\t\t\t\tmygame.move('f'+red_columns[i],'e'+String(Integer(red_columns[i])-1)))\n\t\tend\n\tend",
"def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end",
"def process(num_blacks, num_whites) \r\n if (!@zero_response_code_found)\r\n # we can only get blacks during this phase of all 4's same color however we will count them later during mask phase\r\n # keep track of number of exact matches\r\n if num_blacks > 0\r\n # save for later processing when we go to half/half mode\r\n @safe_array << @current_color\r\n #puts \"color_count[#{@current_color}] = #{@color_count[@current_color]}\"\r\n #puts \"AA\"\r\n else\r\n @zero_response_code_found = true\r\n @half_half_color = @current_color\r\n #puts \"BB\"\r\n end # if num_blacks\r\n else\r\n if @num_correct_colors_found < 4\r\n #puts \"SEARCHING FOR FINAL 4\"\r\n if @three_of_a_kind_check\r\n# need to worry about 3 and 4 of a kind scenario\r\n# during find zero-response phase - if we encounter 3 or 4 of a kind, we need to set a flag, perhaps my hash is doing that\r\n# or modify the hash.\r\n# but then the problem comes about after finding the zero-response, during the finding the half-half phase. during this\r\n# phase it is not possible to determine if there are 3 or 4 of a kind due to the arrangemnet of the pattern.\r\n# one way to solve this for both zero-response phase and half-half phase is by having another 3 of a kind safe array\r\n# if during zero-response phase, we encounter 4 of a kind. game will auto end?\r\n# if during zero-response phase, we encounter 3 of a kind, then submit color into three_of_a_kind array and into safe_array\r\n# to be used later by guess method. guess will normally count the 2 on the right side, but not count the left. the \r\n# three_of_a_kind array and the half_half_left mode will count the 1 remaining color of a three of a kind\r\n# if during half-half phase, we encounter 2 of a kind(specifically, 2 blacks, or 1 black/1 white, but not 2 whites, process\r\n# will normally count the 2 colors. However there is a chance that there is a 3rd occurrence of the color that we can not see\r\n# due to the half-half-right pattern. Therefore we need to add the color to the three_of_a_kind array which causes guess to\r\n# change the pattern to\r\n# [color, color, no-response-color, no-response-color]\r\n\r\n# process needs to compensate for double counting whites (only count blacks) during 3_of_a_kind_check and for double\r\n# counting doubles. (only count blacks when blacks+whites=3, whites have already been counted, and when blacks+whites==2,\r\n# this scenario has already been counted)\r\n\r\n# I need to save the state of the initial three_of_a_kind compare in order to determine how to count the three of a kind\r\n# correctly.\r\n #puts \"THREE OF A KIND CHECK IN PROCESS method\"\r\n previous_num_blacks, previous_num_whites = @half_half_result[@current_color]\r\n if previous_num_blacks == 2\r\n #puts \"PREVIOUS_NUM_BLACKS == 2\"\r\n @num_correct_colors_found += num_blacks\r\n num_blacks.times { @match_left << @current_color }\r\n elsif previous_num_blacks == 1 && previous_num_whites == 1\r\n # for this case we need to make sure we don't double count\r\n #puts \"PREV BLACKS==1 && PREV WHITES==1\"\r\n if num_blacks == 2\r\n @num_correct_colors_found += 1\r\n @match_left << @current_color\r\n end\r\n end\r\n #puts \"Num of blacks = #{num_blacks} Previous num blacks = #{previous_num_blacks}\"\r\n #puts \"Num of whites = #{num_whites} Previous num whites = #{previous_num_whites}\"\r\n # always get out of three of a kind mode\r\n @three_of_a_kind_check = false\r\n\r\n else # if @three_of_a_kind_check\r\n # add to running total of found numbers so we can get to next phase of algo\r\n @num_correct_colors_found += (num_blacks + num_whites) ##### THIS WILL NEED TO CHANGE WHEN THREE OF A KIND LOGIC ADDED\r\n\r\n # following section is used in half-half section either by processing\r\n # new colors or by processing old colors from the safe array\r\n # if found blacks we found it on the right and update color_count for current_color\r\n # officially counting blacks and whites are only done while in half-half mode\r\n # note that safe_array take dequeue priority when it is not empty. see guess above\r\n if num_blacks > 0\r\n num_blacks.times { @match_right << @current_color } \r\n end\r\n # if found whites we found it on the left and update color_count for current_color \r\n if num_whites > 0\r\n num_whites.times { @match_left << @current_color } \r\n end \r\n # this info is necessary when doing the reverse half_half compare to see if there are three/four of a kind\r\n @half_half_result[@current_color] = [num_blacks, num_whites]\r\n # during this phase we can't know if there are 2 or 3 of the current color, so we need to do a reverse_half_half\r\n # check if there are 2 blacks or (1 black + 1 white)\r\n @three_of_a_kind_check_array << @current_color if (num_blacks == 2 || (num_blacks==1 && num_whites==1))\r\n #puts \"CC\"\r\n end # if @three_of_a_kind_mode else\r\n else\r\n # Scenarios are as follows for final code\r\n # L1,L2,R1,R2 \r\n # (4W) -> L2,L1,R2,R1\r\n # (2W2B) -> L1,L2,R2,R1 or L2,L1,R1,R2\r\n # (0W) -> pattern found\r\n #puts \"DD\"\r\n @final_four_whites = num_whites # used by guess\r\n\r\n end\r\n\r\n end # if !@zero_response...\r\n\r\n end",
"def checker_board(size)\n # We can change \"X\" to \"||\" and \" \" to \" \" and it'll output a square shape\n pattern_1 = \"||\"\n pattern_2 = \" \"\n new_pattern_1 = \"\"\n new_pattern_2 = \"\"\n\n numbers = (1..size).to_a.reverse\n numbers.each do |number|\n if number.even?\n new_pattern_1 << pattern_1\n new_pattern_2 << pattern_2\n elsif number.odd?\n new_pattern_1 << pattern_2\n new_pattern_2 << pattern_1\n end # I don't know if this is bad practice, having one subfuction end and another one start right after\n end\n numbers.each do |number|\n if number.even?\n puts new_pattern_1\n else # We can use else, since there's only two conditons\n puts new_pattern_2\n end\n end\nend",
"def generate_solution\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n until ary.count(0).zero?\n ary.each_with_index do |num, ind|\n row = calculate_area(ind + 1, :row)\n col = calculate_area(ind + 1, :col)\n box = calculate_area(ind + 1, :box)\n row_neighbours = tile_range.to_a.select {|n| calculate_area(n, :row).eql? row}\n col_neighbours = tile_range.to_a.select {|n| calculate_area(n, :col).eql? col}\n box_neighbours = tile_range.to_a.select {|n| calculate_area(n, :box).eql? box}\n neighbours = (row_neighbours + col_neighbours + box_neighbours).uniq!.map {|n| n -= 1}\n neighbouring_values = []\n neighbours.each {|n| neighbouring_values << ary[n]}\n options = (0..area_size).to_a.reject! {|x| neighbouring_values.compact.include?(x)}\n if options == []\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n break\n end\n ary[ind] = options.sample\n end\n end\n return ary.join\n end",
"def get_surrounding_tiles(row, column, cell)\n surrounding_tiles = []\n index = GAME_BOARD[column-1].index(cell)\n if column == 1 \n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n end\n elsif column == 12\n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n elsif index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n\n surrounding_tiles\n end",
"def solve( n = 2_000 )\n # We can classify every tile according to its angular position around the\n # unit circle, setting position 0 at the top since that's where each row\n # starts in the problem statement. Positions 1-5 then follow every 60° as\n # we work our way counter-clockwise. Depending on which of these positions\n # each tile falls (or between which pair of positions), we use different\n # formulae to calculate its six neighbors to the N, NW, SW, S, SE, and NE:\n # \n # Pos 0: n even = fhp\n # N = n + ring (g) S = n - ring + 6 (a)\n # NW = n + ring + 1 (h) SE = n + ring - 1 (f)\n # SW = n + 1 NE = n + (2*ring + 5) (p)\n #\n # Pos 0-1: n even = bh, n odd = ag \n # N = n + ring (g) S = n - ring + 6 (a)\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + 1 NE = n - 1\n #\n # Pos 1: n even = bh, n odd = gi\n # N = n + ring (g) S = n + 1\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + ring + 2 (i) NE = n - 1\n #\n # Pos 1-2: n even = bh, n odd = ci\n # N = n - 1 S = n + 1\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 2: n even = hj\n # N = n - 1 S = n + ring + 3 (j)\n # NW = n + ring + 1 (h) SE = n + 1\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 2-3: n even = dj, n odd = ci\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - 1 SE = n + 1\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 3: n even = dj, n odd = ik\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - 1 SE = n + ring + 4 (k)\n # SW = n + ring + 2 (i) NE = n + 1\n #\n # Pos 3-4: n even = dj, n odd = ek\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - 1 NE = n + 1\n #\n # Pos 4: n even = jl\n # N = n + 1 S = n + ring + 3 (j)\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - 1 NE = n + ring + 5 (l)\n #\n # Pos 4-5: n even = fl, n odd = ek\n # N = n + 1 S = n - 1\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5: n even = fl, n odd = km\n # N = n + ring + 6 (m) S = n - 1\n # NW = n + 1 SE = n + ring + 4 (k)\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5-0, except last: n even = fl, n odd = gm\n # N = n + ring + 6 (m) S = n - ring (g)\n # NW = n + 1 SE = n - 1\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5-0, only last: n even = flo, n odd = gmo\n # N = n + ring + 6 (m) S = n - ring (g)\n # NW = n - ring + 1 (f) SE = n - 1\n # SW = n - (2*ring - 7) (o) NE = n + ring + 5 (l)\n #\n # From these formula, we can derive the difference between a tile and each\n # of its neighbors. If we arrange all potential differences in ascending\n # order, it becomes obvious that for n even or odd, some deltas will al-\n # ways be even, and thus can never be prime (>2).\n #\n # Furthermore, we can see that only in certain positions will a tile ever\n # differ from three neighbors by odd amounts (position 0 and just to the\n # right of position 0). In all other cases, at most two deltas will be\n # odd, meaning PD(n) will be 2 or less.\n #\n # n even n odd\n # a = ring - 6 even a\n # b = ring - 5 b even\n # c = ring - 4 even c\n # d = ring - 3 d even\n # e = ring - 2 even e\n # f = ring - 1 f even\n # g = ring even g\n # h = ring + 1 h even\n # i = ring + 2 even i\n # j = ring + 3 j even\n # k = ring + 4 even k\n # l = ring + 5 l even\n # m = ring + 6 even m\n # o = 2ring - 7 o o\n # p = 2ring + 5 p p\n pd3 = [1, 2]\n base, ring = 8, 12\n \n while pd3.size < n\n # Only at position 0 and one tile to the right will there ever be three\n # odd deltas, so those are the only ones we have to check for primality.\n # Both share a delta of f = ring - 1.\n if (ring - 1).prime?\n # Check the other odd deltas for position 0. \n pd3 << base if (ring + 1).prime? && (2*ring + 5).prime?\n\n # Check the other odd deltas for one tile to the right of position 0.\n pd3 << base + ring - 1 if (ring + 5).prime? && (2*ring - 7).prime?\n end\n\n # Advance the first tile of the current ring (base), and the number of\n # tiles it contains (ring). \n base += ring\n ring += 6\n end\n\n pd3[-1]\n end",
"def choose_color(row, column, cell, selected_hotel, player)\n tile = self.game_tiles.where(cell: cell).first\n placed_tiles = []\n self.game_tiles.where(placed: true).each do |game_tile|\n placed_tiles << game_tile.tile.column.to_s + game_tile.tile.row\n end\n sur_tiles = get_surrounding_tiles(row, column, cell)\n placed_sur_tiles = get_placed_surrounding_tiles(sur_tiles, placed_tiles)\n merger = false\n merger_three = false\n if placed_sur_tiles.length == 0 # no surrounding tiles\n # placed tile is an orphan tile\n color = \"grey\"\n elsif placed_sur_tiles.length == 1 # 1 surrounding tile\n if placed_sur_tiles[0].hotel == 'none' # surrounding tile is an orphan\n if selected_hotel == 'none'\n # need input from user for new chain\n raise 'Ambiguous color'\n else\n # new chain\n other_tiles = convert_tile_to_number({'row' => placed_sur_tiles[0].tile.row, 'column' => placed_sur_tiles[0].tile.column})\n color = HOTEL_COLORS[selected_hotel]\n # Update Game log\n msg = player.username + ' founded ' + selected_hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n #save game hotel chain size\n chosen_game_hotel = self.game_hotels.where(name: selected_hotel).first\n chosen_game_hotel.chain_size = 2\n chosen_game_hotel.save\n chosen_game_hotel.update_share_price\n #update other tile hotel\n placed_sur_tiles[0].hotel = selected_hotel\n placed_sur_tiles[0].save\n #save placed tile hotel\n tile.hotel = selected_hotel\n tile.save\n end\n else\n # extending chain\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n #save game hotel chain size\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 1\n hotel_chain.save\n hotel_chain.update_share_price\n #save placed tile hotel\n tile.hotel = hotel\n tile.save\n end\n elsif placed_sur_tiles.length == 2 # 2 surrounding tiles\n if (placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel == 'none') # both surrounding tiles are orphan\n #new chain with chain size 3\n if selected_hotel == 'none'\n # need input from user for new chain\n raise 'Ambiguous color'\n else\n # new chain\n color = HOTEL_COLORS[selected_hotel]\n orphan_tiles_info = [[placed_sur_tiles[0].tile.row, placed_sur_tiles[0].tile.column, 'grey'], [placed_sur_tiles[1].tile.row, placed_sur_tiles[1].tile.column, 'grey']]\n other_tiles = convert_tiles_to_numbers(orphan_tiles_info)\n # Update Game log\n msg = player.username + ' founded ' + selected_hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n #save game hotel chain size\n chosen_game_hotel = self.game_hotels.where(name: selected_hotel).first\n chosen_game_hotel.chain_size = 3\n chosen_game_hotel.save\n chosen_game_hotel.update_share_price\n #save other tiles hotels\n placed_sur_tiles[0].hotel = selected_hotel\n placed_sur_tiles[1].hotel = selected_hotel\n placed_sur_tiles[0].save\n placed_sur_tiles[1].save\n #save placed tile hotel\n tile.hotel = selected_hotel\n tile.save\n end\n elsif (placed_sur_tiles[0].hotel != 'none') && (placed_sur_tiles[1].hotel != 'none') # both surrounding tiles are part of a chain\n if (placed_sur_tiles[0].hotel == placed_sur_tiles[1].hotel) # both surrounding tiles are part of the same chain\n # extension of chain by 1\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 1\n hotel_chain.save\n hotel_chain.update_share_price\n tile.hotel = hotel\n tile.save\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n else\n #merger of 2 chains\n response = execute_merger(placed_sur_tiles, false, tile)\n other_tiles = convert_tiles_to_numbers(response[1])\n color = response[0]\n dominant_hotel = response[2]\n acquired_hotel = response[3]\n acquired_hotel_size = response[4]\n # Update Game log\n msg = player.username + ' caused a merger. ' + dominant_hotel.name + ' acquired ' + acquired_hotel.name + '.'\n LogEntry.create(message: msg, game_id: self.id)\n merger_stock(dominant_hotel, acquired_hotel, acquired_hotel_size)\n merger = true\n end\n elsif ((placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel != 'none')) || ((placed_sur_tiles[0].hotel != 'none') && (placed_sur_tiles[1].hotel == 'none'))\n # one surrounding tile is part of hotel chain and the other is an orphan\n # extend chain by 2\n if placed_sur_tiles[0].hotel != 'none'\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 2\n hotel_chain.save\n hotel_chain.update_share_price\n placed_sur_tiles[1].hotel = hotel\n placed_sur_tiles[1].save\n other_tiles = convert_tile_to_number({'row' => placed_sur_tiles[1].tile.row, 'column' => placed_sur_tiles[1].tile.column, 'current_color' => 'grey'})\n tile.hotel = hotel\n tile.save\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n elsif placed_sur_tiles[1].hotel != 'none'\n hotel = placed_sur_tiles[1].hotel\n color = HOTEL_COLORS[hotel]\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 2\n hotel_chain.save\n hotel_chain.update_share_price\n placed_sur_tiles[0].hotel = hotel\n placed_sur_tiles[0].save\n tile.hotel = hotel\n tile.save\n other_tiles = convert_tile_to_number({'row' => placed_sur_tiles[0].tile.row, 'column' => placed_sur_tiles[0].tile.column, 'current_color' => 'grey'})\n # Update Game log\n msg = player.username + ' extended ' + selected_hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n end\n end\n elsif placed_sur_tiles.length == 3 # 3 surrounding tiles\n if (placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel == 'none') && (placed_sur_tiles[2].hotel == 'none') # all surrounding tiles are orphans\n #new chain with chain size 4\n if selected_hotel == 'none'\n # need input from user for new chain\n raise 'Ambiguous color'\n else\n # new chain\n color = HOTEL_COLORS[selected_hotel]\n orphan_tiles_info = [[placed_sur_tiles[0].tile.row, placed_sur_tiles[0].tile.column, 'grey'], [placed_sur_tiles[1].tile.row, placed_sur_tiles[1].tile.column, 'grey'], [placed_sur_tiles[2].tile.row, placed_sur_tiles[2].tile.column, 'grey']]\n other_tiles = convert_tiles_to_numbers(orphan_tiles_info)\n #save game hotel chain size\n chosen_game_hotel = self.game_hotels.where(name: selected_hotel).first\n chosen_game_hotel.chain_size = 4\n chosen_game_hotel.save\n chosen_game_hotel.update_share_price\n #save other tiles hotels\n placed_sur_tiles[0].hotel = selected_hotel\n placed_sur_tiles[1].hotel = selected_hotel\n placed_sur_tiles[2].hotel = selected_hotel\n placed_sur_tiles[0].save\n placed_sur_tiles[1].save\n placed_sur_tiles[2].save\n #save placed tile hotel\n tile.hotel = selected_hotel\n tile.save\n # Update Game log\n msg = player.username + ' founded ' + selected_hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n end\n elsif (placed_sur_tiles[0].hotel != 'none') && (placed_sur_tiles[1].hotel != 'none') && (placed_sur_tiles[2].hotel != 'none') # all surrounding tiles are part of hotel chains\n if [placed_sur_tiles[0].hotel, placed_sur_tiles[1].hotel, placed_sur_tiles[2].hotel].uniq.length == 1 # all surrounding tiles are part of same hotel chain\n #extension of chain by 1\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n tile.hotel = hotel\n tile.save\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 1\n hotel_chain.save\n hotel_chain.update_share_price\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n elsif ([placed_sur_tiles[0].hotel, placed_sur_tiles[1].hotel].uniq.length == 1) || ([placed_sur_tiles[0].hotel, placed_sur_tiles[2].hotel].uniq.length == 1) || ([placed_sur_tiles[1].hotel, placed_sur_tiles[2].hotel].uniq.length == 1)\n # 2 of the surrounding tiles are part of the same hotel chain\n # merger of 2 chains\n if ([placed_sur_tiles[0].hotel, placed_sur_tiles[1].hotel].uniq.length == 1)\n merger_tiles = [placed_sur_tiles[0], placed_sur_tiles[2]]\n else\n merger_tiles = [placed_sur_tiles[0], placed_sur_tiles[1]]\n end \n response = execute_merger(merger_tiles, false, tile)\n other_tiles = convert_tiles_to_numbers(response[1])\n color = response[0]\n dominant_hotel = response[2]\n acquired_hotel = response[3]\n acquired_hotel_size = response[4]\n # Update Game log\n msg = player.username + ' caused a merger. ' + dominant_hotel.name + ' acquired ' + acquired_hotel.name + '.'\n LogEntry.create(message: msg, game_id: self.id)\n merger_stock(dominant_hotel, acquired_hotel, acquired_hotel_size)\n merger = true\n else\n #merger of 3 chains\n response = big_merger(placed_sur_tiles, tile)\n other_tiles = convert_tiles_to_numbers(response[1])\n color = response[0]\n dominant_hotel = response[2]\n acquired_hotel1 = response[3]\n acquired_hotel1_size = response[4]\n acquired_hotel2 = response[5]\n acquired_hotel2_size = response[6]\n # Update Game log\n msg = player.username + ' caused a merger wit 3 chains. ' + dominant_hotel.name + ' acquired ' + acquired_hotel1.name + ' and ' + acquired_hotel1.name + '.'\n LogEntry.create(message: msg, game_id: self.id)\n merger_stock(dominant_hotel, acquired_hotel1, acquired_hotel1_size)\n merger_stock(dominant_hotel, acquired_hotel2, acquired_hotel2_size)\n merger_three = true\n end\n elsif ((placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel != 'none') && (placed_sur_tiles[2].hotel != 'none')) || ((placed_sur_tiles[0].hotel != 'none') && (placed_sur_tiles[1].hotel != 'none') && (placed_sur_tiles[2].hotel == 'none')) || ((placed_sur_tiles[0].hotel != 'none') && (placed_sur_tiles[1].hotel == 'none') && (placed_sur_tiles[2].hotel != 'none'))\n # 1 of the surrounding tiles is an orphan and the other 2 are part of hotel chains\n if ((placed_sur_tiles[0].hotel == placed_sur_tiles[1].hotel) || (placed_sur_tiles[0].hotel == placed_sur_tiles[2].hotel) || (placed_sur_tiles[2].hotel == placed_sur_tiles[1].hotel))\n # 2 of the surrounding tiles are part of the same hotel chain and the other is an orphan\n # extension of chain by 2\n if placed_sur_tiles[0].hotel != 'none'\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n if placed_sur_tiles[1].hotel != 'none'\n orphan_tile = placed_sur_tiles[2]\n else\n orphan_tile = placed_sur_tiles[1]\n end\n orphan_tile.hotel = hotel\n orphan_tile.save\n other_tiles = convert_tile_to_number({'row' => orphan_tile.tile.row, 'column' => orphan_tile.tile.column, 'current_color' => 'grey'})\n tile.hotel = hotel\n tile.save\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n elsif placed_sur_tiles[1].hotel != 'none'\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n if placed_sur_tiles[0].hotel != 'none'\n orphan_tile = placed_sur_tiles[2]\n else\n orphan_tile = placed_sur_tiles[0]\n end\n orphan_tile.hotel = hotel\n orphan_tile.save\n other_tiles = convert_tile_to_number({'row' => orphan_tile.tile.row, 'column' => orphan_tile.tile.column, 'current_color' => 'grey'})\n tile.hotel = hotel\n tile.save\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n end\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 2\n hotel_chain.save\n hotel_chain.update_share_price\n else\n # 2 surrounding tiles are from different hotel chains and the other is an orphan\n # merger of 2 chains and 1 orphan\n response = merger_and_orphan(placed_sur_tiles, tile)\n other_tiles = convert_tiles_to_numbers(response[1])\n color = response[0]\n dominant_hotel = response[2]\n acquired_hotel = response[3]\n acquired_hotel_size = response[4]\n # Update Game log\n msg = player.username + ' caused a merger. ' + dominant_hotel.name + ' acquired ' + acquired_hotel.name + '.'\n LogEntry.create(message: msg, game_id: self.id)\n merger_stock(dominant_hotel, acquired_hotel, acquired_hotel_size)\n merger = true\n end\n elsif ((placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel == 'none') && (placed_sur_tiles[2].hotel != 'none')) || ((placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel != 'none') && (placed_sur_tiles[2].hotel == 'none')) || ((placed_sur_tiles[0].hotel != 'none') && (placed_sur_tiles[1].hotel == 'none') && (placed_sur_tiles[2].hotel == 'none'))\n # 1 of the surrounding tiles is part of a hotel chain and the others are orphans\n # extension of chain with 2 orphans\n if placed_sur_tiles[0].hotel != 'none'\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 3\n hotel_chain.save\n hotel_chain.update_share_price\n placed_sur_tiles[1].hotel = hotel\n placed_sur_tiles[1].save\n placed_sur_tiles[2].hotel = hotel\n placed_sur_tiles[2].save\n tile.hotel = hotel\n tile.save\n orphan_tiles_info = [[placed_sur_tiles[1].tile.row, placed_sur_tiles[1].tile.column, 'grey'], [placed_sur_tiles[2].tile.row, placed_sur_tiles[2].tile.column, 'grey']]\n other_tiles = convert_tiles_to_numbers(orphan_tiles_info)\n elsif placed_sur_tiles[1].hotel != 'none'\n hotel = placed_sur_tiles[1].hotel\n color = HOTEL_COLORS[hotel]\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 3\n hotel_chain.save\n hotel_chain.update_share_price\n placed_sur_tiles[0].hotel = hotel\n placed_sur_tiles[0].save\n placed_sur_tiles[2].hotel = hotel\n placed_sur_tiles[2].save\n tile.hotel = hotel\n tile.save\n orphan_tiles_info = [[placed_sur_tiles[0].tile.row, placed_sur_tiles[0].tile.column, 'grey'], [placed_sur_tiles[2].tile.row, placed_sur_tiles[2].tile.column, 'grey']]\n other_tiles = convert_tiles_to_numbers(orphan_tiles_info)\n elsif placed_sur_tiles[2].hotel != 'none'\n hotel = placed_sur_tiles[2].hotel\n color = HOTEL_COLORS[hotel]\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 3\n hotel_chain.save\n hotel_chain.update_share_price\n placed_sur_tiles[0].hotel = hotel\n placed_sur_tiles[0].save\n placed_sur_tiles[1].hotel = hotel\n placed_sur_tiles[1].save\n tile.hotel = hotel\n tile.save\n orphan_tiles_info = [[placed_sur_tiles[0].tile.row, placed_sur_tiles[0].tile.column, 'grey'], [placed_sur_tiles[1].tile.row, placed_sur_tiles[1].tile.column, 'grey']]\n other_tiles = convert_tiles_to_numbers(orphan_tiles_info) \n end\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n end\n elsif placed_sur_tiles.length == 4 # 4 surrounding tiles\n if (placed_sur_tiles[0].hotel == 'none') && (placed_sur_tiles[1].hotel == 'none') && (placed_sur_tiles[2].hotel == 'none') && (placed_sur_tiles[3].hotel == 'none')\n # all surrounding tiles are orphans\n # new chain of 5\n if selected_hotel == 'none'\n # need input from user for new chain\n raise 'Ambiguous color'\n else\n # new chain\n color = HOTEL_COLORS[selected_hotel]\n orphan_tiles_info = [[placed_sur_tiles[0].tile.row, placed_sur_tiles[0].tile.column, 'grey'], [placed_sur_tiles[1].tile.row, placed_sur_tiles[1].tile.column, 'grey'], [placed_sur_tiles[2].tile.row, placed_sur_tiles[2].tile.column, 'grey'], [placed_sur_tiles[3].tile.row, placed_sur_tiles[3].tile.column, 'grey']]\n other_tiles = convert_tiles_to_numbers(orphan_tiles_info)\n #save game hotel chain size\n chosen_game_hotel = self.game_hotels.where(name: selected_hotel).first\n chosen_game_hotel.chain_size = 5\n chosen_game_hotel.save\n chosen_game_hotel.update_share_price\n #save other tiles hotels\n placed_sur_tiles[0].hotel = selected_hotel\n placed_sur_tiles[1].hotel = selected_hotel\n placed_sur_tiles[2].hotel = selected_hotel\n placed_sur_tiles[3].hotel = selected_hotel\n placed_sur_tiles[0].save\n placed_sur_tiles[1].save\n placed_sur_tiles[2].save\n placed_sur_tiles[3].save\n #save placed tile hotel\n tile.hotel = selected_hotel\n tile.save\n # Update Game log\n msg = player.username + ' founded ' + selected_hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n end\n elsif ([placed_sur_tiles[0].hotel, placed_sur_tiles[1].hotel, placed_sur_tiles[2].hotel].uniq.length == 1 && placed_sur_tiles[3].hotel == 'none') || ([placed_sur_tiles[0].hotel, placed_sur_tiles[1].hotel, placed_sur_tiles[3].hotel].uniq.length == 1 && placed_sur_tiles[2].hotel == 'none') || ([placed_sur_tiles[0].hotel, placed_sur_tiles[3].hotel, placed_sur_tiles[2].hotel].uniq.length == 1 && placed_sur_tiles[1].hotel == 'none') || ([placed_sur_tiles[3].hotel, placed_sur_tiles[1].hotel, placed_sur_tiles[2].hotel].uniq.length == 1 && placed_sur_tiles[0].hotel == 'none')\n # 3 of surrounding tiles are of same chain and the other is an orphan\n # extension of chain by 2\n if placed_sur_tiles[0].hotel != 'none'\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n if placed_sur_tiles[1].hotel == 'none'\n orphan_tile = placed_sur_tiles[1]\n elsif placed_sur_tiles[2].hotel == 'none'\n orphan_tile = placed_sur_tiles[2]\n else\n orphan_tile = placed_sur_tiles[3]\n end\n orphan_tile.hotel = hotel\n orphan_tile.save\n other_tiles = convert_tile_to_number({'row' => orphan_tile.tile.row, 'column' => orphan_tile.tile.column, 'current_color' => 'grey'})\n tile.hotel = hotel\n tile.save\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n elsif placed_sur_tiles[1].hotel != 'none'\n hotel = placed_sur_tiles[0].hotel\n color = HOTEL_COLORS[hotel]\n if placed_sur_tiles[0].hotel == 'none'\n orphan_tile = placed_sur_tiles[0]\n elsif placed_sur_tiles[2].hotel == 'none'\n orphan_tile = placed_sur_tiles[2]\n else\n orphan_tile = placed_sur_tiles[3]\n end\n orphan_tile.hotel = hotel\n orphan_tile.save\n other_tiles = convert_tile_to_number({'row' => orphan_tile.tile.row, 'column' => orphan_tile.tile.column, 'current_color' => 'grey'})\n tile.hotel = hotel\n tile.save\n # Update Game log\n msg = player.username + ' extended ' + hotel + '.'\n LogEntry.create(message: msg, game_id: self.id)\n end\n hotel_chain = self.game_hotels.where(name: hotel).first\n hotel_chain.chain_size += 2\n hotel_chain.save\n hotel_chain.update_share_price\n end \n else\n # tile placement not valid\n return false \n end\n\n if !merger && !merger_three\n return [color, other_tiles, merger, merger_three]\n else\n if merger\n return [color, other_tiles, merger, merger_three, acquired_hotel.name]\n else\n return [color, other_tiles, merger, merger_three, acquired_hotel1.name, acquired_hotel2.name]\n end\n end\n end",
"def generateBoard(row, col, num_mines)\n# Step 1 create board\n board = Array.new(row) { Array.new(col) {-1}}\n# Step 2 place random mines on board\n until num_mines < 1\n temp_x = rand(row)\n temp_y = rand(col)\n \n if board[temp_x][temp_y] != \"*\"\n board[temp_x][temp_y] = \"*\" \n num_mines -= 1 \n end\n end\n \n# Step 3 Iterate each tile skipping mines\n board.each_index do |x|\n board.each_index do |y|\n next if board[x][y] == \"*\"\n count = 0\n \n # Step 3a\n # check within bounds and count mines\n min_x = x - 1\n max_x = x + 1\n min_y = y - 1\n max_y = y + 1\n \n (min_x..max_x).each do |x|\n (min_y..max_y).each do |y|\n if (x >= 0 && x < row) && (y >= 0 && y < col)\n count += 1 if board[x][y] == \"*\"\n end\n end\n end\n \n board[x][y] = count\n end\n end\n \n # return board\n board\nend",
"def hole6\n [?A,*(?2..'10'),?J,?K,?Q].product([?C,?H,?S,?D]).map(&:join) + [?J,?J]\n # put your implementation in here, but please leave the comments above and at the 'end'\n\n end",
"def mexican_blanket_magic(colours)\n ptr = -1\n pattern = []\n colours.size.times do\n # Next 10 lines build the gradient\n 5.times { pattern[ptr += 1] = colours[0] }\n pattern[ptr+=1] = colours[1]\n\n 4.times { pattern[ptr+=1] = colours[0] }\n 2.times { pattern[ptr+=1] = colours[1] }\n\n 3.times { pattern[ptr+=1] = colours[0] }\n 3.times { pattern[ptr+=1] = colours[1] }\n\n 2.times { pattern[ptr+=1] = colours[0] }\n 4.times { pattern[ptr+=1] = colours[1] }\n\n pattern[ptr+=1] = colours[0]\n 5.times { pattern[ptr+=1] = colours[1] }\n\n # This is our black stripe which divides the gradients\n n = rand(100)\n if n <= 20 # Aprox. 20% chance of 3px wide line\n 3.times { pattern[ptr+=1] = \"black\" }\n elsif n >= 80 # Aprox. 20% chance of 7px wide line\n 7.times { pattern[ptr+=1] = \"black\" }\n end # Aprox. 60% chance of no line\n\n # Aprox. 20% chance we will get a diagonal bar\n # of random colour and size (<= 21px)\n if rand(100) < 20\n clr = colours[rand(colours.size)]\n (rand(20)+1).times { pattern[ptr+=1] = clr }\n end\n\n # Rotate through the colours in order\n cs = colours.shift\n colours.push(cs)\n end\n\n # Pad out the pattern to match image width\n ptr = -1\n while pattern.size < COLUMNS\n pattern << pattern[ptr+=1]\n end\n return pattern\nend",
"def get_board(width,height,finished_game_counter,current_score)\n board = Array.new(height) { Array.new(width, 0)}\n (0..(height-1)).each do |row|\n (0..(width-1)).each do |column| \n \n #generate a random number between 1 and 6 inclusive, in order to create an array\n #of randomly coloured fields\n array_element = rand(1..6)\n \n #allocates a number to each colour\n if array_element == 1 \n board[row][column] = :red\n elsif array_element == 2\n board[row][column] = :green\n elsif array_element == 3\n board[row][column] = :blue\n elsif array_element == 4\n board[row][column] = :yellow\n elsif array_element == 5\n board[row][column] = :magenta\n elsif array_element == 6\n board[row][column] = :cyan\n end\n end\n end\n \n #sets count to 0\n count = 0\n choose_colour(board,width,height,count,finished_game_counter,current_score)\nend",
"def tile_board\n @board_array.each_with_index do |row_array, row|\n 10.times{|column| row_array << Tile.new(row,column)}\n end\n end",
"def checkerboard(size)\n\n\tfor i in 1..size do\n\t\t\n\t\ti % 2 == 0 ? checker=0 : checker=1\n\n\t\tfor j in 1..size do\n\n\t\t\tif checker == 1 \n\t\t\t\tprint \"[r]\"\n\t\t\t\tchecker = 0\n\t\t\telse\n\t\t\t\tprint \"[b]\"\n\t\t\t\tchecker = 1\n\t\t\tend\n\t\tend\n\t\tputs \"\\n\"\n\tend \n\t\nend",
"def generate_possible_areas_for_all_numbered_tiles\n t = Time.now\n puts 'Start: Generate possible areas for all numbered tiles'\n all_possible_areas = {}\n\n # @b_nl.each_with_value do |value, i, j|\n # if value != 0 then\n # restricted_board = create_restricted_board [i,j]\n # t_area = Time.now\n # next if [i,j] == [7,1]\n # puts \"Summoning for [#{i},#{j}]\"\n # a = summon_areas([i,j], value, restricted_board)\n\n # puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n # all_possible_areas[\"#{i}-#{j}\"] = a\n # end\n (0..@row_count-1).to_a.each do |i|\n (0..@col_count-1).to_a.each do |j|\n # Summon for each numbered tile(non zero)\n if @b_nl[i,j] != 0 then\n restricted_board = create_restricted_board [i,j]\n t_area = Time.now\n next if [i,j] == [7,1]\n puts \"Summoning for [#{i},#{j}]\"\n a = summon_areas([i,j],@b_nl[i,j], restricted_board)\n\n puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n all_possible_areas[\"#{i}-#{j}\"] = a\n end\n end\n end\n puts 'Finish: Generate possible areas for all numbered tiles, time: ' + (Time.now - t).to_i.to_s + 'seconds'\n all_possible_areas[\"7-1\"] = [[[]]]\n all_possible_areas\n end",
"def gray_boomcity_tile_potential_count\n gray_boomcity_tile_count +\n [gray_double_boomcity_tile_count, @pending_gray_boom_tile_lays[:double_boom].size].min\n end",
"def evaluate(game)\n\t\t\tsum_of_tiles = game.board.inject(0) { |sum, tile| sum + tile.val} \n\t\t\tempty_tiles_factor = (game.board.select{|t| t.empty?}.count * 15) \n\t\t\tmax_tile = game.board.max_by { |tile| tile.val}.val\n\t\t\thighest_tile_factor = max_tile * max_tile * max_tile * max_tile\n\t\t\tsum_of_tiles + empty_tiles_factor + highest_tile_factor\n\t\tend",
"def count_correct_colors\n colors_by_difficulty.each do |color|\n if @code_guess.count(color) < @secret_code.count(color)\n @white_peg += @code_guess.count(color)\n else\n @white_peg += @secret_code.count(color)\n end\n end\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 evaluate(game)\n\t\t\tsum_of_tiles = game.board.inject(0) { |sum, tile| sum + tile.val} \n\t\t\tempty_tiles_factor = (game.board.select{|t| t.empty?}.count * 15) \n\t\t\tmax_tile = game.board.max_by { |tile| tile.val}.val\n\t\t\thighest_tile_factor = max_tile * max_tile \n\t\t\tsum_of_tiles + empty_tiles_factor + highest_tile_factor\n\t\tend",
"def populate_grid\n start_rows = { red: (0..2), black: (5..7) }\n\n 8.times do |x|\n 8.times do |y|\n [:red, :black].each do |color|\n if (x + y).even? && start_rows[color].include?(y)\n self[[x, y]] = Piece.new(color, [x, y], self)\n end\n end\n end\n end\n\n grid.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n puts \"x=#{x}, y=#{y}, cell.class=#{cell.class}\"\n end\n end\n end",
"def castling_check_squares(checks)\n i = 0\n index = colour == 'White' ? 4 : 60\n checks.times do\n index -= 1 if checks == 3\n index += 1 if checks == 2\n break if board[index].current_piece != ' '\n\n i += 1\n end\n i == checks ? castling_move(checks) : false\n end",
"def show_board\n @grid.each_with_index do |row, row_index|\n row.each_with_index do |square, col_index|\n piece = self[row_index, col_index]\n if row_index.even? && col_index.even?\n print \" #{piece.display} \".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :white ) if piece.nil?\n elsif row_index.even? && col_index.odd? \n print \" #{piece.display} \".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :light_white ) if piece.nil?\n elsif row_index.odd? && col_index.even? \n print \" #{piece.display} \".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :light_white ) if piece.nil?\n elsif row_index.odd? && col_index.odd?\n print \" #{piece.display} \".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :white ) if piece.nil?\n end\n end\n puts \"\"\n end\n end",
"def setup_mans(row,color)\n 3.times do\n @grid[row].each_index do |col|\n Piece.new(self, [row,col], color) if (row+col).odd?\n end\n row += 1\n end\n end",
"def populate_board\n #the six rows get updated\n players.each do |player|\n rows = player == players[0] ? [ 0,1,2 ] : [ 5,6,7 ]\n piece_count = 0\n col = 0\n\n player.pieces.each do |piece|\n\n rows.shift if piece_count % 4 == 0 and piece_count != 0\n\n col_start = rows[0] % 2 == 1 ? 0 : 1\n col = 0 if (col_start == 0 || col_start == 1) && piece_count % 4 == 0\n\n piece.position = [col + col_start, rows[0]]\n squares[[col + col_start, rows[0]]] = piece\n\n col += 2\n piece_count += 1\n\n end\n\n end\n\n end",
"def correct_colors(temp_array)\n temp_player_input = temp_array[1]\n temp_secret_code = temp_array[0]\n temp_player_input.each do |item|\n next unless temp_secret_code.include?(item)\n\n @matches.shift\n @matches << 'white'\n temp_secret_code[temp_secret_code.index(item)] = 'O'\n end\n end",
"def check_for_game_over(boards)\n #CHECKING FOR A TIE\n temp_array = []\n if boards.flatten.select { |cell| temp_array << cell if cell == \"-\" }\n if temp_array.length == 0\n puts \"This game is a tie\"\n puts \"You both suck at this game!!!\"\n puts \"GOOD-BYE!\"\n exit\n end\n end\n # CHECKING COLUMNS FOR WINNER\n if boards.transpose.map do |col|\n return true if col.join().match(/X{4}|O{4}/)\n end\n end\n # CHECKING ROWS FOR WINNER\n if boards.map do |row|\n return true if row.join().match(/X{4}|O{4}/)\n end \n end\n # CHECKING DIAGONAL UPPER LEFT TO BOTTOM RIGHT - - - - - - - - - - - -\n if temp_array = (3..6).collect { |i| boards[i][-3+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (2..6).collect { |i| boards[i][-2+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n #return true if (1..6).collect { |i| boards[i][i-1] }.join().match(/X{4}|O{4}/) => refactor to this (first go around)\n if temp_array = (1..6).collect { |i| boards[i][i-1] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..6).collect { |i| boards[i][0+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..5).collect { |i| boards[i][1+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..4).collect { |i| boards[i][2+i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n # CHECKING DIAGONAL UPPER RIGHT TO BOTTOM LEFT\n if temp_array = (1..6).collect { |i| boards[i][0-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (2..6).collect { |i| boards[i][1-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n #return true if (3..6).collect { |i| boards[i][2-i] }.join().match(/X{4}|O{4}/)\n if temp_array = (3..6).collect { |i| boards[i][2-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..6).collect { |i| boards[i][-1-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..5).collect { |i| boards[i][-2-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n if temp_array = (1..4).collect { |i| boards[i][3-i] }\n return true if temp_array.join().match(/X{4}|O{4}/)\n end\n\n\nend",
"def step_three\n zeros = starred_zeros.select_cells { |cell| cell }\n zeros.each do |zero|\n covered_zeros.set_col(zero[1], true)\n end\n end",
"def checkerboard(size)\n return \"\" if size <= 0\n completed_board = \"\"\n\n first_line = size.times do |n|\n if n.odd?\n completed_board << \"[r]\"\n else\n completed_board << \"[b]\"\n end\n end\n\n # binding.pry\nend",
"def image_board\n\t\t(0...@width).map do |i|\n\t\t\t(0...@height).map do |j|\n\t\t\t\t# ([1]*3+[0]*7)[rand 10]\n\t\t\t\trand 2\n\n\n\t\t\t\t# rand 2\n\t\t\tend\n\t\tend\n\tend",
"def get_green_to_red_scala n\n colors = []\n r = 0; g = 150; b = 0\n max = 255\n\n #se empieza en un g oscuro en 150 y se aclarece añadiendo g hasta 255\n #ni = numero iteraciones\n ni = (1*n/3)\n for i in 1..(1*n/3.to_f).floor\n g = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g esta en 255 se añade r desde 150 hasta 255 hasta llegar a amarillo\n #ni = numero iteraciones\n g = 255\n ni = 1 + (2*n/3.to_f).floor - (1*n/3.to_f).ceil\n for j in (1*n/3.to_f).ceil..(2*n/3.to_f).floor\n i = j - (1*n/3.to_f).ceil + 1\n r = 150 + (i*(max - 150)/ni.to_f).floor\n colors << rgb(r, g, b)\n end\n\n #una vez g y r estan en 255 se quita g hasta 0 hasta llegar a rojo\n #ni = numero iteraciones\n g = r = 255\n ni = 1 + n - (2*n/3.to_f).ceil\n for i in (2*n/3.to_f).ceil..n\n g = ((n - i)*(max/ni.to_f)).floor\n colors << rgb(r, g, b)\n end\n\n #se entrega la escala de verde a rojo\n colors\n end",
"def hourglassSum(arr)\r\n rc_arr = [\r\n [0, 0, 0, 0],\r\n [0, 0, 0, 0],\r\n [0, 0, 0, 0],\r\n [0, 0, 0, 0]\r\n ]\r\n\r\n arr.each_with_index do |row, i|\r\n row.each_with_index do |cell, j|\r\n rc_arr[i][j] += cell if (0..3).include?(j) && (0..3).include?(i)\r\n rc_arr[i][j-1] += cell if (0..3).include?(j-1) && (0..3).include?(i)\r\n rc_arr[i][j-2] += cell if (0..3).include?(j-2) && (0..3).include?(i)\r\n\r\n rc_arr[i-1][j-1] += cell if (0..3).include?(j-1) && (0..3).include?(i-1)\r\n\r\n rc_arr[i-2][j] += cell if (0..3).include?(j) && (0..3).include?(i-2)\r\n rc_arr[i-2][j-1] += cell if (0..3).include?(j-1) && (0..3).include?(i-2)\r\n rc_arr[i-2][j-2] += cell if (0..3).include?(j-2) && (0..3).include?(i-2)\r\n end\r\n end\r\n\r\n rc_arr.flatten.max\r\nend",
"def eliminate_coliding_areas all_possible_areas\n puts 'All areas initial: ' + all_possible_areas.values.map{|areas| areas.count }.inspect\n\n all_possible_areas_reduced = {}\n\n # Reduce areas by eliminiting the ones which touch on another\n # numbered tile\n all_possible_areas.keys.each do |numbered_tile|\n x,y = numbered_tile.split('-').map(&:to_i)\n # Create board with compased tiles on all numbered tiles minus the\n # numbered tile\n restricted_board = create_restricted_board([x,y]).to_a\n all_compased_numbered_tiles = []\n (0..(@row_count-1)).to_a.each do |i|\n (0..(@col_count-1)).to_a.each do |j|\n all_compased_numbered_tiles << [i,j] if restricted_board[i][j] == 1\n end\n end\n\n all_areas_for_numbered_tile = all_possible_areas[numbered_tile].dup\n\n all_possible_areas_reduced[numbered_tile] = all_areas_for_numbered_tile.delete_if do |area|\n next if area.count == 1\n # Skip area, hmm do I need this bellow\n # next if (@b_nl[x,y] == 1)\n # Remove area if colinding\n area & all_compased_numbered_tiles != []\n end\n end #for each numbered_tile,area_span\n\n puts 'All numbered tile areas reduced(not coliding other numbered tiles)' + all_possible_areas_reduced.values.map{|areas| areas.count }.inspect\n all_possible_areas_reduced\n end",
"def floodFill(col, row)\r\n (col > @columns-1 || col < 0 || row > @rows-1 || row < 0) && return #Returns if the tile index is outside of the grid bounds.\r\n @tile[col][row].revealed && return #Returns if the tile is already revealed.\r\n\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount -= 1\r\n adjacent = @tile[col][row].adjacent #Gets the adjacent count for the tile.\r\n\r\n #Reveal the adjacent count of the tile.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @btn = button(adjacent.to_s, newStyle)\r\n end\r\n old.remove\r\n\r\n #Recursively calls flood fill for the surrounding tiles.\r\n if (@tile[col][row].adjacent == 0)\r\n floodFill(col+1,row+1)\r\n floodFill(col+1,row)\r\n floodFill(col+1,row-1)\r\n floodFill(col,row+1)\r\n floodFill(col,row-1)\r\n floodFill(col-1,row+1)\r\n floodFill(col-1,row)\r\n floodFill(col-1,row-1)\r\n end\r\n\r\nend",
"def wipe_3x3_squares(board)\n for y in [0, 3, 6]\n for x in [0, 3, 6]\n for yy in(y...y+3)\n for xx in (x...x+3)\n if board[yy][xx][0] != 0\n wipe = board[yy][xx][0]\n for yyy in (y...y+3)\n for xxx in(x...x+3)\n board[yyy][xxx][wipe] = 0\n end\n end\n end\n end\n end\n end\n end\n return\n end",
"def get_tile_color(x, y)\n 0xffffffff\n end",
"def cover_starred_zeroes!()\n num = 0 \n @matrix_size.times{|c|\n if col_has_star?(c)\n cover_col!(c)\n num += 1\n end\n }\n if num >= @matrix_size\n return :done\n else\n return 4\n end\n end",
"def place_second_color_rows\n back_pieces = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n [[0, :black], [7, :white]].each do |row, color|\n back_pieces.each_with_index do |piece_class, col|\n self[[row, col]] = piece_class.new(self, color, [row, col])\n end\n end\n end",
"def initial_piece_placements\n self.grid.each_with_index do |row, row_idx|\n row.each_with_index do |cell, cell_idx|\n pos = [row_idx, cell_idx]\n if pos.all? {|coord| coord.even?} || pos.all? {|coord| coord.odd?}\n if row_idx < 3\n self[pos] = Piece.new(self, pos, :white)\n elsif row_idx >= 5\n self[pos] = Piece.new(self, pos, :black)\n end\n end\n end\n end\n end",
"def game_over \n # all the grid's cells are full and different numbers \n end",
"def apply_rules_part2(grid)\n new_grid = deep_copy_grid(grid)\n (0..(grid.length - 1)).each do |row|\n (0..(grid[0].length - 1)).each do |col|\n\n if grid[row][col] == 'L' && num_visible_occupied(grid, row, col) == 0\n new_grid[row][col] = '#'\n elsif grid[row][col] == '#' && num_visible_occupied(grid, row, col) >= 5\n new_grid[row][col] = 'L'\n end\n\n end\n end\n\n new_grid\n end",
"def greedy(rows, cols)\n board = Array.new(rows.length) { Array.new(cols.length) }\n rows.each_with_index { |r, r_idx|\n cols.each_with_index { |c, c_idx|\n board[r_idx][c_idx] = if (r > 0 and c > 0)\n rows[r_idx] -= 1\n cols[c_idx] -= 1\n 'x'\n else\n 'o'\n end\n }\n }\n board\nend",
"def setup_easier\n (1...ROWS).each do |row|\n (1...COLUMNS).each do |col|\n set_neighbour_colour(col, row) if rand(-1...COLOR_TABLE.size) == -1\n end\n end\n end",
"def color_matches(code, guess)\n colormatches = 0\n guess.each{ |num| colormatches += 1 if code.any?{|x| x == num} }\n colormatches\n end",
"def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend",
"def display_board\n row_idx = -1\n numera = [1,2,3,4,5,6,7,8,9]\n @display = @grid.map do |row|\n \n col_idx = -1\n row_idx += 1 \n row.map do |col| \n col_idx += 1 \n if @flag_pair.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'F'.orange\n elsif col == :B\n col = 'H'.green\n elsif (@known_empty.include? ((row_idx.to_s) + (col_idx.to_s))) && (numera.include? col)\n col = col.to_s.red\n elsif @known_empty.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'O'.blue\n else\n col = 'H'.green\n end \n end \n end\n end",
"def set_pieces\n\t\t(0..7).each do |row|\n\t\t\tcase row\n\t\t\twhen 0\n\t\t\t\tplace_special_pieces(row, :white)\n\t\t\twhen 1\n\t\t\t\tplace_pawns(row, :white)\n\t\t\twhen 6\n\t\t\t\tplace_pawns(row, :black)\n\t\t\twhen 7\n\t\t\t\tplace_special_pieces(row, :black)\n\t\t\tend\n\t\tend\n\tend",
"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 randomize_cells!\n @life.height.times do |y|\n @life.width.times do |x|\n @life.set_cell_alive! x, y if rand > 0.5\n end\n end\n end",
"def test_board_should_have_9_tiles\n assert_equal(9, @board.number_of_tiles)\n end",
"def check_win?(board)\n total_squares = board.length * board[0].length\n completed_squares = 0\n height = board.length\n width = board[0].length\n\n # Loop through each square of the board\n (0...height).each do |row|\n (0...width).each do |column|\n # Increment counter if square matches color\n completed_squares += 1 if board[row][column] == board[0][0]\n end\n end\n\n # Check if all of the squares are the same color\n if total_squares == completed_squares\n return true\n else\n return false\n end\nend",
"def render\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |tile, j|\n if i == 0 || i == 7\n if j == 0 || j == 7\n print \" R \"\n elsif j == 1 || j == 6\n print \" Kn\"\n elsif j == 2 || j == 5\n print \" B \"\n else\n print \" T \"\n end\n elsif i == 1 || i == 6\n print \" p \"\n else\n print \" X \".colorize(:blue)\n end\n end\n puts\n end\n return nil\n end",
"def back_rows(color)\n back_pieces = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n i = (color == :white) ? 7 : 0\n\n back_pieces.each_with_index do |piece, j|\n @grid[i][j] = piece.new(color, [i, j], @grid)\n end\n end",
"def generate_tile_heights(map_size)\n # USE SUPER SIMPLIFIED VERSION FOR NOW\n return Array.new(map_size, 1)\n\n # STUFF BELOW FOR MORE COMPLEX IMPLEMENTATION IN THE FUTURE\n # I RAN OUT OF TIME :(\n tiles = [\n Array.new((map_size*0.5).floor, 1), \n Array.new((map_size*0.4).floor, 2), \n Array.new((map_size*0.1).floor, 3) \n ].flatten\n\n # Compensate for imperfect percentage rounding \n (map_size - tiles.size).times do |i|\n tiles.push([1, 2, 3].sample)\n end\n\n # Shuffle the tiles to randomly assign them\n tiles = tiles.shuffle\n\n return tiles\n end",
"def colorable_grid_map(color_option = :even)\n\t\tcolor_cordinates = []\n\t\tpixel_grid = @avatar[:grid].map.with_index(0) do |num, i|\n\t\t\tif num % 2 == 0\n\t\t\t\thorizontal = (i % 5) * 50\n\t\t\t\tvertical = (i / 5) * 50\n\n\t\t\t\ttop_left = [horizontal, vertical]\n\t\t\t\tbottom_right = [horizontal + 50, vertical + 50]\n\t\t\t\t[ top_left, bottom_right ]\n\t\t\tend\n\t\tend\n\t\tpixel_grid.compact\n\tend",
"def get_board_colors(game)\n board_colors = {}\n [1,2,3,4,5,6,7,8,9,10,11,12].each do |num|\n ['A','B','C','D','E','F', 'G','H','I'].each do |letter|\n cell = (num.to_s + letter)\n board_colors[cell] = 'none'\n end\n end \n \n placed_tiles = game.game_tiles.where(placed: true)\n placed_tiles.each do |game_tile|\n hotel = game_tile.hotel\n color = game.get_hotel_color(hotel)\n board_colors[game_tile.cell] = color\n end\n\n board_colors\n end",
"def check_pungs\n @tmp_count_group_by_tile.each do |tile, count|\n next if count < 3\n if block_given?\n yield(tile, count)\n else\n @tmp_count_group_by_tile[tile] -= 3\n @tmp_win_hand << Array.new(3, tile)\n end\n end\n end",
"def test_has_proper_number_of_tiles\n\t98.times { @pd.draw_tile } \t\n \n\tassert_equal true, @pd.empty?\n end",
"def apply_rules(grid)\n new_grid = deep_copy_grid(grid)\n (0..(grid.length - 1)).each do |row|\n (0..(grid[0].length - 1)).each do |col|\n count = num_adjacent_occupied(grid, row, col)\n\n if grid[row][col] == 'L' && num_adjacent_occupied(grid, row, col).zero?\n new_grid[row][col] = '#'\n elsif grid[row][col] == '#' && num_adjacent_occupied(grid, row, col) >= 4\n new_grid[row][col] = 'L'\n end\n end\n end\n\n new_grid\n end",
"def choose_colour(board,width,height,count,finished_game_counter,current_score)\n \n #prints the array\n board.each do |row|\n row.each do |column| \n \n #the field is coloured according to the element in the array \n if column == :red\n \n #prints the element as two space characters with a coloured background\n print column = \" \".colorize(:background => :red)\n elsif column == :green\n print column = \" \".colorize(:background => :green)\n elsif column == :blue\n print column = \" \".colorize(:background => :blue)\n elsif column == :yellow\n print column = \" \".colorize(:background => :yellow)\n elsif column == :magenta\n print column = \" \".colorize(:background => :magenta)\n elsif column == :cyan\n print column = \" \".colorize(:background => :cyan)\n end \n end\n puts\n end\n \n #display number of turns\n print \"Number of turns: \"\n turns(count)\n \n #display percentage completed\n print \"Current completion: \"\n completion(board,width,height,count,finished_game_counter,current_score)\n \n #gets user input r,g,y,b,c,m and increases count by one\n print \"Choose a colour: \"\n user_colour = gets.chomp.downcase\n count = count + 1\n \n #the user_colour variable will be set , depending on the user input\n if user_colour == \"r\"\n user_colour = :red\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"g\"\n user_colour = :green\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"b\"\n user_colour = :blue\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"y\"\n user_colour = :yellow\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"m\"\n user_colour = :magenta\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n elsif user_colour == \"c\"\n user_colour = :cyan\n change_colour(board,user_colour,width,height,count,finished_game_counter,current_score)\n \n #if user types q, he will return to the main menu\n elsif user_colour == \"q\"\n main_menu(width,height,current_score,finished_game_counter)\n end\nend",
"def test_tile_rack_with_several_tiles_should_need_some_tiles\n [:A,:B,:C].each{|x| @newTileRack.append(x)}\n assert_equal(4,@newTileRack.number_of_tiles_needed)\n end",
"def bit_board(color)\n @board.map { |row|\n row.map { |cell| ROAD[color].include?(cell.last) ? 1 : 0 }\n }\n end",
"def eight_queens_possibilities(current_row, taken_columns, positions)\n\nend",
"def solve_row! r\n\t\trow = @tile_layout[r]\n\t\t(0..@size-2).each do |column|\n\t\t\ttile = row[column]\n\t\t\tbinding.pry if tile.blank?\n\n\t\t\t# assume that there is only one possible match for the next tile\n\t\t\teast_neighbor = tile.possible_east_neighbors\n\t\t\tbinding.pry unless east_neighbor.count == 1\n\t\t\teast_neighbor = east_neighbor.first\n\n\t\t\teast_neighbor.orient! :west, tile.east_edge.reverse\n\t\t\trow[column + 1] = east_neighbor.place!\n\t\tend\n\tend",
"def pawn_rows(color)\n i = (color == :white) ? 6 : 1\n\n @grid[i].each.with_index do |el, j|\n @grid[i][j] = Pawn.new(color, [i, j], @grid)\n end\n end",
"def completion(boardGame, oldColor)\n count = 0.0;\n (0..boardGame.length - 1).each do |i|\n (0..boardGame[i].length - 1).each do |j|\n if boardGame[i][j] == oldColor then\n count += 1\n end\n end \n end\n return ((count/(boardGame.length*boardGame[0].length))*100.0).floor\nend",
"def setup_board\n (1..64).each do |location|\n @@piece_locations[location] = {\"type\" => \" \", \"number\" => nil, \"color\" => nil}\n end\n\n # Black Pieces\n @@piece_locations[1] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[2] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[3] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[4] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[5] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[6] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[7] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[8] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 8] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"black\", \"moved\" => false}\n end\n\n # White Pieces\n @@piece_locations[57] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[58] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[59] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[60] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[61] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[62] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[63] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[64] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 48] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"red\", \"moved\" => false}\n end\n end",
"def setup_grid\n empty_rows\n [:white, :light_yellow].each do |color|\n back_rows(color)\n pawn_rows(color)\n end\n end",
"def create_uncovered_grid(game_array)\n\n uncovered_grid = game_array.dup\n\n for y in 0..uncovered_grid.length-1\n for x in 0..uncovered_grid[y].length-1\n # If current square isn't a bomb...\n if !is_bomb(uncovered_grid[y][x])\n # ...replace with number of surrounding bombs\n uncovered_grid[y][x] = count_surround_spaces(x, y, game_array)\n\n end\n\n end\n end\n\n return uncovered_grid\n\nend",
"def check_combinations\n # returns possible sums of combinations from open-tiles \n sums = []\n size = open_tiles.length\n while size > 0\n # ref: https://www.geeksforgeeks.org/ruby-array-combination-operation/\n combinations = open_tiles.combination(size).to_a\n combinations.each { |combos| sums.append(combos.inject(0){ |sum, tile| sum + tile.numberID})}\n size -= 1\n end\n sums.uniq!.sort!\n end",
"def checker_board(size)\n pattern_1 = \"X X X \"\n pattern_2 = \" X X X\"\n\n numbers = (1..size).to_a.reverse\n numbers.each do |number|\n if number.even?\n puts pattern_2\n elsif number.odd?\n puts pattern_1\n end\n end\nend",
"def reset_attack(defender_color)\n\n for row in 0..7\n for col in 0..7\n if(defender_color==\"white\")\n get_square(row,col).attacked_black=false\n elsif defender_color==\"black\"\n get_square(row,col).attacked_white=false\n end\n\n\n end\n end\n end",
"def bad2 deck\n print \"\\t#{1}) %-39s \" % deck[5][4, 20]\n print \"\\t#{2}) %-39s \" % deck[50][4, 20]\n print \"\\t#{3}) %-39s \" % deck[59][4, 20]\n puts 'same color - dif number - same shade'\n puts 'BUT 1 and 3 are both squares, while 2 is triangle.'\n puts 'NOT A SET!!'\n puts\nend",
"def print_board\n 6.times do |y|\n y = 5 - y # To print from top to bottom\n 7.times do |x|\n if @board[[x, y]] == nil\n x == 6 ? (puts \"( )\") : (print \"( )\")\n else\n # Prints only the 3 first letters of each color to keep board alignment\n x == 6 ? (puts \"(#{@board[[x, y]].color[0, 3]})\") : (print \"(#{@board[[x, y]].color[0, 3]})\")\n end\n end\n end\n end",
"def check_row\n @winner = false\n @code_breaker_guess = @game_row_update\n @code_breaker_guess.each {|n| n.upcase!}\n @code_maker_solution = @hidden_row\n @code_maker_solution.each {|n| n.upcase!}\n @result = []\n\n @black_counter = 0\n @white_counter = 0\n @no_counter = 0\n\n for num in 0..3\n if (@code_maker_solution.include? @code_breaker_guess[num]) && (@code_breaker_guess[num] == @code_maker_solution[num])\n @black_counter += 1\n if @black_counter == 4\n @winner = true\n end\n elsif\n (@code_maker_solution.include? @code_breaker_guess[num]) && (@code_breaker_guess[num] != @code_maker_solution[num])\n @white_counter += 1\n else\n @no_counter += 1\n end\n end\n\n #puts \"Number black: #{@black_counter}\"\n #puts \"Number white: #{@white_counter}\"\n\n for bc in 0...@black_counter\n @result.push(\"B\")\n end\n\n for wc in 0...@white_counter\n @result.push(\"W\")\n end\n\n for nc in 0...@no_counter\n @result.push(\"-\")\n end\n\n #puts \" \"\n #puts \"Result Matrix: #{@result}\"\n puts \" \"\n\n end",
"def surround_nums(row, col)\n # North\n @grid[row-1][col] += 1 if ((row - 1) > -1) && @grid[row-1][col] != :B \n # NE\n @grid[row - 1][col + 1] += 1 if ((row - 1) > -1) && ((col+1) < 9) && @grid[row - 1][col + 1] != :B \n # East\n @grid[row][col+1] += 1 if ((col+1) < 9) && @grid[row][col+1] != :B \n # SE\n @grid[row+1][col+1] += 1 if ((row + 1) < 9) && ((col+1) < 9) && @grid[row+1][col+1] != :B \n # South\n @grid[row + 1][col] += 1 if ((row + 1) < 9) && @grid[row + 1][col] != :B \n # SW\n @grid[row + 1][col - 1] += 1 if ((row + 1) < 9) && ((col-1) > -1) && @grid[row + 1][col - 1] != :B \n # West\n @grid[row][col - 1] += 1 if ((col - 1) > -1) && @grid[row][col - 1] != :B \n # NW\n @grid[row - 1][col - 1] += 1 if ((row - 1) > -1) && ((col - 1 ) > -1) && @grid[row - 1][col - 1] != :B\n end",
"def drop_checker(color, column)\n\n if column < 0 || column > 6\n puts \"Insert a column number 0-6!\"\n return false\n end\n \n \n if color != :red && color != :black\n puts \"Color must be red or black!\"\n return false\n end\n \n 5.downto 0 do |row| #Counts down to zero\n if rows[row][column].empty?\n if color == :black \n rows[row][column] = \"O\"\n else\n rows[row][column] = \"X\"\n end\n print_grid\n return true\n end\n end\n \n puts \"You can't put a checker in a full column!\" \n return false \n end",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end",
"def populate_board\n back_row = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n\n black_back_row = []\n back_row.each_with_index do |piece_class, j|\n black_back_row << piece_class.new(self, :black, [0, j])\n end\n board[0] = black_back_row\n \n black_front_row = []\n (0..7).each {|idx| black_front_row << Pawn.new(self, :black, [1, idx])}\n board[1] = black_front_row\n \n (2..5).each do |row|\n board[row] = Array.new(8) {NullPiece.instance} \n end\n \n white_front_row = []\n 8.times {|idx| white_front_row << Pawn.new(self, :white, [6, idx])}\n board[6] = white_front_row\n \n white_back_row = []\n back_row.each_with_index do |piece_class, j|\n white_back_row << piece_class.new(self, :white, [7, j])\n end\n board[7] = white_back_row\n end",
"def deal_tiles\n Tile.all.each do |tile|\n cell = tile.column.to_s + tile.row\n GameTile.create(tile_id: tile.id, game_id: self.id, hotel: 'none', cell: cell, placed: false, available: true)\n end\n self.game_players.each do |player|\n 6.times do\n available_tiles = self.game_tiles.where(available: true)\n random_tile = available_tiles[rand(available_tiles.length)]\n random_tile.available = false\n random_tile.save\n GamePlayerTile.create(game_player_id: player.id, tile_id: random_tile.tile_id)\n end\n end\n end",
"def simple_bracelet(length, width, nr_of_colors)\n\tnr_of_threads = width + 1\n\tif nr_of_colors > nr_of_threads\n\t\tputs \"Number of colors needs to be equal or less than width\"\n\t\treturn\n\telsif nr_of_colors > COLORS.length\n\t\tputs \"Number of colors must be less then #{COLORS.length}\"\n\t\treturn\n\tend\n\n\tchosen_colors = COLORS.sample(nr_of_colors).map { |color| color_block(color) }\n\tcolor_pattern = chosen_colors\n\n\tuntil color_pattern.length == width\n\t\tcolor_pattern << chosen_colors.sample\n\tend\n\n\tlength.times do\n\t\twidth.times do\n\t\t\tcolor_pattern.unshift(color_pattern.pop)\n\t\t\tputs color_pattern.join('')\n\t\tend\n\tend\nend",
"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 mineTile(col, row)\r\n\r\n @endGame && return #Returns if the games has already been lost.\r\n @tile[col][row].revealed && return #Returns if the tile is already revealed.\r\n\r\n #Checks if the tile is not an ore.\r\n if (@tile[col][row].tier == 0)\r\n adjacent = @tile[col][row].adjacent\r\n\r\n if (adjacent == 0)\r\n floodFill(col,row) #If the tile has an adjacent value of 0, performs a flood fill to uncover the surrounding tiles.\r\n else\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount-=1\r\n\r\n #Re-renders the button so it displays the new text.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @tile[col][row].btn = button adjacent.to_s, newStyle###\r\n end\r\n old.remove\r\n end\r\n else #Tile is an ore.\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount -= 1\r\n tileTier = @tile[col][row].tier\r\n\r\n #Updates the experience\r\n @experienceInt += 2**(tileTier-1)\r\n @experience.clear { para(\"EXP: \" + @experienceInt.to_s, @style_stats) }\r\n\r\n #Gets the amount of experience needed to reach the next tier.\r\n if (@tierInt < @tiers)\r\n if (@tierInt == @tiers - 1)\r\n required = 1 #If the player is on the penultimate tier then 100% of previous ores need to be uncovered.\r\n else\r\n #Interpolates the upper and lower bound to get the required percentage for the next tier.\r\n required = @expLowerBound + (@tierInt * ((@expUpperBound - @expLowerBound) / @tiers))\r\n end\r\n\r\n\r\n #Gets the total amount of available experience for the player's current tier.\r\n expCount = 0\r\n (0..@tierInt-1).each do |tier|\r\n expCount += @tierExp[tier]\r\n end\r\n requiredExperience = (required * expCount).to_i\r\n\r\n #f the player's experience is greaster or equal to the required experience for the next tier, then the player advances a tier.\r\n if (@experienceInt >= requiredExperience)\r\n @tierInt+=1\r\n @tier.clear{ para(\"TIER: \" + @tierInt.to_s, @style_stats) }\r\n end\r\n\r\n end\r\n\r\n #If the ore is a higher tier than the player's tier then the durability decreases depending on the difference in tier values.\r\n if (tileTier > @tierInt)\r\n @durabilityInt -= 2 * (tileTier - @tierInt)\r\n #If the durability is 0 or less then the player loses.\r\n if (@durabilityInt <= 0)\r\n @durabilityInt = 0\r\n @endState.clear { subtitle(\"You Lose!\", @style_endgame) }\r\n @endGame = true\r\n end\r\n @durability.clear { para(\"DUR: \" + @durabilityInt.to_s, @style_stats) }\r\n end\r\n\r\n #Updates the ore count for the mined ore.\r\n reduceOreCount(tileTier-1)\r\n\r\n #Re-renders the button to displays the ore.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @tile[col][row].btn = button(@ore[tileTier-1].to_s, newStyle)###\r\n end\r\n old.remove\r\n\r\n end\r\n\r\n #Checks if all tiles have been uncovered. If so gthe game was been won.\r\n if (@hiddenCount <= 0)\r\n @endState.clear { subtitle(\"You Win!\", @style_endgame) }\r\n @endGame = true\r\n end\r\n\r\nend",
"def adjacent_clear(row,col)\n square = 1\n breaker = 0\n rowscols = []\n possibilities = [[row + square,col],[row,col + square],[row + square,col + square],[row - square,col],[row,col - square],[row - square,col - square],[row + square, col - square], [row - square, col + square]]\n if adjacent_mines(row,col) == 0 && row + square <= @row_count && row - square >= 0 && col + square <= @column_count && col - square >= 0\n possibilities.each do |position|\n rowscols << position\n end\n while row + square <= @row_count && row - square >= 0 && col + square <= @column_count && col - square >= 0\n square += 1\n possibilities.each do |check|\n breaker += adjacent_mines(check[0],check[1])\n end\n if breaker == 0\n possibilities.each do |check|\n rowscols << check\n end\n else\n break\n end\n possibilities = [[row + square,col],[row,col + square],[row + square,col + square],[row - square,col],[row,col - square],[row - square,col - square],[row + square, col - square], [row - square, col + square]]\n end\n end\n rowscols << [row,col]\n rowscols\n end",
"def squarocol?(array)\n height = array.length\n width = height\n (0...height).each do |i|\n count_c = 1\n count_r = 1\n (0...width - 1).each do |j|\n count_c += 1 if array[i][j] == array[i][j + 1]\n count_r += 1 if array[j][i] == array[j + 1][i]\n end\n return true if count_c == height || count_r == width\n end\n false\nend",
"def possible_codes\n\t (0..5).each do |first|\n\t\t(0..5).each do |second|\n\t\t (0..5).each do |third|\n\t\t\t(0..5).each do |fourth|\n\t\t\t @set_of_codes << [COLORS[first],COLORS[second],COLORS[third],COLORS[fourth]]\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n\tend",
"def printGrid(boardGame)\n (0..boardGame.length - 1).each do |i|\n (0..boardGame[i].length - 1).each do |j|\n print \" \".colorize(:background => boardGame[i][j])\n if boardGame[i].length - 1 == j then\n puts\n end\n end \n end\nend",
"def solution_checker(array)\n if array.length > 1\n # Create a board that can be manipulated without affecting the original board\n internal_board = []\n column_counter = 1\n row_counter = 1\n 4.times do\n 4.times do\n internal_board.push(Square.new([column_counter, row_counter]))\n column_counter = column_counter + 1\n end\n row_counter = row_counter + 1\n column_counter = 1\n end\n #Label squares on the board as occupied\n array.each do |piece|\n square = internal_board.find {|s| s.location == piece.location}\n square.occupied = true\n square.piece = piece\n end\n array.each_with_index do |piece, index|\n if array.include?(piece) && piece != array.last\n original_square = internal_board.find {|s| s.location == piece.location}\n blocker = piece.impediments?([(array[index + 1]).column, (array[index + 1]).row], internal_board)\n if blocker\n break\n elsif piece.move([(array[index + 1]).column, (array[index + 1]).row])\n captured_piece = array[index + 1]\n array.uniq!{|piece| piece.location}\n original_square.occupied = false\n original_square.piece = nil\n new_moves = array.permutation.to_a\n new_moves.each do |new_array|\n new_array.map {|a| a.dup}\n end\n new_moves.each do |new_array|\n solution_checker(array)\n end\n else\n break\n end\n else\n break\n end\n end\n end\nend",
"def setColors(boardGame, newColor, oldColor, i, j) \n #checks if the pointer is within the bounds of the array and the colour that needs to be replaced \n #but not the new colour as this can lead to a stackoverflow\n if (i >= 0 and i <= boardGame.length - 1) and (j >= 0 and j <= boardGame[i].length - 1) and (boardGame[i][j] == oldColor) and (newColor != oldColor) then \n boardGame[i][j] = setColors boardGame, newColor, oldColor, i - 1, j\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i + 1, j\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i, j + 1\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i, j - 1 \n else\n return newColor\n end\nend",
"def get_board(width, height)\n #Here i have created a 2d array which will contain the contents of the board\n board = Array.new(height) { Array.new(width, ' ')}\n \n #Loops through the rows and columns of the board array and creates a random number which is used to set the colour of each position \n #in the board array to one of the 6 random colours\n (0..height-1).each do |row|\n\t(0..width-1).each do |column| \n\t rand_num = rand(1..6)\n\t if rand_num == 1 then\n\t\tboard[row][column] = :red\n\t elsif rand_num == 2 then\n\t\tboard[row][column] = :blue\n\t elsif rand_num == 3 then\n\t\tboard[row][column] = :cyan\n elsif rand_num == 4 then\n\t\tboard[row][column] = :magenta\n elsif rand_num == 5 then\n\t\tboard[row][column] = :green\n\t elsif rand_num == 6 then\n\t\tboard[row][column] = :yellow\n\t end \n\tend\n end\n return board\nend",
"def make_other_rows \n left = 2\n right = @n - 1\n\n (0..t-1).each do |c|\n (1..m-1).each do |r|\n @rounds[c][r] = \"#{left}-#{right}\"\n right = right_decrement(right)\n if r < m-1\n left = left_increment(left)\n elsif r == m-1\n left = left_increment_for_the_last_column(left)\n end\n end\n end\n end",
"def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n\n (1..8).each do |row|\n (1..8).each do |col|\n\n # Place starting pieces on board\n if (1..3).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::RED)\n end\n\n @board[[row,col]] = Square.new(colors[0])\n\n colors << colors.delete_at(0) unless col == 8\n end\n end\n end",
"def test_neighbour_count\n # Empty\n @game.state=[[0,0,0],[0,0,0],[0,0,0]]\n assert_equal 0,@game.neighbour_count(0,0)\n assert_equal 0,@game.neighbour_count(1,1)\n\n # One cell, check all neighbours, check proper edge wrapping\n @game.state=[[0,0,0],[0,1,0],[0,0,0]]\n assert_equal 1,@game.neighbour_count(0,2),'0,2'\n assert_equal 1,@game.neighbour_count(0,0),'0,0'\n assert_equal 1,@game.neighbour_count(0,1),'0,1'\n assert_equal 1,@game.neighbour_count(1,0),'1,0'\n assert_equal 0,@game.neighbour_count(1,1),'1,1' # Don't count self\n assert_equal 1,@game.neighbour_count(1,2),'1,2'\n assert_equal 1,@game.neighbour_count(2,0),'2,0'\n assert_equal 1,@game.neighbour_count(2,1),'2,1'\n assert_equal 1,@game.neighbour_count(2,2),'2,2'\n\n # Eight cells, check all neighbours, check proper edge wrapping\n @game.state=[[1,1,1],[1,0,1],[1,1,1]]\n assert_equal 7,@game.neighbour_count(0,2),'0,2'\n assert_equal 7,@game.neighbour_count(0,0),'0,0'\n assert_equal 7,@game.neighbour_count(0,1),'0,1'\n assert_equal 7,@game.neighbour_count(1,0),'1,0'\n assert_equal 8,@game.neighbour_count(1,1),'1,1' # Only cell with 8\n assert_equal 7,@game.neighbour_count(1,2),'1,2'\n assert_equal 7,@game.neighbour_count(2,0),'2,0'\n assert_equal 7,@game.neighbour_count(2,1),'2,1'\n assert_equal 7,@game.neighbour_count(2,2),'2,2'\n end",
"def print_tile\n if @value == \"0\"\n print \"\"\n elsif @value != \"0\" && @given == false\n print @value.to_s.colorize(:blue)\n else\n print @value.to_s.colorize(:red)\n end\n end",
"def connect_spaces\n\n # set the tile-tile, tile-vtex, and tile-edge links\n @tiles.each do |tile|\n r, c = tile.row, tile.col\n\n # link the tile with its 6 neighboring tiles\n [[[ r-1 , c-1 ], :nw, :se],\n [[ r-1 , c ], :ne, :sw],\n [[ r , c+1 ], :e , :w ],\n [[ r+1 , c+1 ], :se, :nw],\n [[ r+1 , c ], :sw, :ne],\n [[ r , c-1 ], :w , :e ],\n ].each do |coords, dir1, dir2|\n other = @tile_map[coords]\n tile.set_tile(dir1, other)\n other.set_tile(dir2, tile) unless other.nil?\n end\n\n # link the tile with its 6 neighboring vertexes\n [[[ r-1 , c-1 , :down ], :nw, :se],\n [[ r , c , :up ], :n , :s ],\n [[ r-1 , c , :down ], :ne, :sw],\n [[ r+1 , c+1 , :up ], :se, :nw],\n [[ r , c , :down ], :s , :n ],\n [[ r+1 , c , :up ], :sw, :ne],\n ].each do |coords, dir1, dir2|\n vtex = @vtex_map[coords]\n tile.set_vtex(dir1, vtex)\n vtex.set_tile(dir2, tile) unless vtex.nil?\n end\n\n # link the tile with its 6 neighboring edges\n [[[ r , c , :vert ], :w , :e ],\n [[ r , c , :asc ], :nw, :se],\n [[ r , c , :desc ], :ne, :sw],\n [[ r , c+1 , :vert ], :e , :w ],\n [[ r+1 , c+1 , :asc ], :se, :nw],\n [[ r+1 , c , :desc ], :sw, :ne],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n tile.set_edge(dir1, edge)\n edge.set_tile(dir2, tile) unless edge.nil?\n end\n end\n\n # link the :up vertexes with neighboring edges\n @up_vtexs.each do |vtex|\n r, c = vtex.row, vtex.col\n [[[ r-1 , c , :vert ], :n , :s ],\n [[ r , c , :asc ], :sw, :ne],\n [[ r , c , :desc ], :se, :nw],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n vtex.set_edge(dir1, edge)\n edge.set_vtex(dir2, vtex) unless edge.nil?\n end\n end\n\n # link the :down vertexes with neighboring edges\n @down_vtexs.each do |vtex|\n r, c = vtex.row, vtex.col\n [[[ r+1 , c+1 , :vert ], :s , :n ],\n [[ r+1 , c+1 , :asc ], :ne, :sw],\n [[ r+1 , c , :desc ], :nw, :se],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n vtex.set_edge(dir1, edge)\n edge.set_vtex(dir2, vtex) unless edge.nil?\n end\n end\n end",
"def update_next_state\n # Maybe if I do this it won't query for this game's tiles every time? ¯\\_(ツ)_/¯\n tiles = self.tiles \n players = self.players \n voids = tiles.where(\"height < 1\")\n\n # Pick random tiles to raise\n raiseTiles = voids.sample((voids.length/2).ceil)\n dropCounter = (players.length/2).ceil\n dropTiles = []\n\n # Drop tiles players were on\n players.each do |player|\n dropTiles << player.tile\n end \n\n # Pick random tiles to drop\n while dropCounter > 0\n randTile = tiles.sample\n\n if (!dropTiles.include?(randTile) && randTile.height > 0)\n dropTiles << randTile \n dropCounter -= 1\n end\n end\n\n tiles.each do |tile| \n if (dropTiles.include?(tile))\n tile.update(height: tile.height-1)\n elsif (raiseTiles.include?(tile))\n tile.update(height: [2, 1, 1, 1].sample)\n end\n end\n end",
"def refresh_tiles\n return if empty?\n xdiff = @array[0].real_x.round / -32 - 1\n ydiff = @array[0].real_y.round / -32 - 1\n if ydiff > 0\n ydiff.times do\n move_up do |sprite|\n sprite.mapy += YSIZE\n sprite.real_y += 32 * YSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n elsif ydiff < 0\n ydiff.abs.times do\n move_down do |sprite|\n sprite.mapy -= YSIZE\n sprite.real_y -= 32 * YSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n end\n if xdiff > 0\n xdiff.times do\n move_left do |sprite|\n sprite.mapx += XSIZE\n sprite.real_x += 32 * XSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n elsif xdiff < 0\n xdiff.abs.times do\n move_right do |sprite|\n sprite.mapx -= XSIZE\n sprite.real_x -= 32 * XSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n temp_bitmaps = nil\n end\n end",
"def draw_tiles(num)\n player_hand = []\n # array will return tiles to player. Needs much refactoring.\n return nil if num > tiles_remaining\n #to account for test, returns nil if more tiles are drawn than tiles remain.\n while player_hand.length != num\n new_tile = rand(@default_set.size)\n starting_hand = 0\n\n @default_set.each do |letter, letter_quantity|\n #Need to continue working on, this is becoming harder to read. TODO: REFACTOR!\n # if the amount of tiles drawn(starting at 0) is the same as the amount of new tiles drawn,\n if starting_hand == new_tile && letter_quantity != 0\n #if the condition above, and the total tiles isnt 0, add the new tile (letter), to all of the tiles (player_hand array)\n # if letter_quantity != 0\n player_hand << letter\n #Then subtract the letter from the tilebag, reducing the total amount of tiles by 1, and reducing the letter by one specifically from the letters.\n @default_set[letter] = letter_quantity - 1\n else\n new_tile = rand(@default_set.size)\n \n end\n #increases the amount of tiles had by player plus one, each time a tile is drawn\n starting_hand += 1\n end\n end\n #returns array of all tiles to player\n return player_hand\n end"
] |
[
"0.63061494",
"0.61762726",
"0.5951057",
"0.592607",
"0.58918905",
"0.5848015",
"0.5824953",
"0.5807494",
"0.57600635",
"0.5752242",
"0.57450694",
"0.57046735",
"0.56623435",
"0.5648064",
"0.5646536",
"0.5624774",
"0.56208116",
"0.5596462",
"0.558845",
"0.55854005",
"0.5576405",
"0.55724734",
"0.5557773",
"0.55256224",
"0.5515254",
"0.55138946",
"0.5491313",
"0.5488741",
"0.5486962",
"0.54759943",
"0.5468523",
"0.5464326",
"0.5462828",
"0.54514366",
"0.5447398",
"0.54408616",
"0.54282516",
"0.54234433",
"0.5413452",
"0.54042214",
"0.54000044",
"0.53959453",
"0.5393029",
"0.53881276",
"0.53808755",
"0.5380066",
"0.53772366",
"0.5371219",
"0.5364218",
"0.5362706",
"0.5361797",
"0.53600883",
"0.5352657",
"0.5342838",
"0.53418034",
"0.53245103",
"0.53144056",
"0.53137195",
"0.53134656",
"0.5313177",
"0.53105074",
"0.5305804",
"0.53048474",
"0.52977717",
"0.52869266",
"0.52865714",
"0.5284511",
"0.52844447",
"0.5280959",
"0.52766865",
"0.5267714",
"0.5262763",
"0.52575904",
"0.52528614",
"0.5244303",
"0.5239314",
"0.52391243",
"0.5227514",
"0.52260774",
"0.52217406",
"0.5221082",
"0.52179253",
"0.52170116",
"0.5214899",
"0.52140886",
"0.52113664",
"0.5210716",
"0.5208164",
"0.52061445",
"0.52000433",
"0.51958746",
"0.5193923",
"0.51937723",
"0.519081",
"0.51886195",
"0.5185511",
"0.518427",
"0.51798844",
"0.51791507",
"0.5175489",
"0.5174105"
] |
0.0
|
-1
|
vimType and xsiType arg positions are switched here because most strings are MORs, and this makes it easier to set the vimType of the MOR.
|
def initialize(val = "", vimType = nil, xsiType = nil)
self.xsiType = xsiType
self.vimType = vimType
super(val)
yield(self) if block_given?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def types=(_arg0); end",
"def set_type\n case content\n when \"empty\" then self.content_type = \"empty\"\n when /ire/ then self.content_type = \"ire\"\n when /hill|tree/ then self.content_type = \"obstacle\"\n when /axe|sword|lance/ then self.content_type = \"enemy\"\n else raise \"Change type\"\n end\n end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def ContentType=(v) Axlsx::validate_content_type",
"def content_type=(v) Axlsx::validate_content_type v; @content_type = v end",
"def vim_mappings\n { \n \"VI_SELECTED_TEXT\" => \"getreg()\",\n \"VI_FILENAME\" => \"@%\",\n \"VI_CURRENT_LINE\" => \"getline(\\\".\\\")\",\n \"VI_SOFT_TABS\" => \"&expandtab\"\n }\n end",
"def set_type\n end",
"def define_type_and_value\n if boolean?\n @type = :boolean\n @value = @arg[:boolValue]\n elsif string?\n @type = :string\n @value = @arg[:textValue]\n elsif datetime?\n @type = :datetime\n @value = @arg[:datetimeValue]\n elsif extension?\n @type = :extension\n @value = @arg[:extension]\n else\n @type = :unknown\n end\n end",
"def initialize(line)\n @argtype = line.split(\" \")[0].to_sym\n end",
"def menu_mots type_mot\n template_menu_mots\n .gsub(/__TYPE__/,type_mot)\n .gsub(/_TYPE_MOT_/,type_mot.titleize)\n .sub(/_VALUE_TYPE_/,mot.send(type_mot.to_sym)||'')\n end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def override_content_type_and_save_info\n case File.extname(file.file).delete('.').downcase.to_sym\n when :xlsx\n file.content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n when :docx\n file.content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n when :pptx\n file.content_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n when :rar\n file.content_type = 'application/vnd.rar'\n when :zip\n file.content_type = 'application/zip'\n when :bat\n file.content_type = 'application/x-msdos-program'\n when :cmd\n file.content_type = 'application/cmd'\n when :exe\n file.content_type = 'application/x-msdownload'\n when :msi\n file.content_type = 'application/x-msi'\n when :php\n file.content_type = 'application/x-php'\n when :py\n file.content_type = 'application/x-python'\n when :vbs\n file.content_type = 'application/x-vbs'\n end\n\n model.file_content_type = file.content_type if file.content_type\n model.file_size = number_to_human_size(file.size) if file.size\n end",
"def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for your name\n orig_string = OpenStudio::Measure::OSArgument.makeStringArgument('orig_string', true)\n orig_string.setDisplayName('Type the text you want search for in object names')\n orig_string.setDefaultValue('replace this text')\n args << orig_string\n\n # make an argument to add new space true/false\n new_string = OpenStudio::Measure::OSArgument.makeStringArgument('new_string', true)\n new_string.setDisplayName('Type the text you want to add in place of the found text')\n new_string.setDefaultValue('with this text')\n args << new_string\n\n return args\n end",
"def type=(type); end",
"def fix_typewriter(text); end",
"def mediatype; end",
"def type\n requires_preauth\n app\n formation = get_formation\n changes = if args.any?{|arg| arg =~ /=/}\n args.map do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)=([\\w-]+)$/\n type, new_size = $1, $2\n current_p = formation.find{|f| f[\"type\"] == type}\n if current_p.nil?\n error(\"Type '#{type}' not found in process formation.\")\n end\n p = current_p.clone\n p[\"size\"] = new_size\n p\n end\n end.compact\n elsif args.any?\n size = shift_argument.downcase\n validate_arguments!\n formation.map{|p| p[\"size\"] = size; p}\n end\n scale_dynos(formation, changes) if changes\n display_dyno_type_and_costs(get_formation)\n end",
"def tvSetValue _args\n \"tvSetValue _args;\" \n end",
"def sc_type(type, text, *params)\n __remote_control_command(\"type\", [__locator(type, *params), text, ])\n end",
"def value_types=(_arg0); end",
"def types(types); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def set_pair_type\n @type = 'class' if @key == '*c' || @key == '*class'\n if @key == '*C' || @key == '*CLASS'\n @type = 'class'\n @key = @key.downcase\n end\n @type = 'id' if @key == '*i' || @key == '*id'\n @type = 'name' if @key == '*n' || @key == '*name'\n @type = 'name' if @key == '*N' || @key == '*NAME'\n @type = 'superclass' if @key == '*S' || @key == '*SUPERCLASS'\n @type = 'superclass' if @key == '*s' || @key == '*superclass'\n @type = 'keylist' if @key == '*a' || @key == '*assign'\n @type = 'version' if @key == '*V' || @key == '*VERSION'\n @type = 'method' if @key == '*m' || @key == '*method'\n @type = 'transform' if @key == '*t' || @key == '*transform'\n if @key == '*L' || @key == '*LOAD'\n @key = @key.downcase\n @type = 'import'\n if @array\n @global.freeze_max_files(@array.abstractArrayItems.length)\n elsif @valueItem&.value&.array\n @global.freeze_max_files(@valueItem&.value&.array.abstractArrayItems.length)\n elsif @valueItem&.value&.nbArray\n @global.freeze_max_files(@valueItem&.value&.nbArray.arrayItems.length)\n else\n @global.freeze_max_files(1)\n end\n end\n if @key == '*l' || @key == '*load'\n @type = 'import'\n end\n @type = 'index' if @key == '?'\n @type = 'hidden' if @key.start_with? '_'\n @type = 'allow' if @key.downcase == '*allow'\n end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def changeMetadataType\n begin\n old_type = params[:metadatatypename].to_s.strip.downcase\n new_type = params[:new_metadata_type].to_s.strip.downcase\n puts \"old_t: \" + old_type\n puts \"new_t: \" + new_type\n\n if old_type == \"\"\n render :text => \"Type of metadata not given\", :status => 404\n return\n end\n\n if new_type == \"\"\n render :text => \"Type of new metadata not given\", :status => 404\n return\n end\n\n # Find old metadata type\n @metadatatype = MetadataType.find_by_name(old_type)\n\n # If old metadata type was not found\n if @metadatatype == nil\n render :text => \"Old metadata type not found\", :status => 404\n return\n end\n\n # Check that new type doesn't exist already\n # @@existing_metadata_types listed in the beginning of file\n if MetadataType.find_by_name(new_type) or @@existing_metadata_types.include?(new_type)\n render :text => \"Type of new metadata already exists\", :status => 404\n return\n end\n\n # Change metadata type name\n @metadatatype.update_attribute(:name, new_type)\n render :text => \"Metadata type changed\", :status => 200\n return\n\n rescue => e\n puts \"Error in changing metadatatype: #{e.to_s}\".background(:red)\n render :text => \"Conflict\", :status => 409\n return\n end\n end",
"def type(type); end",
"def DataType=(arg0)",
"def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"virtualization.VmwareVirtualMachine\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end",
"def adapt_doc_string(doc_string_ast)\n adapted_doc_string = super(doc_string_ast)\n\n adapted_doc_string['content_type'] = doc_string_ast[:mediaType]\n\n adapted_doc_string\n end",
"def set_type_from(s)\n\t\t\treturn unless s.include?('-')\n\t\t\tt = (s=~/^fill-extrusion/ ? \"fill-extrusion\" : s.split('-')[0]).to_sym\n\t\t\tif t==:icon || t==:text then t=:symbol end\n\t\t\tif @type && @type!=t then raise \"Attribute #{s} conflicts with deduced type #{@type} in layer #{@kv[:id]}\" end\n\t\t\t@type=t\n\t\tend",
"def instance_type=(_arg0); end",
"def metaphone(str, options = T.unsafe(nil)); end",
"def attr_set_sb1(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def exe(s)\n VIM.command s\nend",
"def _type=(_)\n end",
"def taggable_type=(sType)\n super(sType.to_s.constantize.base_class.to_s)\n end",
"def argument_types=(*value)\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 type=(val)\n @type = val.to_sym if %w(UNSPECIFIED MEDIA MASTER).include? val.to_s\n end",
"def SetVgaType(new_vga)\n ParseInstallationKernelCmdline() if !@cmdline_parsed\n @vgaType = new_vga\n\n nil\n end",
"def nonregular_type; end",
"def attr_set_sb2(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def initialize(description,type,flags)\n @description = description\n @vararg = type.include? '*'\n type.delete!('*')\n @type = type\n @flags = flags\n end",
"def attr_set_sb4(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"def object_update(type)\n raise 'you need to use -o option!' unless type\n\n type = type.downcase\n case type\n when 'datastores'\n @vobject = VOBJECT::DATASTORE\n when 'templates'\n @vobject = VOBJECT::TEMPLATE\n when 'networks'\n @vobject = VOBJECT::NETWORK\n when 'images'\n @vobject = VOBJECT::IMAGE\n when 'hosts'\n @vobject = VOBJECT::HOST\n else\n puts \"unknown #{type} type option\"\n puts ' -o options:'\n puts ' datastores'\n puts ' templates'\n puts ' networks'\n puts ' images'\n puts ' hosts'\n\n exit 0\n end\n end",
"def content_type=(content_type); end",
"def cmd_type(param)\n send_unauthorised and return unless logged_in?\n send_param_required and return if param.nil?\n if param.upcase.eql?(\"A\")\n send_response \"200 Type set to ASCII\"\n elsif param.upcase.eql?(\"I\")\n send_response \"200 Type set to binary\"\n else\n send_response \"500 Invalid type\"\n end\n end",
"def conv_itype(itype)\n case itype\n when 'concept' : itype\n when 'query_doctrack' : 'query'\n else 'document'\n end\nend",
"def setMarkerType _obj, _args\n \"_obj setMarkerType _args;\" \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 setWaypointType _obj, _args\n \"_obj setWaypointType _args;\" \n end",
"def type ; metadata[:type] ; end",
"def value_type= value_type\n self.type = value_type.gsub(\"-\", \"_\").camelize\n end",
"def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
"def image_content_type=(value)\n @children['image-content-type'][:value] = value\n end",
"def set_up\n vim.command 'set number'\n vim.command 'hi Visual guifg=#FFFF00 guibg=#003322 gui=none'\n vim.edit filename\n vim.feedkeys '\\\\<esc>'\n sleep 2 if WITH_PAUSES\nend",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def override_content_type_and_save_info\n case File.extname(file.file).delete('.').to_sym\n when :xlsx\n file.content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n when :docx\n file.content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n when :pptx\n file.content_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n end\n\n # if File.extname(file.file).delete('.').to_sym == :xlsx\n # file.content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n # end\n # if File.extname(file.file).delete('.').to_sym == :docx\n # file.content_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n # end\n # if File.extname(file.file).delete('.').to_sym == :pptx\n # file.content_type='application/vnd.openxmlformats-officedocument.presentationml.presentation'\n # end\n\n model.file_content_type = file.content_type if file.content_type\n model.file_size = number_to_human_size(file.size) if file.size\n\n tmp_file = file.path\n photo = MiniExiftool.new \"#{tmp_file}\"\n\n model.latitude = dms_to_float(photo.gpslatitude) if photo && photo.gpslatitude\n model.longitude = dms_to_float(photo.gpslongitude) if photo && photo.gpslongitude\n model.photo_created_at = photo.createdate if photo && photo.createdate\n end",
"def vector_geom_type\n return \"Mixed\" unless file_set\n geometry = file_set.try(:geometry).try(:first) || \"Mixed\"\n vector_geom_clean(geometry)\n end",
"def set_affected_object_type\n\n\taffected_object_type = AffectedObjectType.find_by_affected_object_type_name(self.affected_object_type_name)\n\t if affected_object_type != nil \n\t\t self.affected_object_type = affected_object_type\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"value of field: 'affected_object_type_name' is invalid- it must be unique\")\n\t\t return false\n\tend\nend",
"def source_type=(_arg0); end",
"def set_content_type old_type, old_resource_type, new_type, new_resource_type\n xml=self.ng_xml\n xml.search('/contentMetadata[@type=\\''+old_type+'\\']').each do |node|\n node['type']=new_type\n xml.search('//resource[@type=\\''+old_resource_type+'\\']').each do |resource|\n resource['type']=new_resource_type\n end\n end\n self.content=xml.to_s\n end",
"def setType _obj, _args\n \"_obj setType _args;\" \n end",
"def validated_parser_type(type); end",
"def scan_string(str, need_names = true)\n # @verbose ||= @@debug\n\n type = nil\n name = nil\n default = nil\n\n str.sub!(/\\A\\s+/, '')\n \n $stderr.puts \" str=#{str.inspect}\" if @verbose\n \n if md = /\\A(\\w+(::\\w+)*)\\s+(\\w+)/s.match(str)\n # $stderr.puts \" pre_match=#{md.pre_match.inspect}\"\n # $stderr.puts \" md[0]=#{md[0].inspect}\"\n str = md.post_match\n type = md[1]\n name = md[3]\n elsif md = /\\A(\\*?\\w+)/s.match(str)\n # $stderr.puts \" pre_match=#{md.pre_match.inspect}\"\n # $stderr.puts \" md[0]=#{md[0].inspect}\"\n str = md.post_match\n type = nil\n name = md[1]\n else\n raise NameError, \"Syntax error in multimethod parameter: expected type and/or name at #{str.inspect}\"\n end\n \n $stderr.puts \" type=#{type.inspect}\" if @verbose \n $stderr.puts \" name=#{name.inspect}\" if @verbose \n \n # Parse parameter default.\n if md = /\\A\\s*=\\s*/.match(str)\n str = md.post_match\n \n in_paren = 0\n default = ''\n until str.empty?\n # $stderr.puts \" default: str=#{str.inspect}\"\n # $stderr.puts \" default: params=#{parameter_to_s}\"\n \n if md = /\\A(\\s+)/s.match(str)\n str = md.post_match\n default = default + md[1]\n end\n \n if md = /\\A(\"([^\"\\\\]|\\\\.)*\")/s.match(str)\n str = md.post_match\n default = default + md[1]\n elsif md = /\\A('([^'\\\\]|\\\\.)*')/s.match(str)\n str = md.post_match\n default = default + md[1]\n elsif md = /\\A(\\()/.match(str)\n str = md.post_match\n in_paren = in_paren + 1\n default = default + md[1]\n elsif in_paren > 0 && md = /\\A(\\))/s.match(str)\n str = md.post_match\n in_paren = in_paren - 1\n default = default + md[1]\n elsif md = /\\A(\\))/s.match(str)\n break\n elsif in_paren == 0 && md = /\\A,/s.match(str)\n break\n elsif md = /\\A(\\w+)/s.match(str)\n str = md.post_match\n default = default + md[1]\n elsif md = /\\A(.)/s.match(str)\n str = md.post_match\n default = default + md[1] \n end\n\n $stderr.puts \" default=#{default.inspect}\" if @verbose \n end\n end\n \n self.name = name unless @name\n self.type = type unless @type\n default = nil if default && default.empty?\n self.default = default unless @default\n\n str\n end",
"def type_klass=(_arg0); end",
"def meta_content_type(body); end",
"def default_mime_type=(value); end",
"def mType(inParams)\n retVal = @m_typeDefault\n\n case inParams[:colour]\n when 'red'\n retVal = 'kr'\n when 'blue'\n retVal = 'kb'\n end\n retVal += 'p' if inParams[:is_primary];\n retVal\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def set_filetype(filename)\n\t\t$filetypes.each{|k,v|\n\t\t\tif filename.match(k) != nil\n\t\t\t\t@filetype = v\n\t\t\tend\n\t\t}\n\t\t# set up syntax coloring\n\t\t@syntax_color_lc = $syntax_color_lc[@filetype]\n\t\t@syntax_color_bc = $syntax_color_bc[@filetype]\n\t\t@syntax_color_regex = $syntax_color_regex[@filetype]\n\tend",
"def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end"
] |
[
"0.5479132",
"0.5262888",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.51739913",
"0.51069266",
"0.50648713",
"0.5054776",
"0.4999499",
"0.49847463",
"0.495303",
"0.49474925",
"0.49474925",
"0.49474925",
"0.49474925",
"0.49474925",
"0.49458236",
"0.49339768",
"0.493218",
"0.48947588",
"0.48616675",
"0.48588213",
"0.48419285",
"0.48344734",
"0.48310882",
"0.48077837",
"0.4786077",
"0.4786077",
"0.4786077",
"0.4780451",
"0.4772063",
"0.4772063",
"0.4772063",
"0.47688916",
"0.4748558",
"0.4735012",
"0.473421",
"0.47231385",
"0.4720221",
"0.46907312",
"0.46886998",
"0.4687806",
"0.46835795",
"0.46807167",
"0.46667007",
"0.46647513",
"0.46589524",
"0.46561885",
"0.46529272",
"0.4636428",
"0.46056318",
"0.46021727",
"0.4600154",
"0.4596824",
"0.4595425",
"0.45943868",
"0.45886728",
"0.45780075",
"0.4577866",
"0.45692724",
"0.45673922",
"0.4557944",
"0.4538185",
"0.45291972",
"0.45212784",
"0.45122984",
"0.45122984",
"0.45122984",
"0.45122984",
"0.45122984",
"0.45077574",
"0.45002854",
"0.44977906",
"0.44947243",
"0.44941303",
"0.44934082",
"0.44931433",
"0.44886002",
"0.44885394",
"0.44742477",
"0.44702902",
"0.4464366",
"0.446279",
"0.446279",
"0.446279",
"0.446279",
"0.446279",
"0.4457284",
"0.44566378"
] |
0.6141915
|
0
|
toggles batches between active (one or more pigs alive) and retired (all pigs deceased) states
|
def toggle
@batch = Batch.find(params[:id])
@batch.update(:active => @batch.active? ? false : true)
redirect_to :back
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resetStates()\r\n @players.each do |player|\r\n if(player.money > 0)\r\n player.state = \"fine\"\r\n else\r\n player.state = \"broke\"\r\n end\r\n end\r\n end",
"def change_obstacle_states\n @linked_obstacles.each do |i|\n i.switch_state\n end\n end",
"def update_batch_statuses\n current_batches = decode(batch_statuses)\n \n if current_batches.keys.count > 20\n current_batches.keys[0..15].each do |batch_id|\n current_batches.delete(batch_id)\n end\n end\n\n current_batches.each do |id, status|\n case batch_status(id)\n when \"finished\"\n current_batches.delete(id)\n else\n current_batches[id] = batch_status(id)\n end\n end\n update_attribute(:batch_statuses, encode(current_batches))\n end",
"def mark_free(state = 0)\n self.state = state\n self.save\n end",
"def pbRestoreActivations(sprites,activeStatuses)\n return if !sprites || !activeStatuses\n for k in activeStatuses.keys\n if sprites[k] && sprites[k].is_a?(Window) && !pbDisposed?(sprites[k])\n sprites[k].active=activeStatuses[k] ? true : false\n end\n end\nend",
"def active\n !discarded?\n end",
"def suspend\n @active = false\n while creeps.any?{|creep| creep.busy? }\n sleep 1\n end\n while @colony_processor_busy\n sleep 1\n end\n end",
"def toggle_state\n state\n end",
"def deactivate\n update(state: 'inactive')\n end",
"def toggle_state\n puts \"******* toggle_state *******\"\n end",
"def set_state(new_state)\n # in order to facilitate execution of pre-save ops, \n # we check whether the application is persisted to mongo\n if pending_app_op_group.application.persisted?\n failure_message = \"Failed to set pending_op #{self._id.to_s} state to #{new_state.to_s} for application #{self.pending_app_op_group.application.name}\"\n updated_op = update_with_retries(5, failure_message) do |current_app, current_op_group, current_op, op_group_index, op_index|\n Application.where({ \"_id\" => current_app._id, \"pending_op_groups.#{op_group_index}._id\" => current_op_group._id, \"pending_op_groups.#{op_group_index}.pending_ops.#{op_index}._id\" => current_op._id }).update({\"$set\" => { \"pending_op_groups.#{op_group_index}.pending_ops.#{op_index}.state\" => new_state }})\n end\n # set the state in the object in mongoid memory for access by the caller\n self.state = updated_op.state\n else\n self.state = new_state\n end\n end",
"def setup_rem_state\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n c = @acts[2] || 100\n c = c/100.0 if c.integer?\n if area_flag\n target_array.each do |t|\n if chance(c)\n t.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(t)\n end\n end\n return\n end\n return unless target\n if chance(c)\n target.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(target)\n end\n end",
"def running?; state == 'running'; end",
"def running?; state == 'running'; end",
"def toggle(switches)\n 1.upto(1000) do |step|\n switches.map do |switch_num, on_or_off|\n if switch_num % step == 0\n switches[switch_num] = !on_or_off\n end\n end\n end\nend",
"def inactive!\n self.update_attribute(:status, INACTIVE)\n end",
"def toggle_state(state)\n @states.select { |s, _| s == state }.each do |s, v|\n v[1] = !v[1]\n classify_state v\n end\n end",
"def pause_processing\n @processing = false\n end",
"def stopped!\n self.update_attribute(:status, States::STOPPED)\n end",
"def update\n\n @batch = Batch.find(params[:id])\n\n @batch.phing = true\n if @batch.update(batch_params)\n flash[:notice] = 'Batch was successfully updated.'\n redirect_to(no_experiment_batches_phs_path)\n else\n render :action => \"edit\"\n end\n\n end",
"def sweep_inactive_records!\n refresh_state = set_sweeping_started!\n\n sweep_scope_refresh_state = if sweep_scope.kind_of?(Array)\n sweep_scope\n elsif sweep_scope.kind_of?(Hash)\n sweep_scope.map {|k, v| [k, v.size]}\n end\n update(\n refresh_state,\n :status => :waiting_for_refresh_state_parts,\n :total_parts => total_parts,\n :sweep_scope => sweep_scope_refresh_state\n )\n\n if total_parts == refresh_state.refresh_state_parts.count\n start_sweeping!(refresh_state)\n else\n wait_for_sweeping!(refresh_state)\n end\n rescue StandardError => e\n update(refresh_state, :status => :error, :error_message => \"Error while sweeping: #{e.message.truncate(150)}\")\n\n raise(e)\n end",
"def toggle\n\t\t@gridOn = !@gridOn\n\tend",
"def toggle!\n self.featured = !self.featured\n save\n end",
"def run!\n @state = :running\n end",
"def make_inactive\n self.status = \"I\"\n end",
"def fix_bikes\n @bikes.each { |bike| bike.working = true }\n end",
"def toggle_status\n @judge = Judge.find(params[:id])\n authorize @judge\n\n if @judge.active?\n @judge.update_attribute(:status, \"removed\")\n else\n @judge.update_attribute(:status, \"active\")\n end\n redirect_back(fallback_location: result_competition_path(@judge.competition))\n end",
"def mark_as_offensive\n self.update_attribute(:status, 1)\n end",
"def set_across_pool_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"def toggle!\n if self.active?\n self.stop!\n else\n self.start!\n end\n end",
"def make_active\n self.status = \"A\"\n end",
"def active!\n self.update_attribute(:status, ACTIVE)\n end",
"def change!\n @alive = !@alive\n end",
"def make_inactive\n self.active = false\n self.save!\n end",
"def make_inactive\n self.active = false\n self.save!\n end",
"def toggle_cell_state(cell, live_n)\n if cell\n if live_n == 2 || live_n == 3\n true\n else\n false\n end\n else\n live_n == 3\n end\n end",
"def switch_state state\n\t\t\t@state_buffer = Proc.new do\n\t\t\t\t@objs2 = []\n\t\t\t\t@current_state = state\n\t\t\t\t@current_state.setup\n\t\t\tend\n\t\tend",
"def live\r\n @state=1\r\n end",
"def set_status_to_pending\n self.status = :pending\n end",
"def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend",
"def setup_rem_state\n return unless PONY::ERRNO::check_sequence(current_act)\n current_action_targets.each do |target|\n state_id = @acts[1]\n chance = @acts[2] || 100\n chance = chance / 100.0 if c.integer?\n target.remove_state(state_id) if rand < chance\n end\n end",
"def mark_for_processing\n update_attributes(processing: true)\n end",
"def update_status\r\n self.reload\r\n jobs = self.jobs\r\n complete_jobs = get_complete_jobs(jobs, JobStatus::COMPLETED, ProcessorStatus::COMPLETED) \r\n incomplete_jobs = get_complete_jobs(jobs, JobStatus::INCOMPLETED, ProcessorStatus::INCOMPLETED) unless self.facility.client.name == 'UNIVERSITY OF PITTSBURGH MEDICAL CENTER'\r\n incomplete_jobs = get_upmc_incomplete_jobs(jobs, JobStatus::INCOMPLETED) if self.facility.client.name == 'UNIVERSITY OF PITTSBURGH MEDICAL CENTER'\r\n complete_output_ready_jobs = get_output_ready_jobs(jobs, JobStatus::COMPLETED, ProcessorStatus::COMPLETED, QaStatus::COMPLETED) \r\n incomplete_output_ready_jobs = get_output_ready_jobs(jobs, JobStatus::INCOMPLETED, ProcessorStatus::INCOMPLETED, QaStatus::INCOMPLETED)\r\n\r\n excluded_jobs = jobs.select do |job|\r\n job.job_status.upcase == JobStatus::EXCLUDED\r\n end\r\n \r\n new_jobs = jobs.select do |job|\r\n job.job_status == JobStatus::NEW\r\n end\r\n\r\n allocated_jobs = jobs.select do |job|\r\n job.job_status == JobStatus::PROCESSING\r\n end\r\n\r\n excluded_processing_or_new_jobs = jobs.select do |job|\r\n ((job.job_status == JobStatus::NEW || job.job_status == JobStatus::PROCESSING) &&\r\n job.is_excluded == true)\r\n end\r\n\r\n previous_status = self.status\r\n if jobs.size == new_jobs.size or jobs.size == 0\r\n self.status = BatchStatus::NEW\r\n self.completion_time = nil\r\n elsif jobs.size == (complete_output_ready_jobs.size + excluded_jobs.size +\r\n incomplete_output_ready_jobs.size + excluded_processing_or_new_jobs.size)\r\n self.completion_time = Time.now\r\n self.status = BatchStatus::OUTPUT_READY\r\n elsif jobs.size == (complete_jobs.size + excluded_jobs.size +\r\n incomplete_jobs.size + excluded_processing_or_new_jobs.size)\r\n self.completion_time = Time.now\r\n self.status = BatchStatus::COMPLETED\r\n else\r\n self.status = BatchStatus::PROCESSING\r\n self.completion_time = nil\r\n end\r\n if previous_status == BatchStatus::NEW && self.status == BatchStatus::PROCESSING &&\r\n self.processing_start_time.blank?\r\n self.processing_start_time = Time.now\r\n end\r\n if previous_status == BatchStatus::PROCESSING && self.status == BatchStatus::COMPLETED\r\n self.processing_end_time = Time.now\r\n end\r\n set_qa_status\r\n self.save \r\n end",
"def toggle_status # Toggle status method that negates the completed? method above\n @completed_status = !completed?\n end",
"def deactivate!\n update(status: false)\n end",
"def sweep_stairs\n turn_off\n end",
"def apply(iteration)\n load_ps_table\n return if @ps_table.empty?\n\n @gears.ids.each do |uuid|\n begin\n state = @gears.state(uuid)\n #pids = pgrep(uuid)\n pids = ps(uuid)\n\n case state\n when State::NEW\n # Caught gear while being created... leave it alone.\n\n when State::UNKNOWN\n @logger.info %Q(watchman gear #{uuid} in unknown state, will be restarted.)\n restart(uuid)\n\n when State::STOPPED\n stop(uuid) unless pids.empty?\n\n when State::IDLE\n idle(uuid) unless pids.empty?\n\n else\n # Gear has a stop_lock file and a state of running... remove stop_lock\n if @gears.stop_lock?(uuid)\n FileUtils.rm_f(@gears.stop_lock(uuid))\n Syslog.info %Q(watchman deleted stop lock for gear #{uuid} because the state of the gear was #{state})\n end\n\n restart(uuid) if pids.empty?\n end\n rescue Exception => e\n Syslog.info %Q(watchman GearStatePlugin failed for gear #{uuid}: #{e.message}. Processing remaining gears.)\n @logger.info %Q(#{e.message}\\n#{e.backtrace.join(\"\\n\")})\n end\n end\n\n @ps_table = nil # free resources\n end",
"def states\n no_set_states + set_bonuses\n end",
"def set_state(state)\n stop if state == :error and [:initializing, :ready, :running_sm].include? resource_status\n record.set_state(state)\n end",
"def update_active\n\t\tif self.changed.include? 'active' and !self.changed.include? 'on_bookshelf' and !self.active\n\t\t\tself.on_bookshelf = \"false\" #required for postgres\n\t\tend\n\tend",
"def reset_statuses\n @player1.deuce = false\n @player2.deuce = false\n @player1.advantage = false\n @player2.advantage = false\n end",
"def update_processes\n return true if set_later?\n return true if using_skill?\n return true if gaining_exp?\n return true if update_screen\n end",
"def activate!\n self.update_attributes(status: ACTIVE)\n #self.line_items.update_attributes(status: LineItem::SOLD)\n end",
"def reset_marking_states(assessment_id)\n Result.joins(submission: :grouping)\n .where('submissions.submission_version_used': true, 'groupings.assessment_id': assessment_id)\n .each do |result|\n result.update(marking_state: Result::MARKING_STATES[:incomplete])\n end\n end",
"def pause!\n @state = :paused\n end",
"def groom_batch_collection(batch_collection)\n # feature flipper\n if Features.inactive?(:batching)\n return\n end\n batch_collection.batch_collection_line_items.active.each do |bcli|\n # if item is shipped or cancelled kick it out\n if bcli.line_item.order&.shipment&.shipped_at.present? || bcli.line_item.order&.shipment&.tracking.present? || bcli.line_item&.order.state == 'canceled'\n bcli.delete\n end\n\n if batch_collection.status == 'open'\n if (Time.now+DELIVERY_DAYS_THRESHOLD.days) > bcli.projected_delivery_date\n # this thing is within N days...release it to be made\n bcli.delete\n end\n end\n end\n end",
"def next_batch()\n @mutex.lock\n begin\n state_check.slice!(0, state_check.length) + pending.slice!(0,pending.length)\n ensure\n @mutex.unlock rescue nil\n end\n end",
"def inactive!\n self.active = false\n save!\n end",
"def set_active_inactive\n to_set_inactive = (EvaluationTemplate.where.not(id: self.id)).\n where(active: true).where(quarter_id: self.quarter_id)\n if self.active?\n to_set_inactive.each { |t| t.update_attributes(active: false) }\n end\n end",
"def toggle_completed\n update completed: !completed\n completed\n end",
"def toggle\n @done = !@done\n end",
"def set_state_left\n session[:state] = [0,0,0,0,0,0,0,0,0,0,1,0,0,0,0]\n flash[:success] = 'State changed successfully.'\n redirect_to action: 'show'\n end",
"def test_more_than_one_pause_when_stopping\n stqe = @session.jobs['stqe']\n mail = @session.jobs['misc. email']\n\n stqe_start = @now\n start(stqe)\n assert_states([stqe], [])\n assert_new_record 1, stqe, stqe_start\n mail_start = @now\n start(mail)\n assert_states([mail], [stqe])\n assert_new_record 2, mail, mail_start\n pause\n assert_states([], [mail, stqe])\n stop(stqe)\n assert_states([], [mail])\n assert_stopped_with(1, 1.minute)\n stop(mail)\n assert_states([], [])\n assert_stopped_with(2, 1.minute)\n end",
"def activeG(g, gi, gv)\n state(ACTIVATEDG, g, gi, gv) and\n not f(g, gi, gv) and\n not satisfiedG(g, gi, gv) and\n not terminalG(g, gi, gv) and\n not state(SUSPENDEDG, g, gi, gv)\nend",
"def sdk_update_status(instance)\n if raw_power_state != instance.status\n update!(:raw_power_state => instance.status) if raw_power_state != instance.status\n $ibm_cloud_log.info(\"VM instance #{instance.id} state is #{raw_power_state}\")\n end\n end",
"def sdk_update_status(instance)\n if raw_power_state != instance.status\n update!(:raw_power_state => instance.status) if raw_power_state != instance.status\n $ibm_cloud_log.info(\"VM instance #{instance.id} state is #{raw_power_state}\")\n end\n end",
"def activate\n self.status = 'current'\n self.save\n end",
"def activate!\n update_attribute(:status, STATUS[:active])\n end",
"def inactivate_all! records\n records.update_all(active: false)\n end",
"def pending!\n self.update_attribute(:status, PENDING)\n end",
"def working\n current_user.chef.toggle(:currently_working).save\n end",
"def toggle_on_or_off(lights)\n 1.upto(lights.size) do |round_number|\n lights.each do |position, value|\n if position % round_number == 0\n value == \"off\" ? lights[position] = \"on\" : lights[position] = \"off\"\n end\n end\n end\nend",
"def pbToggleFollowingPokemon\n if $game_switches[Following_Activated_Switch]==true\n if $game_switches[Toggle_Following_Switch]==true\n $PokemonTemp.dependentEvents.remove_sprite(true)\n pbWait(1)\n $game_switches[Toggle_Following_Switch]=false\n else\n $FollowingFinishedSurfing = false\n $PokemonTemp.dependentEvents.refresh_sprite\n pbWait(1)\n $game_switches[Toggle_Following_Switch]=true\n end\n end\nend",
"def reactivate(c, ci, de, cr, cv)\n if state(COMMITMENT, c, ci, de, cr) and state(PENDING, c, ci, cv)\n apply([], [[PENDING, c, ci, cv]])\n end\nend",
"def toggle_faulty\n @item.toggle!(:faulty)\n end",
"def toggle_step_by_step\n @step_by_step = !@step_by_step\n end",
"def sweep_stairs\n climb_stair\n pick_beeper\n climb_stair\n pick_beeper\n climb_stair\n pick_beeper\n turn_off\n end",
"def set_to_pending(operations)\n operations.each do |op|\n op.set_status_recursively('pending')\n end\n end",
"def restart\n @lives == 5\n @gold_coins == 0\n @health_points == 10\n end",
"def set_state(new_state)\n failure_message = \"Failed to set pending_op #{self._id.to_s} state to #{new_state.to_s} for domain #{self.domain.namespace}\"\n updated_op = update_with_retries(5, failure_message) do |current_domain, current_op, op_index|\n Domain.where({ \"_id\" => current_domain._id, \"pending_ops.#{op_index}._id\" => current_op._id }).update({\"$set\" => { \"pending_ops.#{op_index}.state\" => new_state }})\n end\n\n # set the state in the object in mongoid memory for access by the caller\n self.state = updated_op.state\n end",
"def upload_state\n 0.upto(ROWS - 1) do |row|\n 0.upto(COLUMNS - 1) do |column|\n state = @cell_state[row * ROWS + column]\n @lp.set_led_colors(column, row, *@colors[state])\n end\n end\n @lp.set_led_colors(0, -1, *((@iteration % 2) == 0) ? [1,3] : [3,3])\n @lp.update\n @lp.flip_buffers\n end",
"def deactivate_electives\n [5, 6, 15, 16, 18, 19, 20, 21, 23, 24].each{|n| e = Elective.find(n); e.active = false; e.save!}\nend",
"def update_appeal_state_on_status_change\n update_appeal_state_when_ihp_cancelled\n update_appeal_state_when_ihp_completed\n update_appeal_state_when_privacy_act_cancelled\n update_appeal_state_when_privacy_act_complete\n update_appeal_state_when_appeal_cancelled\n end",
"def enter_pending\n update_attribute(:status, :pending)\n end",
"def state_ontable_lessplayers\n @log.debug(\"Net_state: change to state state_ontable_lessplayers\")\n @network_state = :state_ontable_lessplayers\n make_state_change_ntfy(:ntfy_state_ontable_lessplayers)\n end",
"def activate!\n self.metadata[:inactive] = nil\n self.metadata.save\n end",
"def checkin\n update_attributes(:occupied => false)\n end",
"def closed\n update_attribute(:status, false)\n end",
"def toggle\n @raid.toggle\n redirect_to :back\n end",
"def release_lock_and_update_status_for_non_processed_hooks\n\n @hooks_to_be_processed.each do |hook|\n\n failed_hook_to_be_retried = @failed_hook_to_be_retried[hook.id]\n hook.mark_failed_to_be_retried(failed_hook_to_be_retried) if failed_hook_to_be_retried.present?\n\n failed_hook_to_be_ignored = @failed_hook_to_be_ignored[hook.id]\n hook.mark_failed_to_be_ignored(failed_hook_to_be_ignored) if failed_hook_to_be_ignored.present?\n\n end\n\n end",
"def inactive!\n @active.update { |_| false }\n end",
"def set_status\n self.status = 1\n end",
"def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end",
"def test_update_status\n batch = batches(:batch4)\n job_one = Job.create(:batch=>batch,:tiff_number=>1234,:check_number=>12131,:count=>12, :job_status => 'Complete', :estimated_eob => 12)\n job_two = Job.create(:batch=>batch,:tiff_number=>1231,:check_number=>12135,:count=>12, :job_status => 'Allocated', :estimated_eob => 12)\n\n # Check for complete\n job_two.job_status = 'Complete'\n job_two.update\n\n batch.update_status\n assert_equal 'Complete', batch.status\n assert_in_delta(batch.completion_time.to_i, Time.now.to_i,1)\n\n # Check for processing\n job_one.job_status = 'Processing'\n job_one.update\n batch.update_status\n assert_equal('Processing', batch.status)\n assert_nil batch.completion_time\n\n # Check for new\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'New'\n job_two.update\n batch.update_status\n assert_equal 'New', batch.status\n assert_nil batch.completion_time\n\n # one new and one complete\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # QA Rejected\n job_one.job_status = 'QA Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # one HLSC Rejected and the other Complete\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n job_one.job_status = 'Complete'\n job_one.update\n batch.update_status\n assert_equal 'Complete', batch.status\n\n # All HLSC Verified\n job_one.job_status = 'HLSC Verified'\n job_one.update\n job_two.job_status = 'HLSC Verified'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Verified', batch.status\n\n # One HLSC Rejected and one processor allocated\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n end",
"def activate\n self.status = \"Active\"\n end",
"def is_active \n\t\tif self.servings == 0\n\t\t\tself.active = false\n\t\tend\n\t\tactive\n\tend",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def toggle_availability\n if @chef.availability == true\n @chef.availability = false\n else\n @chef.availability = true\n end\n end",
"def update_item_state(item_id, state)\n !send_pairwise_request(\"items/#{item_id}/#{state ? 'activate' : 'suspend'}\", nil, 'Get').nil?\n end"
] |
[
"0.57321",
"0.56141716",
"0.5576303",
"0.5532392",
"0.5487746",
"0.5316877",
"0.5314602",
"0.5292675",
"0.5278602",
"0.5269668",
"0.5249165",
"0.5244038",
"0.52401143",
"0.52401143",
"0.5238586",
"0.5234495",
"0.52183086",
"0.520716",
"0.51762766",
"0.5169967",
"0.5159385",
"0.5156579",
"0.5156102",
"0.5148058",
"0.5147794",
"0.51427984",
"0.5139108",
"0.5127708",
"0.512536",
"0.5112669",
"0.50885737",
"0.5079177",
"0.5077268",
"0.5062988",
"0.5062988",
"0.50582576",
"0.50549126",
"0.50487214",
"0.5046079",
"0.5041311",
"0.502924",
"0.501865",
"0.500696",
"0.50044745",
"0.5003816",
"0.49947456",
"0.49930292",
"0.49930048",
"0.49913913",
"0.4986581",
"0.4984171",
"0.49635142",
"0.49627",
"0.49625975",
"0.49411267",
"0.49342588",
"0.49310806",
"0.4929117",
"0.49282667",
"0.49244627",
"0.49192974",
"0.49184358",
"0.49180534",
"0.49032244",
"0.49028707",
"0.49028707",
"0.49026102",
"0.48996198",
"0.48891035",
"0.48861086",
"0.48855406",
"0.4884345",
"0.4882138",
"0.48810583",
"0.48806614",
"0.4880285",
"0.48793295",
"0.48788515",
"0.48784706",
"0.48781562",
"0.48701584",
"0.48670062",
"0.48649257",
"0.48629463",
"0.48624116",
"0.48580185",
"0.48554027",
"0.48531336",
"0.4850044",
"0.48496956",
"0.4848886",
"0.4839874",
"0.48366302",
"0.4836108",
"0.48323098",
"0.48294753",
"0.4828872",
"0.4828872",
"0.4826642",
"0.4824123"
] |
0.6563227
|
0
|
GET /locationtypes GET /locationtypes.json
|
def index
@locationtypes = Locationtype.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def locations\n get('locations')\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 index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\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 get_location\n as_json(get_results('/locations.json'))\n end",
"def resourceType\n 'Location'\n end",
"def get_nearby_places_bytypes(lat, lng, type, options={})\n get_info_fromjson = GetInfoFromJson.new\n\n url_params = { :location => \"#{lat},#{lng}\", :types => type, :key => @api_key, :rankby => \"distance\", :language => \"ja\" }\n url = set_params(@base_url, url_params)\n \n res = http_get(url)\n\n places = get_info_fromjson.get_places_info(res, 3)\n\n return places\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def locations(place)\n get :loc => place\n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end",
"def places_kinds\n render json: Place.places_kinds\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def locations(query = {})\n get('location', query)\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\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 index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def location_type\n return @location_type\n end",
"def location_type=(value)\n @location_type = value\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 pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\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 index\n @route_types = RouteType.all\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n render json: usage(params[:type])\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def location_primer\n render(json: location_list)\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"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 lookup(type)\n @resource_types[type] || []\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 index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def type\n fetch('restaurant.type')\n end",
"def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def locationtype_params\n params.require(:locationtype).permit(:name, :icon_id, :icon_url, :insideR, :nearR)\n end",
"def query\n { :locations => [] }\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n @clothing_types = ClothingType.all\n end",
"def index\n @student_types = StudentType.all\n\n render json: @student_types\n end",
"def index\n @cloth_types = ClothType.all\n end",
"def sites_of_a_type(type, url, site_list)\n get_geo_info(url)['results'].map do |site|\n site_info = {}\n site_info['location'] = site['geometry']['location']\n site_info['types'] = type\n site_info['name'] = site['name']\n site_info['address'] = site['vicinity']\n site_list << site_info\n end\n site_list\n end",
"def search\n authorize! :show, PointsEntryType\n search_points_entry_types\n\n respond_to do |format|\n #format.html # actually, no.\n format.json {\n render json: @points_entry_types.select([:id, :name, :default_points])\n }\n end\n end",
"def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end",
"def base_uri\n \"#{api}/map_type\"\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def index\n @locations = Spree::Location.all\n end",
"def set_location_type\n @location_type = LocationType.find(params[:id])\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @trait_types = TraitType.all\n\n render json: @trait_types\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 @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def set_locationtype\n @locationtype = Locationtype.find(params[:id])\n end",
"def index\n @types = Type.all\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def selected_type\n PLACE_TYPE.reduce({}) do |url_list, type|\n url_with_type = \"#{url}&types=#{type}\"\n url_list.update(type => url_with_type)\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 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 @specific_locations = SpecificLocation.all\n end",
"def list_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true)\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\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @locations = Location.all\n\n respond_with(@locations)\n end",
"def index\n \tresolve_type\n\t\tif @search_type == :nearby and !GeoLocation.known_position? and (@params[\"lat\"].nil? and @params[\"long\"].nil?)\n\t\t\tnavbar :title => \"Nearby\"\n\t\t\tGeoLocation.set_notification( url_for(:action => :nearby_geo_callback1), default_query_hash_str, GeoTimeout)\n\t\t\tredirect_for_type :action => :wait, :query => { :message => \"Finding your location...\" }\n\t\telsif @search_type == :nearby and GeoLocation.known_position?\n\t\t\tlat = GeoLocation.latitude\n\t\t\tlong = GeoLocation.longitude\n\t\t\tredirect_for_type(:action => :geocode_other_location, :query => {:lat => lat, :long => long})\n\t\telsif @search_type == :location and @params[\"lat\"] and @params[\"long\"] and @params[\"other_location\"]\n\t\t\tredirect_for_type(:action => :listing, :query => @params)\n\t\telsif @search_type == :location\n\t\t\tredirect_for_type(:action => :input_other_location) \n\t\telsif @search_type == :recent and @params[\"search_id\"]\n\t\t\tredirect_for_type(:action => :listing, :query => { :search_id => @params[\"search_id\"] })\n\t\telsif @search_type == :recent \n\t\t\tredirect_for_type(:action => :recent)\n\t\telse\n\t\t\tredirect_for_type(:action => :error) \n\t\tend\n\t\t@message = \"Processing...\"\n\t\trender :wait # Show the waitpage, when complete we will be redirected to listing\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n authorize! :show, PointsEntryType\n load_active_points_entry_types\n\n respond_to do |format|\n format.html\n format.json { render json: @points_entry_types }\n end\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 get_restaurants(location)\n latitude, longitude = convert_location(location)\n\n food_query = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"/maps/api/place/nearbysearch/json\",\n :query_values => {:location => \"#{latitude},#{longitude}\",\n :radius => \"#{get_distance}\",\n :types => \"food\",\n :key => \"#{KEY}\",\n :sensor => \"false\",\n :keyword => \"#{get_food_kind}\"}\n )\n food_query_json = RestClient.get(food_query.to_s)\n JSON.parse(food_query_json)[\"results\"]\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 getTypeUrlFromTypesObject(types)\n return types.map {|x| x['type']['url']}.compact\nend",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def locations\n @client.get('/BikePoint')\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n authorize CarrierType\n @carrier_types = CarrierType.order(:position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @carrier_types }\n end\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def select_locations\n if params[:status] == \"pending\"\n @locations = Location.where(status: \"pending\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n elsif params[:status] == \"accepted\"\n @locations = Location.where(status: \"accepted\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n elsif params[:status] == \"declined\"\n @locations = Location.where(status: \"declined\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n elsif params[:status] == \"all\"\n @locations = Location.all.order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n else\n @locations = Location.where(status: \"pending\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def type\n @json['type']\n end",
"def index\n @poi_types = PoiType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poi_types }\n end\n end",
"def location\n result = params[:type].downcase.capitalize\n return result unless params[:only]\n result << ' - '\n result << params[:only].downcase.capitalize\n result\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end"
] |
[
"0.7352875",
"0.6842212",
"0.6791823",
"0.6775262",
"0.6714413",
"0.6421152",
"0.6300943",
"0.62888527",
"0.6257442",
"0.62449807",
"0.62438124",
"0.62159",
"0.6207377",
"0.620486",
"0.62025404",
"0.619011",
"0.6183376",
"0.61257327",
"0.6096692",
"0.6096437",
"0.6079439",
"0.60726583",
"0.6064684",
"0.6035521",
"0.6031894",
"0.6024622",
"0.59785545",
"0.59742194",
"0.59670144",
"0.59633017",
"0.59610265",
"0.5944388",
"0.59025156",
"0.58915406",
"0.58789265",
"0.58720726",
"0.5870582",
"0.5860306",
"0.5856089",
"0.5854795",
"0.5847495",
"0.5846712",
"0.5834358",
"0.5809722",
"0.5804908",
"0.5803275",
"0.58001226",
"0.5800008",
"0.5797773",
"0.5788812",
"0.5787042",
"0.57828206",
"0.5770058",
"0.5769949",
"0.5769378",
"0.5766271",
"0.57594424",
"0.5749934",
"0.57487184",
"0.57457787",
"0.5745099",
"0.5745099",
"0.57369924",
"0.57355505",
"0.5735073",
"0.5734059",
"0.5728586",
"0.5710287",
"0.5708217",
"0.5707652",
"0.5703539",
"0.57007533",
"0.5692835",
"0.5685539",
"0.5674492",
"0.5669054",
"0.56646264",
"0.5660954",
"0.565692",
"0.5656598",
"0.56497693",
"0.5644079",
"0.56405246",
"0.5638563",
"0.56363755",
"0.5620861",
"0.5618526",
"0.5610855",
"0.56076777",
"0.5607418",
"0.5604712",
"0.5604115",
"0.56029844",
"0.55965734",
"0.5595197",
"0.5594177",
"0.55893755",
"0.5585817",
"0.55795115",
"0.5577184"
] |
0.7234389
|
1
|
GET /locationtypes/1 GET /locationtypes/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def index\n @locationtypes = Locationtype.all\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\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 locations\n get('locations')\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def get_location\n as_json(get_results('/locations.json'))\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 render json: usage(params[:type])\n end",
"def resourceType\n 'Location'\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def set_location_type\n @location_type = LocationType.find(params[:id])\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def set_locationtype\n @locationtype = Locationtype.find(params[:id])\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def type\n fetch('restaurant.type')\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def location_type=(value)\n @location_type = value\n end",
"def location_type\n return @location_type\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def get_nearby_places_bytypes(lat, lng, type, options={})\n get_info_fromjson = GetInfoFromJson.new\n\n url_params = { :location => \"#{lat},#{lng}\", :types => type, :key => @api_key, :rankby => \"distance\", :language => \"ja\" }\n url = set_params(@base_url, url_params)\n \n res = http_get(url)\n\n places = get_info_fromjson.get_places_info(res, 3)\n\n return places\n end",
"def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end",
"def base_uri\n \"#{api}/map_type\"\n end",
"def locations(place)\n get :loc => place\n end",
"def type\n @json['type']\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\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 show\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl_type }\n end\n end",
"def location_type_id\n f1_type = F1::AddressType.where(id: self.address_type_id).take\n return if f1_type.nil?\n\n location_type = CIVICRM::LocationType.where(name: f1_type.name).take\n return if location_type.nil?\n\n location_type.id\n end",
"def places_kinds\n render json: Place.places_kinds\n end",
"def show\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation_type }\n end\n end",
"def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def location_primer\n render(json: location_list)\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_have_location }\n end\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @location }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n render json: Location.find(params[\"id\"])\n end",
"def index\n @student_types = StudentType.all\n\n render json: @student_types\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def new\n klass = (params[:type] || \"Location\").constantize\n klass = Location unless klass.new.is_a?(Location)\n @location = klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def new\n @location = Location.new\n @nameSent = (params[:type])\n @location.city ||= (session[:start_loc]) \n @location.city2 ||= (session[:end_loc]) \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def create\n @locationtype = Locationtype.new(locationtype_params)\n\n respond_to do |format|\n if @locationtype.save\n format.html { redirect_to @locationtype, notice: 'Locationtype was successfully created.' }\n format.json { render :show, status: :created, location: @locationtype }\n else\n format.html { render :new }\n format.json { render json: @locationtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def index\n @route_types = RouteType.all\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def new\n @location = Location.new\n @location.contacts = [{:phone => [{}]}]\n @types = Type.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end",
"def show\n render json: @language_type\n end",
"def index\n @types = Type.all\n end",
"def locationtype_params\n params.require(:locationtype).permit(:name, :icon_id, :icon_url, :insideR, :nearR)\n end",
"def index\n @clothing_types = ClothingType.all\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 show\n @area_type = AreaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_type }\n end\n end",
"def show\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_type }\n end\n end",
"def search\n authorize! :show, PointsEntryType\n search_points_entry_types\n\n respond_to do |format|\n #format.html # actually, no.\n format.json {\n render json: @points_entry_types.select([:id, :name, :default_points])\n }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @typegroup }\n end\n end",
"def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def show\r\n @location = Location.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @location }\r\n end\r\n end",
"def index\n @cloth_types = ClothType.all\n end",
"def index\n @food_type_id = @foodTypes.first\n\n if params['type']\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: params['type']['type_id']).paginate(page: params[:page])\n else\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: @food_type_id).paginate(page: params[:page])\n end\n\n respond_with @foods\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def show\n @agency_type = AgencyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agency_type }\n end\n end",
"def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end",
"def location_type_id\n addr_type = ALF::AddressType.where('address_type_id', self.address_type).first\n return if addr_type.nil?\n\n location_type = CIVICRM::LocationType.where(name: addr_type.name).take\n return if location_type.nil?\n\n location_type.id\n end",
"def search_mappings_get_with_http_info(type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SearchApi.search_mappings_get ...\"\n end\n # verify the required parameter 'type' is set\n if @api_client.config.client_side_validation && type.nil?\n fail ArgumentError, \"Missing the required parameter 'type' when calling SearchApi.search_mappings_get\"\n end\n # resource path\n local_var_path = \"/search/mappings/{type}\".sub('{' + 'type' + '}', type.to_s)\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_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SearchApi#search_mappings_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def update\n respond_to do |format|\n if @locationtype.update(locationtype_params)\n format.html { redirect_to @locationtype, notice: 'Locationtype was successfully updated.' }\n format.json { render :show, status: :ok, location: @locationtype }\n else\n format.html { render :edit }\n format.json { render json: @locationtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end",
"def get_type(addr_results, type)\n addr_results.select { |comp| comp[\"types\"].index(type) != nil }.map { |comp| comp[\"long_name\"] }.first\n end"
] |
[
"0.71440804",
"0.7058667",
"0.6853073",
"0.6516962",
"0.6404254",
"0.63825464",
"0.6358858",
"0.63252574",
"0.63129234",
"0.63104516",
"0.6298388",
"0.61981046",
"0.6192654",
"0.6180567",
"0.6174054",
"0.61680275",
"0.61569387",
"0.61561114",
"0.61288524",
"0.6125784",
"0.61096305",
"0.6103223",
"0.6094327",
"0.60853595",
"0.60774004",
"0.60677624",
"0.60405177",
"0.6040449",
"0.6039425",
"0.6034331",
"0.60166126",
"0.6001731",
"0.5989359",
"0.5987039",
"0.5980837",
"0.5942585",
"0.5942454",
"0.5941259",
"0.5936168",
"0.5920525",
"0.5886158",
"0.58739305",
"0.5871182",
"0.5869707",
"0.58630747",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5854599",
"0.5847012",
"0.5845635",
"0.58378434",
"0.58378434",
"0.583634",
"0.58346266",
"0.5833013",
"0.58325404",
"0.5830714",
"0.5823772",
"0.58189553",
"0.58182245",
"0.5816031",
"0.5814304",
"0.5810354",
"0.5809676",
"0.57903004",
"0.57871914",
"0.5786864",
"0.5786246",
"0.5782876",
"0.5782876",
"0.5781065",
"0.5781064",
"0.57801074",
"0.5778579",
"0.57775855",
"0.5773396",
"0.5772476",
"0.57693076",
"0.57598686",
"0.57586163",
"0.5757453",
"0.5752173",
"0.5749977",
"0.57467467",
"0.574133",
"0.5740654",
"0.574048",
"0.5739268",
"0.573915",
"0.5735672",
"0.5731328",
"0.57262516",
"0.572516",
"0.572067",
"0.57168186"
] |
0.0
|
-1
|
POST /locationtypes POST /locationtypes.json
|
def create
@locationtype = Locationtype.new(locationtype_params)
respond_to do |format|
if @locationtype.save
format.html { redirect_to @locationtype, notice: 'Locationtype was successfully created.' }
format.json { render :show, status: :created, location: @locationtype }
else
format.html { render :new }
format.json { render json: @locationtype.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end",
"def locationtype_params\n params.require(:locationtype).permit(:name, :icon_id, :icon_url, :insideR, :nearR)\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 location_type=(value)\n @location_type = value\n end",
"def index\n @locationtypes = Locationtype.all\n end",
"def set_location_type\n @location_type = LocationType.find(params[:id])\n end",
"def create\n @location = Location.new(params[:location])\n \n @location.location = current_location\n @location.location_type = \"shelf\"\n \n respond_to do |format|\n if @location.save\n format.html { redirect_to current_location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @travel_type = TravelType.new(params[:travel_type])\n\n respond_to do |format|\n if @travel_type.save\n format.html { redirect_to @travel_type, :notice => 'Travel type was successfully created.' }\n format.json { render :json => @travel_type, :status => :created, :location => @travel_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @travel_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_locationtype\n @locationtype = Locationtype.find(params[:id])\n end",
"def location_params\n params.require(:location).permit(:name, :location_type, :parent_id, :default_item_type_id)\n end",
"def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end",
"def location_params\n params.require(:location).permit(:location, :zone, :type, :dept, :subdept)\n end",
"def create\n @location = Location.new(params[:location])\n @location.save \n @hide_map = true\n if params[:subcategories] \n params[:subcategories].uniq.each do |subcategory| \n s = Subcategory.where(id: subcategory[:id]).first\n @location.subcategories << s if s\n end\n end\n respond_to do |format|\n if @location.valid?\n format.html { redirect_to @location, :notice => 'Location was successfully created.' }\n format.json { render :json => @location, :status => :created, :location => @location }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @location = Location.new(params[:location])\r\n\r\n respond_to do |format|\r\n if @location.save\r\n format.json { render json: @location, status: :created, location: @location }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @regions = Region.all\n @location = Location.new(location_params)\n\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.save\n @location.create_stat\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cfr_location_type_params\n params.require( :cfr_location_type ).permit(\n :label, :location_type, :path_prefix, :concat_char, :project_dms, :note )\n end",
"def create\n klass = (params[:type] || \"Location\").constantize\n klass = Location unless klass.new.is_a?(Location)\n @location = klass.new(params[:location] || params[:college] || params[:high_school])\n\n respond_to do |format|\n if @location.save\n flash[:notice] = 'Location was successfully created.'\n format.html { redirect_to(@location) }\n format.xml { render :xml => @location, :status => :created, :location => @location }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @observation_type = ObservationType.new(params[:observation_type])\n\n respond_to do |format|\n if @observation_type.save\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully created.' }\n format.json { render json: @observation_type, status: :created, location: @observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def locality_type_params\n params.require(:locality_type).permit(:name,\n :locality_types => [])\n end",
"def create\n @curpg = :admintools\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Spree::Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_type = StudentType.new(student_type_params)\n\n if @student_type.save\n render json: @student_type, status: :created, location: @student_type\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end",
"def location_params\n params.require(:location).permit(:name, :regions)\n end",
"def create\n @location = Location.new(location_params)\n\n if @location.save \n render :json => { status: :created, location: @location }\n else\n render :json => { errors: @location.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @route_type = RouteType.new(route_type_params)\n\n respond_to do |format|\n if @route_type.save\n format.html { redirect_to @route_type, notice: 'Route type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @route_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @route_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_type = LanguageType.new(language_type_params)\n\n if @language_type.save\n render json: @language_type, status: :created, location: @language_type\n else\n render json: @language_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n @site_type = SiteType.new(params[:site_type])\n @site_type.section_type_ids = section_type_ids\n\n respond_to do |format|\n if @site_type.save\n format.html { redirect_to @site_type, notice: 'Site type was successfully created.' }\n format.json { render json: @site_type, status: :created, location: @site_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location_params\n params.require(:location).permit([:name])\n end",
"def resourcetype_params\n\t\t params.require(:resourcetype).permit(:name, :regenerating, :location)\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n\tlogger.info \"location saved successfully\"\n\tlogger.info @location.to_json\n format.html { redirect_to @location, :notice => 'Location was successfully created.' }\n format.json { render :json => @location }\n else\n\tlogger.info \"error saving location\"\n format.html { render :action => \"new\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def location_params\n params.require(:location).permit(:name, :address, :location_type, :rfs_status, :rfs_date, :home_passed, :home_connected)\n end",
"def create\n @location = Location.new(params[:location]) \n # transale address into lat/long\n lat, long = Geocoder.coordinates(@location.full_address) \n \n response = get_place_report(params[:location], long, lat)\n @location.reference = response[\"reference\"]\n @location.general_type = get_general_type(params[:location][:types])\n respond_to do |format|\n if @location.save \n format.html { redirect_to(@location, :notice => 'Location was successfully created.') }\n format.xml { render :xml => @location, :status => :created, :location => @location } \n else\n @pages = {}\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def location_params\n params.require(:location).permit(:name, :website, :phone, :email,\n :address_1, :address_2, :city, :zip, :state, :handicap_status,\n :hunting_area_size, :terrain, :submitter_notes, :featured_image,\n species_ids: [], weapon_type_ids: [], category_ids: [])\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created }\n else\n format.html { redirect_to root_path, notice: 'Please fill in all fields!' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @identifier_type = IdentifierType.new(params[:identifier_type])\n\n respond_to do |format|\n if @identifier_type.save\n format.html { redirect_to @identifier_type, :notice => t('controller.successfully_created', :model => t('activerecord.models.identifier_type')) }\n format.json { render :json => @identifier_type, :status => :created, :location => @identifier_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @identifier_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @typeofstatus = Typeofstatus.new(typeofstatus_params)\n\n respond_to do |format|\n if @typeofstatus.save\n format.html { redirect_to @typeofstatus, notice: 'Typeofstatus was successfully created.' }\n format.json { render :show, status: :created, location: @typeofstatus }\n else\n format.html { render :new }\n format.json { render json: @typeofstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to locations_path, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flat_type_params\n params.require(:flat_type).permit(:name, :area, :status)\n end",
"def create\n @town_type = TownType.new(params[:town_type])\n\n respond_to do |format|\n if @town_type.save\n format.html { redirect_to(@town_type, :notice => 'Town type was successfully created.') }\n format.xml { render :xml => @town_type, :status => :created, :location => @town_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @town_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\t\n\t\n\t\n respond_to do |format|\n if @location.save\n format.html { redirect_to admin_locations_url(:site => current_site.id), notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: admin_locations_url(:site => current_site.id) }\n else\n \n \tset_site_entities @location\n \t\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @area_type = AreaType.new(params[:area_type])\n\n respond_to do |format|\n if @area_type.save\n format.html { redirect_to @area_type, notice: 'Area type was successfully created.' }\n format.json { render json: @area_type, status: :created, location: @area_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.'}\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render action: 'show', status: :created, location: @location }\n else\n format.html { render action: 'new' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @locationtype.update(locationtype_params)\n format.html { redirect_to @locationtype, notice: 'Locationtype was successfully updated.' }\n format.json { render :show, status: :ok, location: @locationtype }\n else\n format.html { render :edit }\n format.json { render json: @locationtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location_params\n #params[:location][:tag_names] ||= []\n #, { :tag_names=>[] }\n params.require(:location).permit(:title,\n :days,\n :city,\n :type_id,\n :price,\n :fee,\n :description,\n :address,\n :lat,\n :lng,\n :county,\n :collection_id,\n :front_page,\n :upload,\n :tag_names,\n :other_extras_comment,\n :other_services_comment,\n :uploads,\n { :uploads_attributes=>[ :_destroy, :id, :image ] },\n { :services=>[] },\n { :extras=>[] }\n )\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def location_params\n params.require(:location).permit(:location_name)\n end",
"def create\n @recipe_type = RecipeType.new(recipe_type_params)\n\n respond_to do |format|\n if @recipe_type.save\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postCategoryMappings( category_id, type, id, name)\n params = Hash.new\n params['category_id'] = category_id\n params['type'] = type\n params['id'] = id\n params['name'] = name\n return doCurl(\"post\",\"/category/mappings\",params)\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, flash: {success: \"Successfully created #{@location.name} location!\" }}\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location_params\n params.require(:location).permit(:latitude, :longitude, :address, :description, :title, :user_ids => [])\n end",
"def create\n @location = Location.new(\n name: location_params[:name],\n address_line_1: location_params[:lineOne],\n address_line_2: location_params[:lineTwo],\n lat: location_params[:lat],\n lng: location_params[:lng]\n )\n if @location.save\n render json: @location\n else\n render json: {message: 'creation failed'}\n end\n end",
"def create\n @recipe_location = RecipeLocation.new(recipe_location_params)\n\n respond_to do |format|\n if @recipe_location.save\n format.html { redirect_to @recipe_location, notice: 'Recipe location was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_location }\n else\n format.html { render :new }\n format.json { render json: @recipe_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def create\n @os_type = OsType.new(params[:os_type])\n\n respond_to do |format|\n if @os_type.save\n format.html { redirect_to @os_type, notice: 'Os type was successfully created.' }\n format.json { render json: @os_type, status: :created, location: @os_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location_have_location = LocationHaveLocation.new(params[:location_have_location])\n\n respond_to do |format|\n if @location_have_location.save\n format.html { redirect_to @location_have_location, notice: 'Location have location was successfully created.' }\n format.json { render json: @location_have_location, status: :created, location: @location_have_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_have_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state_type = StateType.new(state_type_params)\n\n respond_to do |format|\n if @state_type.save\n format.html { redirect_to @state_type, notice: 'State type was successfully created.' }\n format.json { render :show, status: :created, location: @state_type }\n else\n format.html { render :new }\n format.json { render json: @state_type.errors, status: :unprocessable_entity }\n end\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 create\n @location = @organization.locations.build(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to [@organization, @location], notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_location = ServiceLocation.new(service_location_params)\n if @service_location.save\n render json: @service_location, status: :created, location: @service_location\n else\n render json: @service_location.errors, status: :unprocessable_entity\n end \n end",
"def location_params\n params.require(:location).permit(:name)\n end",
"def location_params\n params.require(:location).permit(:name)\n end",
"def location_params\n params.require(:location).permit(:name)\n end",
"def location_params\n params.require(:location).permit(:name)\n end",
"def location_params\n params.require(:location).permit(:recip_category, :donor_type, :address, :name, :lat, :lng, :contact, :website, :admin_notes, :public_notes, :hours, :region_id, :twitter_handle, :receipt_key, :detailed_hours_json, :email, :phone, :equipment_storage_info, :food_storage_info, :entry_info, :exit_info, :onsite_contact_info, :active, :location_type)\n end",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def create\n @admin_location = Admin::Location.new(admin_location_params)\n\n respond_to do |format|\n if @admin_location.save\n format.html { redirect_to @admin_location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @admin_location }\n else\n format.html { render :new }\n format.json { render json: @admin_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @address_type = AddressType.new(params[:address_type])\n\n respond_to do |format|\n if @address_type.save\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully created.') }\n format.xml { render :xml => @address_type, :status => :created, :location => @address_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_location(name, location_type, parent_name=nil, default_item_type_name=nil)\n\t\t\tloc = Location.new\n\t\t\tloc.name = name\n\t\t\tloc.location_type = location_type\n\t\t\t\n\t\t\tif parent_name.present?\n\t\t\t\tloc.parent_id = find_location_id(parent_name)\n\t\t\tend\n\t\t\t\n\t\t\tif \tdefault_item_type_name.present?\n\t\t\t\tloc.default_item_type_id = find_item_type_id(default_item_type_name)\n\t\t\tend\n\n\t\t\tloc.save\n\t\tend",
"def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def departuretype_params\n params.require(:departuretype).permit(:departureTypes)\n end",
"def location_params\n params.require(:location).permit(:location, :open)\n end",
"def create\n @specific_location = SpecificLocation.new(specific_location_params)\n\n respond_to do |format|\n if @specific_location.save\n format.html { redirect_to @specific_location, notice: 'Specific location was successfully created.' }\n format.json { render :show, status: :created, location: @specific_location }\n else\n format.html { render :new }\n format.json { render json: @specific_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def route_type_params\n params.require(:route_type).permit(:name)\n end",
"def location_params\n params.require(:location).permit(:postal_code, :date, :postal_code)\n end",
"def create\n @user=User.find_by_id(params[:user_id])\n @location = Location.new(params[:location])\n @location.user_id = @user.uid\n @location.name = @user.name\n \n respond_to do |format|\n \n if @location.save\n format.html { redirect_to user_locations_path(@user), notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_construct_location_empty_form\n login('mary')\n post(:create_location,\n :where => '',\n :approved_where => '',\n :location => {\n :display_name => ''\n }\n )\n end",
"def location_params\n params.require(:location).permit(:loc1, :loc2, :loc3, :description)\n end",
"def create\n @gl_type = GlType.new(gl_type_params)\n\n respond_to do |format|\n if @gl_type.save\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully created.' }\n format.json { render json: @gl_type, status: :created, location: @gl_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gl_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n @location.user_id = current_user.id\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to locations_path, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n#binding.pry\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7445175",
"0.65673685",
"0.6561545",
"0.6269261",
"0.6061381",
"0.6041028",
"0.6039614",
"0.60343665",
"0.6011429",
"0.59885997",
"0.59835774",
"0.5950121",
"0.59150326",
"0.5885389",
"0.5878175",
"0.5872188",
"0.58581173",
"0.5857324",
"0.585349",
"0.5826545",
"0.5825513",
"0.580691",
"0.57926106",
"0.5783855",
"0.57735413",
"0.5743341",
"0.57225347",
"0.5703194",
"0.5698979",
"0.5693501",
"0.5693501",
"0.5693501",
"0.5693501",
"0.5683499",
"0.5666938",
"0.5658202",
"0.5643279",
"0.56412035",
"0.5639683",
"0.56319046",
"0.56263816",
"0.56163657",
"0.5610279",
"0.5606131",
"0.5598592",
"0.55880594",
"0.5587268",
"0.5583207",
"0.5576618",
"0.5576618",
"0.5576618",
"0.5576618",
"0.5576618",
"0.5576618",
"0.5576618",
"0.55747354",
"0.5559012",
"0.5558013",
"0.55557436",
"0.555323",
"0.5547367",
"0.55437815",
"0.553667",
"0.5527915",
"0.5523392",
"0.5518848",
"0.55186516",
"0.5508226",
"0.5504882",
"0.55027914",
"0.55027914",
"0.5496737",
"0.54906887",
"0.5486982",
"0.54859877",
"0.54828703",
"0.5480799",
"0.5470719",
"0.5470719",
"0.5470719",
"0.546376",
"0.5454009",
"0.5443997",
"0.5443997",
"0.5433256",
"0.5428655",
"0.54244816",
"0.542362",
"0.5423092",
"0.54215753",
"0.54196787",
"0.5419418",
"0.5413496",
"0.54128355",
"0.54013216",
"0.5393999",
"0.53825307",
"0.53822625",
"0.53777647",
"0.53755224"
] |
0.68715453
|
1
|
PATCH/PUT /locationtypes/1 PATCH/PUT /locationtypes/1.json
|
def update
respond_to do |format|
if @locationtype.update(locationtype_params)
format.html { redirect_to @locationtype, notice: 'Locationtype was successfully updated.' }
format.json { render :show, status: :ok, location: @locationtype }
else
format.html { render :edit }
format.json { render json: @locationtype.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update!(**args)\n @location_type = args[:location_type] if args.key?(:location_type)\n end",
"def update\n respond_to do |format|\n if @route_type.update(route_type_params)\n format.html { redirect_to @route_type, notice: 'Route type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing_type.update(clothing_type_params)\n format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_type }\n else\n format.html { render :edit }\n format.json { render json: @clothing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update\n respond_to do |format|\n if @recipe_type.update(recipe_type_params)\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @object_type = ObjectType.find(params[:id])\n\n if params[:object_type][:prefix] != @object_type.prefix\n entries = Item.joins(:locator).where(\"items.object_type_id = #{@object_type.id} AND locators.item_id = items.id\").count\n if entries != 0\n flash[:error] = \"Cannot change location wizard to #{params[:object_type][:prefix]} because there\n are items associated with this object type using the current wizard whose locations\n might get messed up. To change the wizard, (a) write down all the item numbers; (b)\n delete all the items; (c) change the location wizard; (d) undelete all the items by\n changing their locations to a location that works with the new location wizard.\"\n render action: 'edit'\n return\n end\n end\n\n ok = @object_type.update_attributes(params[:object_type].except(:rows, :columns))\n\n if params[:object_type][:handler] == 'collection'\n @object_type.rows = params[:object_type][:rows]\n @object_type.columns = params[:object_type][:columns]\n @object_type.save\n end\n\n respond_to do |format|\n if ok\n format.html { redirect_to object_types_path, notice: \"Object type '#{@object_type.name}' was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_object_type_path, notice: \"Object type could not be updated. #{@object_type.errors.full_messages.join(', ')}.\" }\n format.json { render json: @object_type.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n instance = get_instance\n set_meta instance\n if instance.update(type_params)\n # Redirect to index\n format.html { redirect_to redirect_address(@type), notice: \"#{type_label} was successfully updated.\" }\n else\n flash[:alert] = \"#{type_label} has not been saved.\"\n format.html { render sti_template(@type, :edit) }\n end\n end\n end",
"def update\n @type.update(type_params)\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @phones_type.update(phones_type_params)\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully updated.' }\n format.json { render :show, status: :ok, location: @phones_type }\n else\n format.html { render :edit }\n format.json { render json: @phones_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @typeofstatus.update(typeofstatus_params)\n format.html { redirect_to @typeofstatus, notice: 'Typeofstatus was successfully updated.' }\n format.json { render :show, status: :ok, location: @typeofstatus }\n else\n format.html { render :edit }\n format.json { render json: @typeofstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_type.update(lift_type_params)\n format.html {redirect_to lift_types_path, notice: 'Lift type was successfully updated.'}\n format.json {render :show, status: :ok, location: @lift_type}\n else\n format.html {render :edit}\n format.json {render json: @lift_type.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n respond_to do |format|\n if @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloth_type.update(cloth_type_params)\n format.html { redirect_to @cloth_type, notice: \"Cloth type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cloth_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cloth_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @location = Location.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @location.update_attributes(params[:location])\r\n format.json { head :no_content }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @thing_type.update(thing_type_params)\n format.html { redirect_to @thing_type, notice: 'Thing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @thing_type }\n else\n format.html { render :edit }\n format.json { render json: @thing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n if @observation_type.update_attributes(params[:observation_type])\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation_type.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 authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n if @location.dt_devolucao.nil?\n else\n @vehicle = Vehicle.find_by(id: @location.vehicle_id)\n @client = Client.find_by(id: @location.client_id)\n \n @vehicle.update_attribute(:status, 'DISPONÍVEL')\n @client.update_attribute(:status, 'DISPONÍVEL')\n end\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @modeltype.update(modeltype_params)\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully updated.' }\n format.json { render :show, status: :ok, location: @modeltype }\n else\n format.html { render :edit }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @addtype.update(addtype_params)\n format.html { redirect_to @addtype, notice: '变动方式修改成功!' }\n format.json { render :show, status: :ok, location: @addtype }\n else\n format.html { render :edit }\n format.json { render json: @addtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n if @gl_type.update_attributes(gl_type_params)\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gl_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_locationtype\n @locationtype = Locationtype.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @api_v1_location.update(api_v1_location_params)\n format.html { redirect_to @api_v1_location, notice: 'Location was successfully updated.' }\n format.json { render json: { location: @api_v1_location, message: 'Location was successfully updated.' } }\n else\n format.html { render :edit }\n format.json { render json: { results: @api_v1_location.errors, message: 'Location was NOT successfully update.' } }\n end\n end\n end",
"def update\n respond_to do |format|\n if @optype.update(optype_params)\n format.html { redirect_to @optype, notice: 'Optype was successfully updated.' }\n format.json { render :show, status: :ok, location: @optype }\n else\n format.html { render :edit }\n format.json { render json: @optype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_location_type\n @location_type = LocationType.find(params[:id])\n end",
"def update\n if @client_type.update(client_type_params)\n render :show, status: :ok, location: @client_type\n else\n render json: @client_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @ride_type.update(ride_type_params)\n format.html { redirect_to @ride_type, notice: 'Ride type was successfully updated.' }\n format.json { render :show, status: :ok, location: @ride_type }\n else\n format.html { render :edit }\n format.json { render json: @ride_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roof_type.update(roof_type_params)\n format.html { redirect_to roof_types_path, notice: 'Roof type was successfully updated.' }\n format.json { render :show, status: :ok, location: @roof_type }\n else\n format.html { render :edit }\n format.json { render json: @roof_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @state_type.update(state_type_params)\n format.html { redirect_to @state_type, notice: 'State type was successfully updated.' }\n format.json { render :show, status: :ok, location: @state_type }\n else\n format.html { render :edit }\n format.json { render json: @state_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jewelry_type = JewelryType.find(params[:id])\n\n respond_to do |format|\n if @jewelry_type.update_attributes(params[:jewelry_type])\n format.html { redirect_to @jewelry_type, notice: 'Jewelry type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jewelry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nametype.update(nametype_params)\n format.html { redirect_to @nametype, notice: 'Nametype was successfully updated.' }\n format.json { render :show, status: :ok, location: @nametype }\n else\n format.html { render :edit }\n format.json { render json: @nametype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_type = StudentType.find(params[:id])\n\n if @student_type.update(student_type_params)\n head :no_content\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @sample_type.update(sample_type_params)\n format.html { redirect_to @sample_type, notice: \"Sample type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sample_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_of_value.update(type_of_value_params)\n format.html { redirect_to @type_of_value, notice: 'Type of value was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_of_value }\n else\n format.html { render :edit }\n format.json { render json: @type_of_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n logger.info params[:location].to_json\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, :notice => 'Location was successfully updated.' }\n format.json { render :json => @location, :status => :updated, :location => @location }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n set_location\n\n respond_to do |format|\n if @location.update_attributes(location_params)\n format.html { redirect_to @location, flash: {success: \"Successfully updated #{@location.name} location!\" }}\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question_type.update(question_type_params)\n format.html { redirect_to @question_type, notice: 'Question type was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_type }\n else\n format.html { render :edit }\n format.json { render json: @question_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to director_types_path, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @director_type }\n else\n format.html { render :edit }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.friendly.find(params[:id])\n respond_to do |format|\n if @location.update_attributes!(location_params)\n format.html { redirect_to @location, notice: 'location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @specific_location.update(specific_location_params)\n format.html { redirect_to @specific_location, notice: 'Specific location was successfully updated.' }\n format.json { render :show, status: :ok, location: @specific_location }\n else\n format.html { render :edit }\n format.json { render json: @specific_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n if @site_type.update_attributes(params[:site_type]) && @site_type.section_type_ids = section_type_ids\n format.html { redirect_to @site_type, notice: 'Site type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @option_type.update(option_type_params)\n format.html { redirect_to [:admin, @option_type], notice: 'Option type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @option_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_type.update(student_type_params)\n format.html { redirect_to @student_type, notice: 'Student type was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_type }\n else\n format.html { render :edit }\n format.json { render json: @student_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_type.update(task_type_params)\n format.html { redirect_to task_types_path, notice: 'Task type was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_type }\n else\n format.html { render :edit }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact_type.update(contact_type_params)\n format.html { redirect_to @contact_type, notice: 'Contact type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @valid_type.update(valid_type_params)\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @valid_type }\n else\n format.html { render :edit }\n format.js { render :edit }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicletype.update(vehicletype_params)\n format.html { redirect_to @vehicletype, notice: 'Vehicletype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicletype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n if @question_type.update_attributes(params[:question_type])\n format.html { redirect_to @question_type, notice: 'Question type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_option.update(location_option_params)\n format.html { redirect_to @location_option, notice: 'Location option was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_option }\n else\n format.html { render :edit }\n format.json { render json: @location_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agency_type = AgencyType.find(params[:id])\n\n respond_to do |format|\n if @agency_type.update_attributes(params[:agency_type])\n format.html { redirect_to @agency_type, notice: 'Agency type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if get_instance.update(type_params)\n # Redirect to index\n format.json { render sti_template(@type, :show), status: :ok, location: get_instance } # TODO: test\n else\n format.json { render json: get_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flat_type.update(flat_type_params)\n format.html { redirect_to @flat_type, notice: 'Flat type was successfully updated.' }\n format.json { render :show, status: :ok, location: @flat_type }\n else\n format.html { render :edit }\n format.json { render json: @flat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = @entity_type.collection\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @record = Location.find(params[:id])\n @record.update_attributes(params[:location]) \n respond_to do |format|\n# format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n respond_to do |format|\n if @typebourse.update(typebourse_params)\n format.html { redirect_to @typebourse, notice: 'Typebourse was successfully updated.' }\n format.json { render :show, status: :ok, location: @typebourse }\n else\n format.html { render :edit }\n format.json { render json: @typebourse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @totem_location.update(totem_location_params)\n format.html { redirect_to @totem_location, notice: 'Totem location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @totem_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @let_type.update(let_type_params)\n format.html { redirect_to @let_type, notice: 'Let type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @let_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @register_animal_type.update(register_animal_type_params)\n format.html { redirect_to register_animal_types_path, notice: 'O tipo de animal foi atualizado com sucesso.' }\n format.json { render :index, status: :ok, location: @register_animal_type }\n else\n format.html { render :edit }\n format.json { render json: @register_animal_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @phone_types = PhoneType.all\n @phone_type = PhoneType.find(params[:id])\n\n @phone_type.update_attributes(phone_type_params)\n\n=begin\n respond_to do |format|\n if @phone_type.update(phone_type_params)\n format.html { redirect_to @phone_type, notice: 'Phone type was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone_type }\n else\n format.html { render :edit }\n format.json { render json: @phone_type.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n if @opportunity_type.update_attributes(params[:opportunity_type])\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @use_type.update(use_type_params)\n format.html { redirect_to @use_type, notice: 'Use type was successfully updated.' }\n format.json { render :show, status: :ok, location: @use_type }\n else\n format.html { render :edit }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_time.update(location_time_params)\n format.html { redirect_to @location_time, notice: 'Location time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hotel_type.update(hotel_type_params)\n format.html { redirect_to @hotel_type, notice: 'Hotel type was successfully updated.' }\n format.json { render :show, status: :ok, location: @hotel_type }\n else\n format.html { render :edit }\n format.json { render json: @hotel_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @locations = []\n @errors = []\n @hide_map = true\n if params.has_key? :id\n location = Location.find(params[:id])\n @locations = [ location ]\n location_params = params.clone\n [:created_at, :id, :updated_at, :category, :subcategories, :markerVisible, :action, :controller, :location].each do |param|\n location_params.delete param\n end\n location.update_attributes location_params\n @errors = location.errors\n elsif params.has_key? :locations\n params[:locations][:location].each do |data|\n l = Location.find data[0]\n if not l.update_attributes data[1]\n pp l.errors\n @errors.push l.errors\n end\n @locations.push l\n end\n end\n\n respond_to do |format|\n if @errors.empty?\n format.html { redirect_to :locations, :notice => 'Locations successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render :action =>\"edit\" }\n format.json { render :json => @errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n puts \"\\nUPDATE: #{@location.inspect}\"\n format.html { redirect_to @location, notice: \"Location was successfully updated.\" }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipment_type.update(shipment_type_params)\n format.html { redirect_to @shipment_type, notice: 'Shipment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @shipment_type }\n else\n format.html { render :edit }\n format.json { render json: @shipment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questiontype.update(questiontype_params)\n format.html { redirect_to @questiontype, notice: 'Questiontype was successfully updated.' }\n format.json { render :show, status: :ok, location: @questiontype }\n else\n format.html { render :edit }\n format.json { render json: @questiontype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"def update\n respond_to do |format|\n if @phone_type.update_attributes(phone_type_params)\n format.html { redirect_to @phone_type, notice: 'Tipo Telefone atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @phone_type }\n else\n format.html { render :edit }\n format.json { render json: @phone_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to user_locations_path, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @language_type = LanguageType.find(params[:id])\n\n if @language_type.update(language_type_params)\n head :no_content\n else\n render json: @language_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @reltype.update(reltype_params)\n format.html { redirect_to @reltype, notice: 'Reltype was successfully updated.' }\n format.json { render :show, status: :ok, location: @reltype }\n else\n format.html { render :edit }\n format.json { render json: @reltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey_data_type.update(survey_data_type_params)\n format.html { redirect_to @survey_data_type, notice: 'Survey data type was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_data_type }\n else\n format.html { render :edit }\n format.json { render json: @survey_data_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Ubicacion actualizada correctamente!' }\n format.json { head :no_content }\n else\n format.html { redirect_to '/locations/'[email protected]_s+'/edit',notice: 'Ingrese una direccion y un numero de casa!' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end"
] |
[
"0.67589223",
"0.6427182",
"0.63977265",
"0.6379996",
"0.6379274",
"0.6370938",
"0.6360427",
"0.6338944",
"0.6305313",
"0.6299987",
"0.6298265",
"0.62895554",
"0.62741023",
"0.62737304",
"0.6263542",
"0.62588704",
"0.62507045",
"0.6231161",
"0.62263507",
"0.62204653",
"0.6208678",
"0.6206967",
"0.6203569",
"0.61927617",
"0.6188548",
"0.6184166",
"0.616005",
"0.61464506",
"0.6134633",
"0.6125325",
"0.61140573",
"0.6104822",
"0.61034614",
"0.61032754",
"0.60939527",
"0.6090593",
"0.60853475",
"0.6077068",
"0.60669744",
"0.60530114",
"0.6051915",
"0.6050621",
"0.6048558",
"0.6044171",
"0.6043553",
"0.6042924",
"0.60426396",
"0.60367894",
"0.60331994",
"0.6033149",
"0.60317147",
"0.603037",
"0.6028885",
"0.6023477",
"0.6019457",
"0.60172105",
"0.6015217",
"0.60122156",
"0.60114235",
"0.6010949",
"0.6010949",
"0.6002084",
"0.6000877",
"0.59982395",
"0.59978884",
"0.59917635",
"0.5985875",
"0.59857327",
"0.5983605",
"0.5976793",
"0.5976188",
"0.5975544",
"0.5973827",
"0.59726715",
"0.5971152",
"0.59709",
"0.5970485",
"0.59700155",
"0.5969921",
"0.59697515",
"0.5969296",
"0.59651613",
"0.5962255",
"0.59507257",
"0.5947547",
"0.5946684",
"0.5943221",
"0.59397894",
"0.5937674",
"0.5936007",
"0.59360015",
"0.5935549",
"0.5934818",
"0.5932486",
"0.59310865",
"0.592896",
"0.5927482",
"0.59265465",
"0.5925848",
"0.5918994"
] |
0.71162456
|
0
|
DELETE /locationtypes/1 DELETE /locationtypes/1.json
|
def destroy
@locationtype.destroy
respond_to do |format|
format.html { redirect_to locationtypes_url, notice: 'Locationtype was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @route_type.destroy\n respond_to do |format|\n format.html { redirect_to route_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @location = Location.find(params[:id])\r\n @location.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @observation_type = ObservationType.find(params[:id])\n @observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @totem_location.destroy\n respond_to do |format|\n format.html { redirect_to totem_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agency_type = AgencyType.find(params[:id])\n @agency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_location.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_locations_url, notice: 'Location was successfully destroyed.' }\n format.json { render json: { results: @api_v1_location, message: 'Location was successfully destroyed.' } }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n #@client = Client.find(@location.client_ids)\n #@contact = Contact.find(@location.contact_ids)\n \n @location.destroy\n\n respond_to do |format|\n \n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n set_location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, flash: {success: \"Successfully deleted #{@location.name} location!\" }}\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to geolocation_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @area_type = AreaType.find(params[:id])\n @area_type.destroy\n\n respond_to do |format|\n format.html { redirect_to area_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @location = Location.find(params[:location_id])\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ms_location.destroy\n respond_to do |format|\n format.html { redirect_to ms_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_location.destroy\n respond_to do |format|\n format.html { redirect_to specific_locations_url, notice: 'Specific location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @identifier_type.destroy\n\n respond_to do |format|\n format.html { redirect_to identifier_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless admin?\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_have_location = LocationHaveLocation.find(params[:id])\n @location_have_location.destroy\n\n respond_to do |format|\n format.html { redirect_to location_have_locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redirect_to item_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clothing_type.destroy\n respond_to do |format|\n format.html { redirect_to clothing_types_url, notice: 'Clothing type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_granularity.destroy\n respond_to do |format|\n format.html { redirect_to location_granularities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = apply_scopes(Location).find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_locations_url(:site => current_site.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = $User.get_location(params[:id])\n @location.kill\n GlobalData.reload(:locations)\n respond_to do |format|\n format.html { redirect_to('/locations') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to trip_locations_path, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_location.destroy\n respond_to do |format|\n format.html { redirect_to admin_locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle_type.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jewelry_type = JewelryType.find(params[:id])\n @jewelry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to jewelry_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items_location.destroy\n\n respond_to do |format|\n format.html { redirect_to items_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @locations = nil\n\n if params.has_key? :id\n location = Location.find params[:id]\n @locations = [ location ]\n elsif params.has_key? :ids\n @locations = Location.find params[:ids].split(\",\")\n end\n\n if not @locations.empty?\n @locations.each do |l|\n l.destroy\n end\n end\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typeofstatus.destroy\n respond_to do |format|\n format.html { redirect_to typeofstatuses_url, notice: 'Typeofstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicletype.destroy\n respond_to do |format|\n format.html { redirect_to vehicletypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type.destroy\n respond_to do |format|\n format.html { redirect_to os_types_url, notice: 'Os type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloth_type.destroy\n respond_to do |format|\n format.html { redirect_to cloth_types_url, notice: \"Cloth type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @state_type.destroy\n respond_to do |format|\n format.html { redirect_to state_types_url, notice: 'State type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n render :json => { status: :deleted, head: :no_content }\n end",
"def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hotel_type.destroy\n respond_to do |format|\n format.html { redirect_to hotel_types_url, notice: 'Hotel type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage_location = StorageLocation.find(params[:id])\n @storage_location.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sample_type.destroy\n respond_to do |format|\n format.html { redirect_to sample_types_url, notice: \"Sample type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @awon_record_type.destroy\n respond_to do |format|\n format.html { redirect_to awon_record_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_type.destroy\n respond_to do |format|\n format.html { redirect_to recipe_types_url, notice: \"Recipe type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_type = TravelType.find(params[:id])\n @travel_type.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: \"Location was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7074522",
"0.7031752",
"0.69829553",
"0.6941483",
"0.69289505",
"0.6921534",
"0.6908175",
"0.6899486",
"0.6896655",
"0.68930936",
"0.68917996",
"0.6871897",
"0.686513",
"0.686513",
"0.686513",
"0.686513",
"0.68597496",
"0.6858222",
"0.6855608",
"0.68317616",
"0.6821802",
"0.68172824",
"0.68172824",
"0.68172824",
"0.68172824",
"0.68172824",
"0.68172824",
"0.68172824",
"0.68172824",
"0.68120617",
"0.68115145",
"0.68115145",
"0.68094546",
"0.68020546",
"0.6798414",
"0.6798177",
"0.67916423",
"0.67855",
"0.6784027",
"0.6763168",
"0.67568225",
"0.6747568",
"0.6743516",
"0.6741766",
"0.67337453",
"0.67276746",
"0.67263514",
"0.6725245",
"0.67175823",
"0.67164546",
"0.6716181",
"0.6711786",
"0.6705925",
"0.67038363",
"0.669148",
"0.66903615",
"0.6686196",
"0.6686041",
"0.6682917",
"0.6678996",
"0.6675113",
"0.66700953",
"0.66694003",
"0.66677207",
"0.66676444",
"0.6667236",
"0.6666694",
"0.6664177",
"0.66635936",
"0.6663076",
"0.6662875",
"0.6659176",
"0.6652592",
"0.6640778",
"0.66375846",
"0.6636843",
"0.6633323",
"0.66309017",
"0.6626593",
"0.6625106",
"0.6624138",
"0.66239846",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6623106",
"0.6622662",
"0.6618562"
] |
0.7630033
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_locationtype
@locationtype = Locationtype.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def 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 default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.5332605",
"0.5312215",
"0.5296594",
"0.52965283",
"0.52957606",
"0.5259903",
"0.52443177",
"0.523896",
"0.523896",
"0.523896",
"0.523896",
"0.523896",
"0.52329034",
"0.52322394",
"0.5227445",
"0.5222394",
"0.5220348",
"0.5212759",
"0.5207747",
"0.5205933",
"0.5176468",
"0.5173833",
"0.5171983",
"0.51663405",
"0.5159596",
"0.5158247",
"0.51526845",
"0.5152398",
"0.5151361",
"0.5145775",
"0.5140135",
"0.51338995",
"0.51127726",
"0.5112607",
"0.5112607",
"0.5110613",
"0.51067513",
"0.5092337",
"0.508788",
"0.5081578",
"0.5080434",
"0.50679874",
"0.50567716",
"0.5051213",
"0.5048352",
"0.5048352",
"0.5035347",
"0.5026666",
"0.5023127",
"0.5016081",
"0.50129867",
"0.5000684",
"0.4999752",
"0.49979812",
"0.499026",
"0.499026",
"0.49866846",
"0.49800366",
"0.49795717",
"0.49771172",
"0.4968475",
"0.4965813",
"0.4958072",
"0.49561292",
"0.4954901",
"0.49536785",
"0.4953058",
"0.49468648",
"0.49424478",
"0.4932989",
"0.49291888",
"0.49273813",
"0.49271655",
"0.4925948",
"0.49236968",
"0.49203572",
"0.49181753",
"0.49173692",
"0.4916862",
"0.49161318",
"0.49155986"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def locationtype_params
params.require(:locationtype).permit(:name, :icon_id, :icon_url, :insideR, :nearR)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def 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 social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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 get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62909746",
"0.62904227",
"0.62837297",
"0.6240993",
"0.6239739",
"0.6217764",
"0.6214983",
"0.62112504",
"0.6194765",
"0.6178",
"0.61755055",
"0.61729854",
"0.61636627",
"0.6153461",
"0.6151674",
"0.61478525",
"0.6122671",
"0.61188513",
"0.61075556",
"0.6105721",
"0.6092412",
"0.6081011",
"0.6071054",
"0.6064436",
"0.6022111",
"0.6018135",
"0.60151577",
"0.60108894",
"0.60070235",
"0.60070235",
"0.6000806",
"0.6000464",
"0.5998811",
"0.59926987",
"0.5992257",
"0.5991173",
"0.5980311",
"0.59660876",
"0.59596545",
"0.5959415",
"0.59589994",
"0.5957478",
"0.5953214",
"0.5952233",
"0.5944033",
"0.59396756",
"0.59396756",
"0.59386414",
"0.59345603",
"0.5931261",
"0.5926345",
"0.5925795",
"0.59174526",
"0.59108645",
"0.5909469",
"0.5908263",
"0.59053195",
"0.58980685",
"0.5897738",
"0.589657",
"0.5895971",
"0.58942044",
"0.5892847",
"0.588742",
"0.58834344",
"0.5880024",
"0.58739793",
"0.5868253",
"0.5867907",
"0.58670515",
"0.58668053",
"0.5865756",
"0.5863549",
"0.5863236",
"0.5862728",
"0.5861283",
"0.58591247",
"0.5855159",
"0.5854291",
"0.58512247",
"0.58498096"
] |
0.0
|
-1
|
GET /attachments GET /attachments.json
|
def index
@attachments = Attachment.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def index\n @channel = Channel.find_by_name(params[:channel_id])\n @attachments = @channel.attachments.order(\"created_at DESC\")\n\n respond_to do |format|\n format.json { render :json => @attachments.to_json(:methods => :url) }\n end\n end",
"def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model)\n raise mailosaur_error\n end\n\n response.body\n end",
"def attachments\n Easybill::Api::Attachments\n end",
"def get_email_attachments\n\t\tresp = @resp\n\n\t\tparams[\"email\"] ||= \"\"\n\t\tparams[\"password\"] ||= \"\"\n\n\t\t# Authorize and process attachments in mail account\n\t\tresp = Resume.gmail_attachments(resp, params)\n\n\t\trender :json => resp\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key? :unnamed\n end\n unnamed = false if unnamed.to_s == \"0\"\n id = $~[1] if id =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{id}/attachments\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n resp.gsub!(/^\\n/m,\"\") # toss blank lines\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n th = response_to_h(resp)\n list = []\n pattern = /(\\d+:\\s.*?\\))(?:,|$)/\n match = pattern.match(th['attachments'].to_s)\n while match != nil\n list.push match[0]\n s = match.post_match\n match = pattern.match(s)\n end\n attachments = []\n list.each do |v|\n attachment = {}\n m=v.match(/(\\d+):\\s+(.*?)\\s+\\((.*?)\\s+\\/\\s+(.*?)\\)/)\n if m.class == MatchData\n next if m[2] == \"(Unnamed)\" and !unnamed\n attachment[:id] = m[1]\n attachment[:name] = m[2]\n attachment[:type] = m[3]\n attachment[:size] = m[4]\n attachments.push attachment\n end\n end\n attachments\n end",
"def attachments\n @attachments\n end",
"def get_issue_attachments(issue_id_or_key)\n get(\"issues/#{issue_id_or_key}/attachments\")\n end",
"def get_all_attachments(page_id)\n\n url = \"#{@@conf_url}/#{@@urn}/#{page_id}/child/attachment?os_username=#{@@login}&os_password=#{@@pwd}&status=current\"\n\n begin\n atts = RestClient.get url, :content_type => 'application/json', :accept => 'json'\n rescue RestClient::ExceptionWithResponse => e\n puts Nokogiri.XML(e.response)\n nil\n end\n\n unless atts.nil?\n JSON.parse(atts)[\"results\"]\n end\n end",
"def show\n @message_attachment = MessageAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_attachment }\n end\n end",
"def list_attachments\n @artifact_answer = ArtifactAnswer.find(params[:id])\n @attachments = @artifact_answer.attachments\n render layout: false\n end",
"def attachments(message_id, params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment\", params: params)\n end",
"def get_attachment(name)\n\n unless (model.properties.has_property?(:attachments) &&\n model.properties[:attachments].type == DataMapper::Types::JsonObject &&\n model.properties[:attachments].field == :_attachments)\n raise ArgumentError, \"Attachments require ' property :attachments, JsonObject, :field => :_attachments'\"\n end\n\n unless self.id && self.attachments && self.attachments[name]\n nil\n else\n http = Net::HTTP.new(repository.adapter.uri.host, repository.adapter.uri.port)\n uri = attachment_path(name)\n response, data = http.get(uri, { 'Content-Type' => self.attachments[name]['content_type'] })\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def attachments\n parts.attachments\n end",
"def attachments\n @attachments ||= []\n end",
"def retrieve_attachment(name)\n { :file => RestClient.get(\"#{ uri }/#{ CGI.escape(name) }\"),\n :content_type => JSON.parse(RestClient.get(uri))['_attachments']['name'] }\n end",
"def attachments(params={})\n raise ArgumentError, \"Error: ids or attachment_ids must be set\" unless params[:ids] || params[:attachment_ids]\n rpc_call :attachments, params\n end",
"def get_attachment(*params)\n tid = params[0]\n aid = params[1]\n dir = nil\n dir = params[2] if params.size > 2\n if params[0].class == Hash\n params = params[0]\n tid = params[:ticket] if params.has_key? :ticket\n aid = params[:attachment] if params.has_key? :attachment\n dir = params[:dir] if params.has_key? :dir\n end\n tid = $~[1] if tid =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{tid}/attachments/#{aid}\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss HTTP response\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n headers = response_to_h(resp)\n reply = {}\n headers.each do |k,v|\n reply[\"#{k}\"] = v.to_s\n end\n content = resp.match(/Content:\\s+(.*)/m)[1]\n content.gsub!(/\\n\\s{9}/,\"\\n\") # strip leading spaces on each line\n content.chomp!\n content.chomp!\n content.chomp! # 3 carriage returns at the end\n if (RUBY_VERSION.to_f >= 1.9)\n binary = content.encode(\"ISO-8859-1\",\"UTF-8\", { :invalid => :replace, :undef => :replace })\n else\n binary = Iconv.conv(\"ISO-8859-1\",\"UTF-8\",content) # convert encoding\n end\n if dir\n fh = File.new(\"#{dir}/#{headers['Filename'].to_s}\",\"wb\")\n fh.write binary\n fh.close\n else\n reply[\"content\"] = binary\n end\n reply\n end",
"def show\n @attachments = @document.attachments\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def attachments\n load_object\n load_attachments\n render layout: false\n end",
"def attachments\n if attachment_ids\n attachment_ids.map {|id| Attachment.find(id)}\n else\n []\n end\n end",
"def get_attachment(attachment_id)\n params = {'key' => @api_key}\n RestClient.get(\"#{@base_uri}/attachment/#{attachment_id}\", {:params => params}).body\n end",
"def attachments\n @_message.attachments\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def show\n @attachment_datum = AttachmentDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment_datum }\n end\n end",
"def getAttachment(attachmentId)\n params = Hash.new\n params['key'] = @API_KEY\n response = RestClient.get(@BASE_URI + '/attachment/' + attachmentId, {:params => params})\n return response.body\n end",
"def get(\n id,\n deadline: nil\n )\n return @account_attachments.get(\n id,\n deadline: deadline,\n )\n end",
"def index\n @attachments = @pad.attachments\n @attachment = @pad.attachments.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attachments }\n end\n end",
"def get_attachment(name)\n assert_attachments_property\n\n attachment = self.attachments[name] if self.attachments\n\n unless self.id && attachment\n nil\n else\n adapter = repository.adapter\n http = Net::HTTP.new(adapter.uri.host, adapter.uri.port)\n uri = Addressable::URI.encode_component(attachment_path(name))\n response, data = http.get(uri, 'Content-Type' => attachment['content_type'])\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def get_attachments()\n\t\t\n\t\tmessages = list_of_messages()\n\n\t\t#Initializing Nested Hash so that we can store message_id, file_name and attachemnt id\n\t\tfiles= Hash.new { |l, k| l[k] = Hash.new(&l.default_proc) }\n\t\tmessages.each do |message_id|\n\t\t\n\t\t\t#Create a new request\n\t\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages/#{message_id}?access_token=#{@access_token}\"\n\n\t\t\t#GET REQUEST\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\n\t\t\t#Getting list of attachments based on message id\n\t\t\ttemp = response_body['payload']['parts']\n\t\t\ttemp.each do |item|\n\t\t\t\tif item['filename'] !=''\n\t\t\t\t\tfiles[message_id][item['filename']]=item['body']['attachmentId']\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\t\treturn files\n\tend",
"def index\n @cms_attachments = Cms::Attachment.all\n end",
"def get_document_attachments(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def retrieveImages\n posting = Posting.find(params[:id])\n post_attachments = posting.post_attachments.all\n respond_to do |format|\n format.json { render json: {\n status: 'ok',\n rowcount: post_attachments.length,\n results: post_attachments.map { |b| {\n id: b.id,\n imageData: b.image,\n description: b.description\n }}\n }}\n end\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n path = \"/Notes/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIFileAttachment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachment( document_id, attachment_id )\n new( :id => document_id ).attachments.get!( attachment_id )\n end",
"def list_attachments_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_attachments ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_attachments\"\n end\n if @api_client.config.client_side_validation && opts[:'alert_identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'alert_identifier_type'])\n fail ArgumentError, 'invalid value for \"alert_identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/attachments\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'alertIdentifierType'] = opts[:'alert_identifier_type'] if !opts[:'alert_identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertAttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachments\n process_message_body if !@attachments\n @attachments\n end",
"def fetch_attachment(document_id, attachment_name)\n server.get(\"#{name}/#{CGI.escape(document_id)}/#{CGI.escape(attachment_name)}\", :no_json => true)\n end",
"def show\n @meeting = Meeting.find(params[:id])\n @json_from_file = 0\n for file in @meeting.file.attachments\n if file.content_type == 'application/json'\n download_file_from_s3('smartmeetingsbelieving', \"./tmp/\" + file.filename.to_s(), file.filename.to_s())\n @json_from_file = File.read(\"tmp/\" + file.filename.to_s())\n end\n end\n end",
"def attachments\n @attachments ||= ActiveStorage::Attachment.where(record_gid: record.to_gid.to_s, name: name)\n end",
"def attachments\n @attachments ||= begin\n return message.attachments unless message.attachments.empty?\n if full_text_part.nil? && full_html_part.nil?\n [ message ]\n else\n []\n end\n end\n end",
"def index\n @user_attachments = UserAttachment.all\n end",
"def list_attachments(identifier, opts = {})\n data, _status_code, _headers = list_attachments_with_http_info(identifier, opts)\n return data\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def attachments\n mail&.attachments || []\n end",
"def show\n # These are expected and required by the file_handler route: \"file_attachments/:content_type/:parent_id/:id\"\n id = params[:id]\n parent_id = params[:parent_id]\n \n case params[:content_type]\n when \"PrivateMessage\" \n # Only users involved in PM conversations can view attachments\n file_attachment = PrivateMessage.with_recipients.with_user(session[:user_id]).with_attachments.find(parent_id).file_attachments.find(id)\n when \"NewsArticle\"\n file_attachment = NewsArticle.include_attachments.find(parent_id).file_attachments.find(id)\n else \n end\n \n # Sanitize path to ensure that the path is not pointing anywhere malicious on the server \n path = file_attachment.attachment.path\n raise MissingFile, \"Couldn't read #{file_attachment.attachment_file_name}\" unless\n File.readable?(path) and\n File.file?(path)\n \n send_file file_attachment.attachment.path, :type => file_attachment.attachment_content_type\n end",
"def index\n @file_attachments = FileAttachment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_attachments }\n end\n end",
"def get_document_attachments_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_attachments ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_attachments\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/attachments\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'AttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachment_get\n c_user = current_user()\n course = Course.where(id: params[:course_id]).first()\n\n # Course not found case\n if course.nil?\n return ( render status: 404, json: { result: \"Course Not Found\" } )\n end\n\n # Course found case\n if params[:type] == \"Document\"\n attache = Document.where(id: params[:attach_id], attachable_id: course.id).first()\n elsif params[:type] == \"Embed\"\n attache = Embed.where(id: params[:attach_id], attachable_id: course.id).first()\n end\n\n # Attachment not found case\n if attache.nil?\n return ( render status: 404, json: { result: \"Attachable Not Found\" } )\n end\n\n # Public case:\n if course.visibility == Visibility.published \n render status: 200, json: { result: attache}\n\n # Authenticated case:\n elsif logged_in? # Ensure that the user is logged in\n # Checks IF user is privledged or owns the course, ELSE return unauthorized\n if c_user.role == Role.admin or c_user.role == Role.moderator or\n c_user.id == course.user_id then\n render status: 200, json: { result: attache }\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n\n # Course is not (public) AND (owned by user and editable) AND (user is not privledged)\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n end",
"def show\n @attachment = @page.attachments.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @attachment.to_xml }\n end\n end",
"def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end",
"def attachment(name)\n name = name.to_s\n return attachments[name][:file] if @attachments.try(:[], :name).try(:[], :file)\n begin\n result = retrieve_attachment(name)\n @attachments = (@attachments || {}).merge(name => {:file => result[:file], :dirty => false, :content_type => result[:content_type]})\n result[:file]\n rescue RestClient::ResourceNotFound\n nil\n end\n end",
"def index\n @pub_attachments = PubAttachment.all\n end",
"def index\n @embedded_attachments = EmbeddedAttachment.page params[:page]\n end",
"def index\n @link_attachments = LinkAttachment.all\n end",
"def index\n @note_attachments = NoteAttachment.all\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse2002>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @attached_asset = AttachedAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attached_asset }\n end\n end",
"def show\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pattachment }\n end\n end",
"def index\n @file_upload_attachments = FileUploadAttachment.all\n end",
"def get(\n id,\n deadline: nil\n )\n req = V1::AccountAttachmentGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"AccountAttachments.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = AccountAttachmentGetResponse.new()\n resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end",
"def show\n @cause_analyasis = CauseAnalysis.find(params[:id])\n @attachment = @cause_analyasis.attachment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cause_analyasis }\n end\n end",
"def index\n @order_attachments = OrderAttachment.all\n end",
"def get_attachment(db, locale, version, attachment_name, ttl=settings.long_ttl)\n id = get_topic_or_image_id(locale, version, attachment_name)\n return get_from_db_or_cache(db, id, {:trx => CouchDBTransaction::FETCH_ATTACHMENT, :attachment_name => attachment_name}, ttl)\n end",
"def index\n @gallery_attachments = GalleryAttachment.all\n end",
"def show\n @file_upload_attachments = @file_upload.file_upload_attachments.all\n end",
"def show\n @ticket_attachments = @ticket.ticket_attachments.all\n end",
"def attachments\n @attachments ||= Attachments.new( self )\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LeadsApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n path = \"/Leads/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIFileAttachment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LeadsApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @record_id = params[:id]\n\n # run the where clause globally\n @relevant_record = Record.find(@record_id)\n @relevant_attachments = RecordAttachment.where(record_id: @record_id).order(\"id\")\n\n # make the record attachments an array if it isn't already \n if @relevant_attachments.length > 1\n @record_attachments = @relevant_attachments\n else \n @record_attachments = [@relevant_attachments[0]]\n end\n\n respond_to do |format|\n format.html {}\n format.json { render json: {\n record: @relevant_record, \n attachments: @record_attachments,\n }.to_json }\n end\n end",
"def index\n @travel_post_attachments = TravelPostAttachment.all\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def attachments\n (msg['attachments']||{}).map{|attached| Mandrill::WebHook::Attachment[attached.last] }\n end",
"def mandrill_attachments\n attachments.map do |attachment|\n {\n 'type' => attachment.content_type,\n 'name' => attachment.filename,\n 'content' => Base64.encode64(attachment.body.decoded)\n }\n end\n end",
"def test_ListBugAttachments\n\t\tcolName = 'attachments'\n\t\tretClass = LeanTesting::BugAttachment\n\t\tresp = rcol(colName, ['_id', '_owner_id', 'url', 'created_at'])\n\t\[email protected] = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = LeanTesting::Bug.new(@client, {'id'=> 0}).attachments.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def index\n @event_attachments = EventAttachment.all\n end",
"def index\n @design_image_attachments = DesignImageAttachment.all\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def client_attachments\n self.messages.where(location_submitted: Message::CLIENT_EMAIL_LOCATIONS).collect { |message| message.attachments }.flatten\n end",
"def index\n @code_solution_attachments = CodeSolutionAttachment.all\n end",
"def get_attachment\n @document = EcoDocument.find(params[:id])\n send_data(@document.data,\n :filename => @document.name,\n :type => @document.content_type,\n :disposition => \"inline\")\n end",
"def find_attachment(resource_id, attachment_id)\n http.get(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n Rexpense::Entities::Attachment.new response.parsed_body\n end\n end"
] |
[
"0.74735296",
"0.74735296",
"0.74024487",
"0.722081",
"0.7219372",
"0.7208093",
"0.7203526",
"0.7203526",
"0.7203526",
"0.7203526",
"0.7187247",
"0.7101844",
"0.70873123",
"0.7087135",
"0.7081746",
"0.70675015",
"0.70458794",
"0.69755876",
"0.6935839",
"0.6916688",
"0.68613833",
"0.68414116",
"0.6836078",
"0.68143094",
"0.68037605",
"0.6783571",
"0.67465305",
"0.67453974",
"0.67428803",
"0.67428803",
"0.67428803",
"0.67120004",
"0.67120004",
"0.6707193",
"0.67010885",
"0.66758096",
"0.6674237",
"0.6671644",
"0.6670934",
"0.66696763",
"0.66399014",
"0.66362226",
"0.66140586",
"0.6611154",
"0.65802944",
"0.6570685",
"0.657044",
"0.6570338",
"0.65404356",
"0.65403533",
"0.653839",
"0.6506397",
"0.64871037",
"0.64871037",
"0.6486928",
"0.64819986",
"0.64734787",
"0.6466074",
"0.6465332",
"0.6460506",
"0.6448771",
"0.64458203",
"0.64452505",
"0.6424353",
"0.6417979",
"0.6410268",
"0.63907003",
"0.6389211",
"0.63531005",
"0.632865",
"0.63255274",
"0.6302036",
"0.62926674",
"0.62845004",
"0.62827873",
"0.62760276",
"0.6271045",
"0.62706494",
"0.6267206",
"0.62392646",
"0.62386733",
"0.6236985",
"0.6236985",
"0.62359357",
"0.6232985",
"0.62250197",
"0.6223041",
"0.62087905",
"0.6206735",
"0.6203256",
"0.6203256",
"0.6203256",
"0.6202082",
"0.61983055",
"0.61966765",
"0.6196375"
] |
0.7157699
|
15
|
GET /attachments/1 GET /attachments/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model)\n raise mailosaur_error\n end\n\n response.body\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end",
"def show\n @message_attachment = MessageAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_attachment }\n end\n end",
"def index\n @channel = Channel.find_by_name(params[:channel_id])\n @attachments = @channel.attachments.order(\"created_at DESC\")\n\n respond_to do |format|\n format.json { render :json => @attachments.to_json(:methods => :url) }\n end\n end",
"def get_attachment(name)\n\n unless (model.properties.has_property?(:attachments) &&\n model.properties[:attachments].type == DataMapper::Types::JsonObject &&\n model.properties[:attachments].field == :_attachments)\n raise ArgumentError, \"Attachments require ' property :attachments, JsonObject, :field => :_attachments'\"\n end\n\n unless self.id && self.attachments && self.attachments[name]\n nil\n else\n http = Net::HTTP.new(repository.adapter.uri.host, repository.adapter.uri.port)\n uri = attachment_path(name)\n response, data = http.get(uri, { 'Content-Type' => self.attachments[name]['content_type'] })\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def retrieve_attachment(name)\n { :file => RestClient.get(\"#{ uri }/#{ CGI.escape(name) }\"),\n :content_type => JSON.parse(RestClient.get(uri))['_attachments']['name'] }\n end",
"def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key? :unnamed\n end\n unnamed = false if unnamed.to_s == \"0\"\n id = $~[1] if id =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{id}/attachments\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n resp.gsub!(/^\\n/m,\"\") # toss blank lines\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n th = response_to_h(resp)\n list = []\n pattern = /(\\d+:\\s.*?\\))(?:,|$)/\n match = pattern.match(th['attachments'].to_s)\n while match != nil\n list.push match[0]\n s = match.post_match\n match = pattern.match(s)\n end\n attachments = []\n list.each do |v|\n attachment = {}\n m=v.match(/(\\d+):\\s+(.*?)\\s+\\((.*?)\\s+\\/\\s+(.*?)\\)/)\n if m.class == MatchData\n next if m[2] == \"(Unnamed)\" and !unnamed\n attachment[:id] = m[1]\n attachment[:name] = m[2]\n attachment[:type] = m[3]\n attachment[:size] = m[4]\n attachments.push attachment\n end\n end\n attachments\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def index\n @attachments = Attachment.all\n end",
"def get_attachment(attachment_id)\n params = {'key' => @api_key}\n RestClient.get(\"#{@base_uri}/attachment/#{attachment_id}\", {:params => params}).body\n end",
"def get_attachment(name)\n assert_attachments_property\n\n attachment = self.attachments[name] if self.attachments\n\n unless self.id && attachment\n nil\n else\n adapter = repository.adapter\n http = Net::HTTP.new(adapter.uri.host, adapter.uri.port)\n uri = Addressable::URI.encode_component(attachment_path(name))\n response, data = http.get(uri, 'Content-Type' => attachment['content_type'])\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def attachment( document_id, attachment_id )\n new( :id => document_id ).attachments.get!( attachment_id )\n end",
"def fetch_attachment(document_id, attachment_name)\n server.get(\"#{name}/#{CGI.escape(document_id)}/#{CGI.escape(attachment_name)}\", :no_json => true)\n end",
"def getAttachment(attachmentId)\n params = Hash.new\n params['key'] = @API_KEY\n response = RestClient.get(@BASE_URI + '/attachment/' + attachmentId, {:params => params})\n return response.body\n end",
"def list_attachments\n @artifact_answer = ArtifactAnswer.find(params[:id])\n @attachments = @artifact_answer.attachments\n render layout: false\n end",
"def get_issue_attachments(issue_id_or_key)\n get(\"issues/#{issue_id_or_key}/attachments\")\n end",
"def show\n @attachment_datum = AttachmentDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment_datum }\n end\n end",
"def get_attachment(*params)\n tid = params[0]\n aid = params[1]\n dir = nil\n dir = params[2] if params.size > 2\n if params[0].class == Hash\n params = params[0]\n tid = params[:ticket] if params.has_key? :ticket\n aid = params[:attachment] if params.has_key? :attachment\n dir = params[:dir] if params.has_key? :dir\n end\n tid = $~[1] if tid =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{tid}/attachments/#{aid}\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss HTTP response\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n headers = response_to_h(resp)\n reply = {}\n headers.each do |k,v|\n reply[\"#{k}\"] = v.to_s\n end\n content = resp.match(/Content:\\s+(.*)/m)[1]\n content.gsub!(/\\n\\s{9}/,\"\\n\") # strip leading spaces on each line\n content.chomp!\n content.chomp!\n content.chomp! # 3 carriage returns at the end\n if (RUBY_VERSION.to_f >= 1.9)\n binary = content.encode(\"ISO-8859-1\",\"UTF-8\", { :invalid => :replace, :undef => :replace })\n else\n binary = Iconv.conv(\"ISO-8859-1\",\"UTF-8\",content) # convert encoding\n end\n if dir\n fh = File.new(\"#{dir}/#{headers['Filename'].to_s}\",\"wb\")\n fh.write binary\n fh.close\n else\n reply[\"content\"] = binary\n end\n reply\n end",
"def attachments(message_id, params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment\", params: params)\n end",
"def attachment(name)\n name = name.to_s\n return attachments[name][:file] if @attachments.try(:[], :name).try(:[], :file)\n begin\n result = retrieve_attachment(name)\n @attachments = (@attachments || {}).merge(name => {:file => result[:file], :dirty => false, :content_type => result[:content_type]})\n result[:file]\n rescue RestClient::ResourceNotFound\n nil\n end\n end",
"def get_attachment attachment_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if attachment_index == ''\n raise 'attachment index not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/attachments/' + attachment_index.to_s\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Attachment']\n \n \n rescue Exception=>e\n print e\n end\n end",
"def show\n @attachment = @page.attachments.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @attachment.to_xml }\n end\n end",
"def index\n @attachments = @pad.attachments\n @attachment = @pad.attachments.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attachments }\n end\n end",
"def show\n @attachments = @document.attachments\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def get_attachment(db, locale, version, attachment_name, ttl=settings.long_ttl)\n id = get_topic_or_image_id(locale, version, attachment_name)\n return get_from_db_or_cache(db, id, {:trx => CouchDBTransaction::FETCH_ATTACHMENT, :attachment_name => attachment_name}, ttl)\n end",
"def show\n # These are expected and required by the file_handler route: \"file_attachments/:content_type/:parent_id/:id\"\n id = params[:id]\n parent_id = params[:parent_id]\n \n case params[:content_type]\n when \"PrivateMessage\" \n # Only users involved in PM conversations can view attachments\n file_attachment = PrivateMessage.with_recipients.with_user(session[:user_id]).with_attachments.find(parent_id).file_attachments.find(id)\n when \"NewsArticle\"\n file_attachment = NewsArticle.include_attachments.find(parent_id).file_attachments.find(id)\n else \n end\n \n # Sanitize path to ensure that the path is not pointing anywhere malicious on the server \n path = file_attachment.attachment.path\n raise MissingFile, \"Couldn't read #{file_attachment.attachment_file_name}\" unless\n File.readable?(path) and\n File.file?(path)\n \n send_file file_attachment.attachment.path, :type => file_attachment.attachment_content_type\n end",
"def attachments\n @attachments\n end",
"def get_all_attachments(page_id)\n\n url = \"#{@@conf_url}/#{@@urn}/#{page_id}/child/attachment?os_username=#{@@login}&os_password=#{@@pwd}&status=current\"\n\n begin\n atts = RestClient.get url, :content_type => 'application/json', :accept => 'json'\n rescue RestClient::ExceptionWithResponse => e\n puts Nokogiri.XML(e.response)\n nil\n end\n\n unless atts.nil?\n JSON.parse(atts)[\"results\"]\n end\n end",
"def show\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pattachment }\n end\n end",
"def attachments\n Easybill::Api::Attachments\n end",
"def show\n @meeting = Meeting.find(params[:id])\n @json_from_file = 0\n for file in @meeting.file.attachments\n if file.content_type == 'application/json'\n download_file_from_s3('smartmeetingsbelieving', \"./tmp/\" + file.filename.to_s(), file.filename.to_s())\n @json_from_file = File.read(\"tmp/\" + file.filename.to_s())\n end\n end\n end",
"def get(\n id,\n deadline: nil\n )\n return @account_attachments.get(\n id,\n deadline: deadline,\n )\n end",
"def attachments\n load_object\n load_attachments\n render layout: false\n end",
"def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end",
"def show\n @record_id = params[:id]\n\n # run the where clause globally\n @relevant_record = Record.find(@record_id)\n @relevant_attachments = RecordAttachment.where(record_id: @record_id).order(\"id\")\n\n # make the record attachments an array if it isn't already \n if @relevant_attachments.length > 1\n @record_attachments = @relevant_attachments\n else \n @record_attachments = [@relevant_attachments[0]]\n end\n\n respond_to do |format|\n format.html {}\n format.json { render json: {\n record: @relevant_record, \n attachments: @record_attachments,\n }.to_json }\n end\n end",
"def attachments\n @attachments ||= []\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attachment }\n end\n end",
"def get_email_attachments\n\t\tresp = @resp\n\n\t\tparams[\"email\"] ||= \"\"\n\t\tparams[\"password\"] ||= \"\"\n\n\t\t# Authorize and process attachments in mail account\n\t\tresp = Resume.gmail_attachments(resp, params)\n\n\t\trender :json => resp\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def index\n @post_attachments = PostAttachment.all\n end",
"def get_attachment\n @document = EcoDocument.find(params[:id])\n send_data(@document.data,\n :filename => @document.name,\n :type => @document.content_type,\n :disposition => \"inline\")\n end",
"def show\n @cause_analyasis = CauseAnalysis.find(params[:id])\n @attachment = @cause_analyasis.attachment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cause_analyasis }\n end\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n path = \"/Notes/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIFileAttachment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachments\n parts.attachments\n end",
"def show\n @attached_asset = AttachedAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attached_asset }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def index\n @embedded_attachments = EmbeddedAttachment.page params[:page]\n end",
"def index\n @cms_attachments = Cms::Attachment.all\n end",
"def index\n @pub_attachments = PubAttachment.all\n end",
"def find_attachment(resource_id, attachment_id)\n http.get(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n Rexpense::Entities::Attachment.new response.parsed_body\n end\n end",
"def index\n @file_attachments = FileAttachment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_attachments }\n end\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def show\n @post_attachments = @post.post_attachments.all\n end",
"def attachment\n @attachment\n end",
"def attachments\n if attachment_ids\n attachment_ids.map {|id| Attachment.find(id)}\n else\n []\n end\n end",
"def show\n @file_upload_attachments = @file_upload.file_upload_attachments.all\n end",
"def get_document_attachments_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_attachments ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_attachments\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/attachments\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'AttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attachments\n @attachments ||= ActiveStorage::Attachment.where(record_gid: record.to_gid.to_s, name: name)\n end",
"def show\n @file_attachment = FileAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @file_attachment }\n end\n end",
"def index\n @user_attachments = UserAttachment.all\n end",
"def retrieveImages\n posting = Posting.find(params[:id])\n post_attachments = posting.post_attachments.all\n respond_to do |format|\n format.json { render json: {\n status: 'ok',\n rowcount: post_attachments.length,\n results: post_attachments.map { |b| {\n id: b.id,\n imageData: b.image,\n description: b.description\n }}\n }}\n end\n end",
"def item_only_attachments\n @relevant_object = convert_id_to_model(params[:id])\n @images = @relevant_object.media_items\n end",
"def fetch_attachment(post, attachment_name, attachment_type)\n server_urls = perform_legacy_discovery(post[:entity])\n return unless server_urls.any?\n\n res = server_urls.inject(nil) do |memo, server_url|\n url = \"#{server_url}/posts/#{URI.encode_www_form_component(post[:entity])}/#{post[:public_id]}/attachments/#{attachment_name}\"\n res = Faraday.get(url) do |req|\n req.headers['Accept'] = attachment_type\n end\n\n if res.status == 200\n break res\n end\n\n res\n end\n\n res\n end",
"def index\n @note_attachments = NoteAttachment.all\n end",
"def retrieve_fresh_attachment\n Attachment.find(attachment.id)\n end",
"def get_file_attachments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_file_attachments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_file_attachments\" if id.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/FileAttachments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse2002>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_file_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @file_upload_attachments = FileUploadAttachment.all\n end",
"def get_document_attachments(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_attachments_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def index\n @link_attachments = LinkAttachment.all\n end",
"def attachments\n @_message.attachments\n end",
"def attachments(params={})\n raise ArgumentError, \"Error: ids or attachment_ids must be set\" unless params[:ids] || params[:attachment_ids]\n rpc_call :attachments, params\n end",
"def attachment_get\n c_user = current_user()\n course = Course.where(id: params[:course_id]).first()\n\n # Course not found case\n if course.nil?\n return ( render status: 404, json: { result: \"Course Not Found\" } )\n end\n\n # Course found case\n if params[:type] == \"Document\"\n attache = Document.where(id: params[:attach_id], attachable_id: course.id).first()\n elsif params[:type] == \"Embed\"\n attache = Embed.where(id: params[:attach_id], attachable_id: course.id).first()\n end\n\n # Attachment not found case\n if attache.nil?\n return ( render status: 404, json: { result: \"Attachable Not Found\" } )\n end\n\n # Public case:\n if course.visibility == Visibility.published \n render status: 200, json: { result: attache}\n\n # Authenticated case:\n elsif logged_in? # Ensure that the user is logged in\n # Checks IF user is privledged or owns the course, ELSE return unauthorized\n if c_user.role == Role.admin or c_user.role == Role.moderator or\n c_user.id == course.user_id then\n render status: 200, json: { result: attache }\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n\n # Course is not (public) AND (owned by user and editable) AND (user is not privledged)\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def attachments\n return @attachments\n end",
"def get_attachment_by_message_id(token, id, fields = nil, user = nil)\n request_url = user_context(user) << \"/Messages/\" << id << \"/attachments/\"\n request_params = nil\n\n unless fields.nil?\n request_params = { '$select' => fields.join(',') }\n end\n\n get_message_response = make_api_call \"GET\", request_url, token, request_params\n\n parse_response(get_message_response)\n end",
"def attachment(key)\n # Use to_a.find to take advantage of the eager-loaded attachments and blobs.\n attachments.to_a.find { |a| a.key == key && a.file&.attached? }\n end",
"def show\n @ticket_attachments = @ticket.ticket_attachments.all\n end",
"def index\n @order_attachments = OrderAttachment.all\n end",
"def index\n @gallery_attachments = GalleryAttachment.all\n end",
"def list_attachments_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_attachments ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_attachments\"\n end\n if @api_client.config.client_side_validation && opts[:'alert_identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'alert_identifier_type'])\n fail ArgumentError, 'invalid value for \"alert_identifier_type\", must be one of id, alias, tiny'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/attachments\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'alertIdentifierType'] = opts[:'alert_identifier_type'] if !opts[:'alert_identifier_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\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 => 'ListAlertAttachmentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @attachment = @specification.attachment\n end",
"def get(\n id,\n deadline: nil\n )\n req = V1::AccountAttachmentGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"AccountAttachments.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = AccountAttachmentGetResponse.new()\n resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end",
"def get_mail_attachment\n Log.add_info(request, params.inspect)\n\n attached_id = params[:id].to_i\n begin\n mail_attach = MailAttachment.find(attached_id)\n rescue => evar\n end\n\n if mail_attach.nil?\n redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html')\n return\n end\n\n begin\n email = Email.find(mail_attach.email_id)\n rescue => evar\n end\n if email.nil? or email.user_id != @login_user.id\n render(:text => '')\n return\n end\n\n mail_attach_name = mail_attach.name\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n ie_ver = nil\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n mail_attach_name = CGI::escape(mail_attach_name) unless ie_ver.nil?\n end\n\n filepath = mail_attach.get_path\n if FileTest.exist?(filepath)\n send_file(filepath, :filename => mail_attach_name, :stream => true, :disposition => 'attachment')\n else\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+mail_attach_name+'\"')\n end\n end",
"def get_attachments()\n\t\t\n\t\tmessages = list_of_messages()\n\n\t\t#Initializing Nested Hash so that we can store message_id, file_name and attachemnt id\n\t\tfiles= Hash.new { |l, k| l[k] = Hash.new(&l.default_proc) }\n\t\tmessages.each do |message_id|\n\t\t\n\t\t\t#Create a new request\n\t\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages/#{message_id}?access_token=#{@access_token}\"\n\n\t\t\t#GET REQUEST\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\n\t\t\t#Getting list of attachments based on message id\n\t\t\ttemp = response_body['payload']['parts']\n\t\t\ttemp.each do |item|\n\t\t\t\tif item['filename'] !=''\n\t\t\t\t\tfiles[message_id][item['filename']]=item['body']['attachmentId']\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\t\treturn files\n\tend",
"def show\n @conference=Conference.find(params[:conference_id])\n @issue = @conference.issues.find(params[:id])\n @[email protected]\n respond_to do |format|\n format.html # show.html.erb\n format.js\n end\n end",
"def get_sas_logical_jbod_attachments(client)\n OneviewSDK::Resource.find_with_pagination(client, ATTACHMENT_URI)\n end",
"def show\n attachment = current_attachment\n\n respond_to do |format|\n format.csv do\n send_data(\n attachment.file.blob.download,\n type: 'text/csv',\n filename: \"#{attachment.key}.#{attachment.scenario_id}.csv\"\n )\n end\n\n format.any do\n render json: attachment_json(attachment)\n end\n end\n end",
"def index\n @design_image_attachments = DesignImageAttachment.all\n end"
] |
[
"0.7399194",
"0.7391738",
"0.7391738",
"0.7391738",
"0.7391738",
"0.72952175",
"0.7252977",
"0.7209151",
"0.71989596",
"0.71989596",
"0.7146606",
"0.70339215",
"0.7025872",
"0.7025872",
"0.7025872",
"0.7025872",
"0.7025872",
"0.698809",
"0.6985993",
"0.69612706",
"0.69198835",
"0.6893773",
"0.68756866",
"0.68506324",
"0.68476653",
"0.6831241",
"0.68275887",
"0.68180174",
"0.6814569",
"0.68067837",
"0.6799468",
"0.6767048",
"0.67480165",
"0.6746275",
"0.6708573",
"0.6700624",
"0.66750646",
"0.66695225",
"0.6657029",
"0.6647099",
"0.66341937",
"0.6629845",
"0.657557",
"0.6551472",
"0.65212333",
"0.65212333",
"0.65212333",
"0.6519488",
"0.6500832",
"0.6500832",
"0.64993674",
"0.6490987",
"0.6490403",
"0.64801574",
"0.6458284",
"0.6457385",
"0.6457385",
"0.6456487",
"0.6427962",
"0.64137495",
"0.6397171",
"0.6376565",
"0.6367904",
"0.6360188",
"0.6360188",
"0.635941",
"0.6344573",
"0.63395816",
"0.6337112",
"0.63334686",
"0.6330595",
"0.6312535",
"0.6307839",
"0.6303113",
"0.63030726",
"0.629654",
"0.6278697",
"0.62658674",
"0.6264901",
"0.6257172",
"0.6232156",
"0.6228611",
"0.62200654",
"0.621618",
"0.6215109",
"0.6215109",
"0.6215109",
"0.62038505",
"0.6197456",
"0.61934674",
"0.6183129",
"0.6177526",
"0.61774194",
"0.61773163",
"0.61686903",
"0.6162668",
"0.61442566",
"0.61334467",
"0.61332285",
"0.61230326",
"0.609349"
] |
0.0
|
-1
|
POST /attachments POST /attachments.json
|
def create
hash = []
params[:files].each do |i,file_io|
path = File.join(Rails.root,'public','attach',file_io.original_filename)
File.open(path, "wb") { |f| f.write(file_io.read)}
attachment = Attachment.create do |attach|
attach.name = file_io.original_filename
attach.describe = params[:describe]
end
hash.push attachment
end
render json: hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to \"/\", notice: 'Attachment was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @attachment }\n else\n format.html { render :new }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n respond_to do |format|\n if @post.save\n params[:post_attachments]['avatar'].each do |a|\n @post_attachment = @post.post_attachments.create(:avatar => a, :post_id => @post.id)\n end\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n expire_action( news_url(nil) )\n expire_action( home_url() )\n \n params[:attachments].each do |att|\n @post.attachments.create :uploadedfile=>att\n end if params.has_key?( :attachments )\n \n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to posts_url }\n format.xml { head :created, :location => posts_url }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def multi_upload\n authenticate!\n attachments = []\n (attachment_params[:attachments] || []).each do |key, value|\n if value[:file]\n attachment = value[:file]\n attachment_params = {\n :filename => attachment[:filename],\n :type => attachment[:type],\n :headers => attachment[:head],\n :tempfile => attachment[:tempfile]\n }\n file = ActionDispatch::Http::UploadedFile.new(attachment_params)\n attachments << Attachment.create(file: file, user: current_user)\n end\n end\n {\n code: 0,\n data: attachments\n }\n end",
"def connect_attachments(params)\n json_attachments = params['data'].try(:[], 'relationships').try(:[], 'attachments')\n return if json_attachments.blank?\n\n attachment_list = resource_list('attachment', json_attachments)\n\n attachment_list.each do |attachment|\n attachment.attachable = self\n attachment.save\n end\n end",
"def add_attachments\n frm.button(:value=>\"Add Attachments\").click\n AnnouncementsAttach.new(@browser)\n end",
"def create\n @travel_post_attachment = TravelPostAttachment.new(travel_post_attachment_params)\n\n respond_to do |format|\n if @travel_post_attachment.save\n format.html { redirect_to @travel_post_attachment, notice: 'Travel post attachment was successfully created.' }\n format.json { render :show, status: :created, location: @travel_post_attachment }\n else\n format.html { render :new }\n format.json { render json: @travel_post_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload\n permitted_params = params[:attachment]\n file = permitted_params.delete(:file)\n attr = {file: file, user: current_user}\n\n if permitted_params[:attachmentable_type].present? && permitted_params[:attachmentable_id].present?\n attachmentable_type = permitted_params[:attachmentable_type]\n attachmentable_id = permitted_params[:attachmentable_id]\n attr = attr.merge(attachmentable_type: attachmentable_type, attachmentable_id: attachmentable_id)\n end\n\n attachment = Attachment.new(attr)\n if attachment.savee\n render json:{\n code: 0,\n data: AttachmentSerializer.new(attachment)\n }\n else\n render json:{\n code: -1,\n data: {\n message: attachment.errors.full_messages,\n }\n }\n end\n\n end",
"def create\n @message_attachment = MessageAttachment.new(params[:message_attachment])\n\n respond_to do |format|\n if @message_attachment.save\n format.html { redirect_to @message_attachment, notice: 'Message attachment was successfully created.' }\n format.json { render json: @message_attachment, status: :created, location: @message_attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_attachments attachments\n Attachment.add(attachments, self)\n end",
"def test_issue_attachements\n log_user('jsmith', 'jsmith')\n\n post 'issues/edit/1',\n :notes => 'Some notes',\n :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}\n assert_redirected_to \"issues/show/1\"\n \n # make sure attachment was saved\n attachment = Issue.find(1).attachments.find_by_filename(\"testfile.txt\")\n assert_kind_of Attachment, attachment\n assert_equal Issue.find(1), attachment.container\n assert_equal 'This is an attachment', attachment.description\n # verify the size of the attachment stored in db\n #assert_equal file_data_1.length, attachment.filesize\n # verify that the attachment was written to disk\n assert File.exist?(attachment.diskfile)\n \n # remove the attachments\n Issue.find(1).attachments.each(&:destroy)\n assert_equal 0, Issue.find(1).attachments.length\n end",
"def create\n a=JSON.parse(params.to_json)\n Attachment.create_file(params[:encoded],@current_user)\n respond_to do |format|\n format.json { render :json => success }\n format.xml { render :xml => success }\n end\n end",
"def create\n @post_attachment = PostAttachment.new(post_attachment_params.merge(:post_id => @post.id))\n respond_to do |format|\n if @post.save\n unless params[:post_attachments].nil?\n params[:post_attachments]['picture'].each do |a|\n @post_attachment = @post.post_attachments.create!(:picture => a, :post_id => @post.id)\n end\n else format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :ok, location: @post }\n end\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permitted_attachments_params\n params.permit(attachments: [])\n end",
"def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end",
"def attachments(*params)\n id = params[0]\n unnamed = params[1]\n if params[0].class == Hash\n params = params[0]\n id = params[:id] if params.has_key? :id\n unnamed = params[:unnamed] if params.has_key? :unnamed\n end\n unnamed = false if unnamed.to_s == \"0\"\n id = $~[1] if id =~ /ticket\\/(\\d+)/\n resp = @site[\"ticket/#{id}/attachments\"].get\n resp.gsub!(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n resp.gsub!(/^\\n/m,\"\") # toss blank lines\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/) #replace CF spaces with underscores\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n th = response_to_h(resp)\n list = []\n pattern = /(\\d+:\\s.*?\\))(?:,|$)/\n match = pattern.match(th['attachments'].to_s)\n while match != nil\n list.push match[0]\n s = match.post_match\n match = pattern.match(s)\n end\n attachments = []\n list.each do |v|\n attachment = {}\n m=v.match(/(\\d+):\\s+(.*?)\\s+\\((.*?)\\s+\\/\\s+(.*?)\\)/)\n if m.class == MatchData\n next if m[2] == \"(Unnamed)\" and !unnamed\n attachment[:id] = m[1]\n attachment[:name] = m[2]\n attachment[:type] = m[3]\n attachment[:size] = m[4]\n attachments.push attachment\n end\n end\n attachments\n end",
"def create_attachment\n @artifact_answer = ArtifactAnswer.find(params[:id])\n if params[:file]\n params[:file].each do |attachment|\n @artifact_answer.attachments.create(attachment_file: attachment, :company_id => current_company.id)\n @attachment_error = @artifact_answer.attachments.last.errors[:\"file_size_exceeds\"][0] if @artifact_answer.attachments.last.errors.present?\n end\n end\n @attachments = @artifact_answer.attachments\n end",
"def call(attachments)\n Attachment.where({canvas_user_id: attachment_conf[:canvas_user_id], submission_id: attachment_conf[:submission_id]}).\n delete_all\n attachments.each do |attachment|\n Attachment.create(attachment_conf.merge({date: Time.parse(attachment['updated_at']),\n attachment_id: attachment['id'], image_url: attachment['url'], content_type: attachment['content-type']})\n )\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n params[:ticket_attachments]['image'].each do |i|\n @ticket_attachment = @ticket.ticket_attachments.create!(:image => i)\n end\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment_datum = AttachmentDatum.new(params[:attachment_datum])\n\n respond_to do |format|\n if @attachment_datum.save\n format.html { redirect_to @attachment_datum, notice: 'Attachment datum was successfully created.' }\n format.json { render json: @attachment_datum, status: :created, location: @attachment_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @file_upload_attachment = FileUploadAttachment.new(file_upload_attachment_params)\n\n respond_to do |format|\n if @file_upload_attachment.save\n format.html { redirect_to @file_upload_attachment, notice: 'File upload attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @file_upload_attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @file_upload_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment_params\n params.require(:attachment).permit( :attachment)\n end",
"def create\n @cms_attachment = Cms::Attachment.new(cms_attachment_params)\n\n respond_to do |format|\n if @cms_attachment.save\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @cms_attachment }\n else\n format.html { render :new }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_attachment = EventAttachment.new(event_attachment_params)\n\n respond_to do |format|\n if @event_attachment.save\n format.html { redirect_to @event_attachment, notice: 'Event attachment was successfully created.' }\n format.json { render :show, status: :created, location: @event_attachment }\n else\n format.html { render :new }\n format.json { render json: @event_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachment!(params={})\n raise ArgumentError, \"Error: ids, data, file_name, summary, and content_type are required args\" unless check_params([:ids, :data, :file_name, :summary, :content_type], params)\n rpc_call :add_attachment, params\n end",
"def create\n @applicant = Applicant.find(params[:applicant_id])\n @attachment = @applicant.attachments.build(params[:attachment])\n\n respond_to do |format|\n if @attachment.save!\n @activity = Activity.create \\\n\t :actor => current_user,\n\t :job_id => @applicant.job_id,\n\t :account_id => @applicant.account_id,\n\t :applicant_id => @applicant.id,\n :action => 'attached',\n :subject_id => @attachment.id,\n :subject_type => 'Attachment'\n \n format.html { redirect_to(applicant_path(@applicant), :notice => 'Attachment was successfully created.') }\n format.xml { render :xml => @attachment, :status => :created, :location => @attachment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @friends_attachment = FriendsAttachment.new(friends_attachment_params)\n\n respond_to do |format|\n if @friends_attachment.save\n format.html { redirect_to @friends_attachment, notice: \"Friends attachment was successfully created.\" }\n format.json { render :show, status: :created, location: @friends_attachment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friends_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attachments(issue, args)\n if issue.persisted?\n delete_ids = args[:delete_attachments]\n issue.attachments.in(id: delete_ids).update_all(deleted: true)\n end\n\n return if (attachments.nil? || attachments.empty?)\n\n attachments.each do |attachment|\n if attachment[:id].blank?\n new_file = issue.attachments.build\n new_file.file = attachment[:data] # <json string>\n new_file.save!\n end\n end\n end",
"def create\n @attachment = Attachment.new(uploaded_data: params[:file], col_sep: params[:col_sep], quote_char: params[:quote_char], encoding: params[:encoding])\n @attachment.user = current_user\n @attachment.save!\n # TODO rescue parser errors -> rows empty\n rows = @attachment.rows(4)\n render json: {errors: @attachment.parse_error, id: @attachment.id, rows: rows}, status: :ok\n end",
"def create\n @attachfile = Attachfile.new(attachfile_params)\n\n respond_to do |format|\n if @attachfile.save\n format.html { redirect_to @attachfile, notice: 'Attachfile was successfully created.' }\n format.json { render :show, status: :created, location: @attachfile }\n else\n format.html { render :new }\n format.json { render json: @attachfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end",
"def upload\n requires_user_can :edit, task\n\n attachment = paper_attachment.file\n paper_attachment.worker.download(\n paper,\n paper_attachment.s3_url,\n current_user\n )\n\n render json: attachment,\n status: paper_attachment.existing_file ? 200 : 201,\n root: 'attachment',\n serializer: AttachmentSerializer\n end",
"def create\n @order_attachment = OrderAttachment.new(order_attachment_params)\n\n respond_to do |format|\n if @order_attachment.save\n format.html { redirect_to @order_attachment, notice: 'Order attachment was successfully created.' }\n format.json { render :show, status: :created, location: @order_attachment }\n else\n format.html { render :new }\n format.json { render json: @order_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachments\n frm.button(:name=>\"attach\").click\n AssignmentsAttachments.new(@browser)\n end",
"def create\n params[:travel_post][:user_id] = current_user.id\n @travel_post = TravelPost.new(travel_post_params)\n\n respond_to do |format|\n if @travel_post.save\n if params[:travel_post_attachments].present?\n params[:travel_post_attachments]['s3'].each do |a|\n @travel_post_attachment = @travel_post.travel_post_attachments.create!(:s3 => a, :travel_post_id => @travel_post.id)\n end\n end\n format.html { redirect_to travel_posts_path, notice: 'Travel post was successfully created.' }\n format.json { render :show, status: :created, location: @travel_post }\n else\n format.html { render :new }\n format.json { render json: @travel_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note_attachment = NoteAttachment.new(note_attachment_params)\n\n respond_to do |format|\n if @note_attachment.save\n format.html { redirect_to @note_attachment, notice: 'Note attachment was successfully created.' }\n format.json { render :show, status: :created, location: @note_attachment }\n else\n format.html { render :new }\n format.json { render json: @note_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if !user_signed_in?\n redirect_to login_path, :alert => \"You need to sign in or sign up before continuing.\"\n else\n @post = Post.new(post_params)\n @post.user = current_user\n respond_to do |format|\n if @post.save\n notifyTagUsers(@post)\n\n if params.has_key?(:post_attachments)\n params[:post_attachments]['avatar'].each do |a|\n @post_attachment = @post.post_attachments.create!(:avatar => a)\n end\n end\n\n format.html { redirect_to timeline_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @second = Second.new(params[:second])\n\n #add attachment\n @second.attachments << Attachment.new(:source => params[:attachment]) unless params[:attachment].blank?\n\n respond_to do |format|\n if @second.save\n format.html { redirect_to @second, notice: 'Second was successfully created.' }\n format.json { render json: @second, status: :created, location: @second }\n else\n format.html { render action: \"new\" }\n format.json { render json: @second.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment_params\n params.require(:attachment).permit(:title, :data, :mime_type, :thumbnail, :content)\n end",
"def add_attachments(obj)\n if !email.attachments.nil? && email.attachments.size > 0\n email.attachments.each do |attachment|\n obj.attachments << Attachment.create(:container => obj,\n :file => attachment.decoded,\n :filename => attachment.filename,\n :author => user,\n :content_type => attachment.mime_type)\n end\n end\n end",
"def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def add_attachments(value)\n if value.instance_of? AttachmentJson\n @attachments.push(value)\n end\n end",
"def attachment_params\n params.require(:attachment).permit(:file)\n end",
"def attachment_params\n params.require(:attachment).permit(:file)\n end",
"def create\n @channel = Channel.find_by_name(params[:channel_id])\n @attachment = Attachment.new(params[:attachment])\n\n # {\"file\"=>#<ActionDispatch::Http::UploadedFile:0x00000005bc3158 @original_filename=\"investor_faq.org\", @content_type=\"application/octet-stream\",\n # @headers=\"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"investor_faq.org\\\"\\r\\nContent-Type: application/octet-stream\\r\\n\", @tempfile=#<File:/tmp/RackMultipart20111212-24212-4znzta>>\n # \"commit\"=>\"Upload\",\n # \"utf8\"=>\"✓\",\n # \"authenticity_token\"=>\"SrS7bnPQ76RQJLWOx58bm1uyDsQq5f4FObPLl9Zh+Ao=\",\n # \"remotipart_submitted\"=>\"true\",\n # \"X-Requested-With\"=>\"IFrame\",\n # \"X-Http-Accept\"=>\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01\",\n # \"channel_id\"=>\"Shiro\"\n # }\n\n @attachment.user = current_user\n @attachment.channel = Channel.find_by_name(params[:channel_id])\n @attachment.file = params[:file]\n\n respond_to do |format|\n if @attachment.save\n format.html { }\n format.js\n format.json { render json: @attachment, status: :created }\n else\n format.html { render action: \"new\" }\n format.js\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachments\n frm.button(:value=>\"Add Attachments\").click\n AssignmentAttachments.new(@browser)\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def new\n @attachment = Attachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attachment }\n end\n end",
"def add_attachments\n frm.button(:name=>\"attach\").click\n AssignmentAttachments.new(@browser)\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n if params[:project_attachments]\n params[:project_attachments].each do |a|\n # logger.debug \"New attachment: #{a}\"\n @project_attachment = @project.project_attachments.create!(attachment: a)\n end\n end\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rent_post = RentPost.new(rent_post_params)\n # @post_attachment = @rent_post.post_attachments.build\n\n respond_to do |format|\n if @rent_post.save\n if params[:post_attachments]!=nil\n params[:post_attachments]['image'].each do |a|\n @post_attachment = @rent_post.post_attachments.create!(:image => a, :rent_post_id => @rent_post.id)\n end\n else\n @post_attachment = @rent_post.post_attachments.create!(:image => nil, :rent_post_id => @rent_post.id)\n end\n format.html { redirect_to @rent_post, notice: 'Rent post was successfully created.' }\n format.json { render :show, status: :created, location: @rent_post }\n else\n format.html { render :new }\n format.json { render json: @rent_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @documentable = find_documentable\n @document = @documentable.documents.build(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: t('.notice', document: @document) }\n format.json\n else\n format.html { render :new }\n format.json {\n render json: @document.errors[:attachment], status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @publication = current_user.publications.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n unless params[:publication_attachments].nil?\n params[:publication_attachments]['photo'].each do |a|\n @publication_attachment = @publication.publication_attachments.create!(:photo => a)\n end\n end\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @attachments = []\n @programs_target_program = Programs::TargetedProgram.where(:id => params[:programs_attachment][:program_id]).first\n\n params['attachment'].each do |f|\n doc = Programs::Attachment.new\n doc.attachment = f\n doc.programs_target_program = @programs_target_program\n params[:programs_attachment][:title].present? ? doc.title = params[:programs_attachment][:title] : doc.title = f.original_filename\n doc.author = current_user.email\n doc.save\n @attachments << doc\n\n end unless params['attachment'].nil?\n\n respond_to do |format|\n format.js {}\n end\n\n\n end",
"def create\n @boat_attachment = BoatAttachment.new(boat_attachment_params)\n\n respond_to do |format|\n if @boat_attachment.save\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully posted.' }\n format.json { render :show, status: :created, location: @boat_attachment }\n else\n format.html { render :new }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @attachments = @pad.attachments\n @attachment = @pad.attachments.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attachments }\n end\n end",
"def attachment_params\n params.fetch(:attachment).permit(:file)\n end",
"def attachment_params\n params.require(:attachment).permit(:file_id, :name)\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n \n # set current user as the creator of the attachment \n @attachment.user = User.find(current_user)\n \n #from jquery upload\n @attachment.name = params[:title] if params[:title]\n \n \n if params[:assignment_id]\n @attachment.assignment = Assignment.find(params[:assignment_id])\n @attachment.course = @attachment.assignment.course\n end\n \n respond_to do |format|\n if @attachment.save\n format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }\n format.json { render :json => [@attachment.to_jq_upload].to_json }\n else\n format.html { render action: \"new\" }\n format.json { render :json => [{:error => \"custom_failure\"}], :status => 304 }\n end\n end\n end",
"def create \n return if params[:attachment].blank?\n\n @attachment = Attachment.new\n @attachment.uploaded_file = params[:attachment]\n @attachment.thumbnail = thumb(@attachment.data, 0.25) if @attachment.mime_type =~ /image/\n case \n when params[:publication_id]\n\t @attachment.publications << Publication.find(params[:publication_id])\n when params[:article_id]\n @attachment.articles << Article.find(params[:article_id])\n when params[:issue_id]\n @attachment.issues << Issue.find(params[:issue_id])\n end\n if @attachment.save\n\t flash[:notice] = \"Thank you for your submission...\"\n\t redirect_to :back\n else\n\t flash[:error] = \"There was a problem submitting your attachment.\"\n\t render :action => \"new\"\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n\n if @attachment.model_id != nil\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to \"/#{@attachment.model_name}/#{@attachment.model_id}/edit/\", notice: 'Attachment was successfully created.' }\n format.json { render json: @attachment, status: :created, location: @attachment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end \n end\n\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n if file_data.respond_to?(:read)\n @@world = file_data.read\n xml_contents = file_data.read\n elsif file_data.respond_to?(:path)\n xml_contents = File.read(file_data.path)\n else\n logger.error \"Bad file_data: #{file_data.class.name}: #{file_data.inspect}\"\n end\n\n\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to attachments_path, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @dattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n end\n attachment\n end",
"def create\n\n uploaded_io = params[:new_file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|\n file.write(uploaded_io.read)\n end\n\n @attachment = @pad.attachments.new(params[:attachment])\n @attachment.name = uploaded_io.original_filename;\n\n respond_to do |format|\n if @attachment.save\n format.html { redirect_to(pad_attachments_path(@pad), :notice => 'Attachment was successfully created.') }\n format.xml { render :xml => @attachment, :status => :created, :location => @attachment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_attachments_to_existing_note(note, attachments)\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to note ID #{note.id}\"\n existing_note_attachment_input(note).when_present 1\n existing_note_attachment_input(note).send_keys Utils.asset_file_path(attach.file_name)\n existing_note_attachment_delete_button(note, attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.updated_date = Time.now\n note.attachments << attach\n end\n end",
"def create\n @attachment = Attachment.new(attachment_params)\n @attachment.name = @attachment.file.blob.checksum\n respond_to do |format|\n if @attachment.save\n convert_to_line\n format.html { redirect_to attachment_line_list_path(@attachment), notice: 'Attachment was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def attachments(params={})\n raise ArgumentError, \"Error: ids or attachment_ids must be set\" unless params[:ids] || params[:attachment_ids]\n rpc_call :attachments, params\n end",
"def create\n @teacher_attachment = TeacherAttachment.new(teacher_attachment_params)\n\n respond_to do |format|\n if @teacher_attachment.save\n format.html { redirect_to @teacher_attachment.teacher, notice: 'Teacher attachment was successfully created.' }\n format.json { render :show, status: :created, location: @teacher_attachment }\n else\n format.html { render :new }\n format.json { render json: @teacher_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_attachments_to_new_note(note, attachments)\n show_adv_note_options\n attachments.each do |attach|\n logger.debug \"Adding attachment '#{attach.file_name}' to an unsaved note\"\n new_note_attach_input_element.send_keys Utils.asset_file_path(attach.file_name)\n new_note_attachment_delete_button(attach).when_present Utils.short_wait\n sleep Utils.click_wait\n note.attachments << attach\n end\n end",
"def attachment_upload(id, stream, options={})\n body, headers = http_multipart_data({:id => id, :stream => stream})\n post(\"wrike.attachment.upload\", body, headers)\n end",
"def attachments(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n rt = RT_Client.new\n val = rt.attachments(struct)\n rt = nil\n val\n end",
"def upload_supporting_documents\n validate_documents_content_type\n validate_documents_page_size\n\n claim = ClaimsApi::AutoEstablishedClaim.get_by_id_or_evss_id(params[:id])\n raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Resource not found') unless claim\n\n ClaimsApi::Logger.log(\n '526',\n claim_id: claim.id,\n detail: \"/attachments called with #{documents.length} #{'attachment'.pluralize(documents.length)}\"\n )\n\n documents.each do |document|\n claim_document = claim.supporting_documents.build\n claim_document.set_file_data!(document, EVSS_DOCUMENT_TYPE, params[:description])\n claim_document.save!\n ClaimsApi::ClaimUploader.perform_async(claim_document.id)\n end\n\n render json: claim, serializer: ClaimsApi::ClaimDetailSerializer, uuid: claim.id\n end",
"def create\n @design_image_attachment = DesignImageAttachment.new(design_image_attachment_params)\n\n respond_to do |format|\n if @design_image_attachment.save\n format.html { redirect_to @design_image_attachment, notice: 'Design image attachment was successfully created.' }\n format.json { render :show, status: :created, location: @design_image_attachment }\n else\n format.html { render :new }\n format.json { render json: @design_image_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link_attachment = LinkAttachment.new(link_attachment_params)\n\n respond_to do |format|\n if @link_attachment.save\n format.html { redirect_to @link_attachment, notice: 'Link attachment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_attachment }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attached_asset = AttachedAsset.new(params[:attached_asset])\n\n respond_to do |format|\n if @attached_asset.save\n format.html { redirect_to @attached_asset, notice: 'Attached asset was successfully created.' }\n format.json { render json: @attached_asset, status: :created, location: @attached_asset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attached_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n params[:case_attachments]['photo'].each do |a|\n @case_attachment = @case.case_attachments.create!(:photo => a, :case_id => @case.id)\n end\n format.html { redirect_to admin_cases_path, notice: \"Caso Clínico (#{@case.title}), cadastrado com sucesso!\" }\n format.json { render :show, status: :created, location: [:admin, @case] }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:)\n @client.post(@webhook_url) do |request|\n request.headers['Content-Type'] = 'application/json'\n request.body = {\n channel: channel,\n username: username,\n icon_url: icon_url,\n attachments: attachments,\n link_names: link_names\n }.to_json\n end\n end",
"def create\n @incidentattachment = Incidentattachment.new(incidentattachment_params)\n @incidentattachment.filepath = \"N/A\"\n\n respond_to do |format|\n if @incidentattachment.save\n format.html { redirect_to @incidentattachment, notice: 'Incidentattachment was successfully created.' }\n format.json { render :show, status: :created, location: @incidentattachment }\n else\n format.html { render :new }\n format.json { render json: @incidentattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @event = Event.find(params[:event_id])\n file = {}\n\n if params[:flash]\n file[\"name\"] = params[:Filedata].original_filename\n \n extname = File.extname(params[:Filedata].original_filename)[1..-1]\n mime_type = Mime::Type.lookup_by_extension(extname)\n params[:Filedata].content_type = mime_type.to_s unless mime_type.nil?\n\n file[\"attached\"] = params[:Filedata]\n else\n file[\"name\"] = params[:attached].original_filename\n file[\"attached\"] = params[:attached]\n end\n\n file[\"event_id\"] = @event.id\n @attached = Attached.new(file)\n \n\n respond_to do |format|\n if @attached.save\n format.html { redirect_to @event, notice: 'File was successfully uploaded.' }\n format.json { render json: @attached, status: :created, location: @attached }\n else\n format.html { render action: \"edit\"}\n format.json { render json: @attached.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attachment = Attachment.new(params[:attachment])\n @attachment.save\n\n flash[:notice] = 'El archivo ha sido subido correctamente.'\n\n return redirect_to :action => :index\n end",
"def post(path = '/files/', params = {})\n request :post, path, params\n end",
"def add_attachments\n frm.button(:value=>/(Add|Add \\/ Remove) Attachments/).click\n AssignmentsAttachments.new(@browser)\n end",
"def create\n @cms_attachment = current_portal.cms_attachments.build(cms_attachment_params)\n\n respond_to do |format|\n if @cms_attachment.save\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @cms_attachment }\n else\n format.html { render :new }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attachment; end",
"def dispatch_create_item!(msg)\n if msg.has_attachments?\n draft = msg.draft\n msg.draft = true\n resp = validate_created_item(ews.create_item(msg.to_ews))\n msg.file_attachments.each do |f|\n next unless f.kind_of?(File)\n resp.add_file_attachment(f)\n end\n if draft\n resp.submit_attachments!\n resp\n else\n resp.submit!\n end\n else\n resp = ews.create_item(msg.to_ews)\n validate_created_item resp\n end\n end",
"def create\n @message = Message.new(message_params)\n @message[:external_links] = params[:message][:external_links].first.split(\"\\r\\n\").map(&:strip)\n @message.images.attach(params[:message][:images])\n @message.images.attach(params[:message][:vi_images])\n @message.images.attach(params[:message][:zh_cn_images])\n @message.images.attach(params[:message][:zh_tw_images])\n @message.images.attach(params[:message][:hmn_images])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: \"Message was successfully created.\" }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(document_params)\n # @document.images.attach(params[:document][:images])\n respond_to do |format|\n if @document.save\n @records = Document.all.with_attached_images\n\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n\n respond_to do |format|\n if @event.save\n params[:event_attachments]['image'].each do |a|\n @event_attachment = @event.event_attachments.create!(:image => a, :event_id => @event.id)\n end\n format.html { redirect_to edit_event_path(@event), notice: 'event was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n p_attr = params[:post_attachment]\n #note that the name of the file is a little different with blueimp uploader\n ttt=[]\n uuu = params[:post_attachment].first if params[:post_attachment].class == Array\n #ttt[:image]=uuu\n# uuu = []\n# uuu[:image] = ttt\n @posting=Posting.find(params[:id])\n @picture = @posting.post_attachments.build\n @picture.image=uuu\n\n if @picture.save\n respond_to do |format|\n format.html {\n render :json => [@picture.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => { :files => [@picture.to_jq_upload] }\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n\n# @post_attachment = PostAttachment.new(post_attachment_params)\n# if !@post_attachment.image.nil?\n# respond_to do |format|\n# if @post_attachment.save\n# format.html { redirect_to @post_attachment, notice: 'Post attachment was successfully created.' }\n# format.json { render :show, status: :created, location: @post_attachment }\n# else\n# format.html { render :new }\n# format.json { render json: @post_attachment.errors, status: :unprocessable_entity }\n# end\n# end\n# end\n end",
"def deliver(opts = {})\n options = OpenStruct.new(opts)\n params = params_from(options)\n response = client.post(path, params, attachments: options.attachments).parsed_body\n new(response)\n end",
"def post_multipart(url, data, filename, headers = {})\n request(:post, url, headers, {:data => data, :file => filename, :multipart => true})\n end",
"def post_params\n params.require(:post).permit(:title, post_attachments_attributes: [:id, :post_id, :avatar])\n end"
] |
[
"0.67848635",
"0.67172647",
"0.67172647",
"0.6709618",
"0.66656864",
"0.66315144",
"0.6592286",
"0.6520801",
"0.65067184",
"0.64586616",
"0.6454223",
"0.6452402",
"0.6448785",
"0.6444251",
"0.6421693",
"0.64028513",
"0.638763",
"0.6360143",
"0.6320735",
"0.63047457",
"0.6304235",
"0.62684697",
"0.62491125",
"0.623571",
"0.6224318",
"0.62074506",
"0.62040484",
"0.61962914",
"0.6185566",
"0.6181994",
"0.61738896",
"0.6169538",
"0.6149899",
"0.6142146",
"0.6140993",
"0.6109077",
"0.61045",
"0.6099959",
"0.6097114",
"0.6068943",
"0.60686046",
"0.60658246",
"0.60650253",
"0.60633594",
"0.6044726",
"0.60374826",
"0.6031178",
"0.60300004",
"0.60256976",
"0.6005578",
"0.6005578",
"0.6001899",
"0.6000562",
"0.59992427",
"0.5998524",
"0.5998524",
"0.599275",
"0.59909606",
"0.5961802",
"0.59346515",
"0.59254104",
"0.5925149",
"0.5920297",
"0.59124464",
"0.5901047",
"0.5897807",
"0.58908993",
"0.58903885",
"0.588441",
"0.5883923",
"0.58741856",
"0.58666605",
"0.5856384",
"0.58542526",
"0.5847116",
"0.5841076",
"0.58315873",
"0.5822478",
"0.58220243",
"0.58216035",
"0.5813458",
"0.5813237",
"0.57915217",
"0.5783962",
"0.5781262",
"0.57793343",
"0.5773601",
"0.5768677",
"0.5767304",
"0.57632405",
"0.576107",
"0.57597935",
"0.57529277",
"0.57520187",
"0.57490474",
"0.57436305",
"0.57422215",
"0.5741949",
"0.5741865",
"0.57406974"
] |
0.67279613
|
1
|
PATCH/PUT /attachments/1 PATCH/PUT /attachments/1.json
|
def update
respond_to do |format|
if @attachment.update(attachment_params)
format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { head :no_content }\n format.json { head :no_content }\n else\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find_by_name(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n end",
"def update\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to @attachment, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attachment.update(attachment_params)\n format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @attachment }\n else\n format.html { render :edit }\n format.json { render json: @attaessay_file_namechment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n if @attachment.model_id != nil\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to \"/#{@attachment.model_name}/#{@attachment.model_id}/edit/\", notice: 'Attachment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n else \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end \n end\n end",
"def update\n @message_attachment = MessageAttachment.find(params[:id])\n\n respond_to do |format|\n if @message_attachment.update_attributes(params[:message_attachment])\n format.html { redirect_to @message_attachment, notice: 'Message attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attachments(issue, args)\n if issue.persisted?\n delete_ids = args[:delete_attachments]\n issue.attachments.in(id: delete_ids).update_all(deleted: true)\n end\n\n return if (attachments.nil? || attachments.empty?)\n\n attachments.each do |attachment|\n if attachment[:id].blank?\n new_file = issue.attachments.build\n new_file.file = attachment[:data] # <json string>\n new_file.save!\n end\n end\n end",
"def ti_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def co_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update!(**args)\n @add_attachments = args[:add_attachments] if args.key?(:add_attachments)\n end",
"def update\n respond_to do |format|\n if @file_upload_attachment.update(file_upload_attachment_params)\n format.html { redirect_to @file_upload_attachment, notice: 'File upload attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_upload_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to attachments_path, notice: 'El archivo ha sido cambiado de categoria correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to(@attachment, :notice => 'Attachment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { redirect_to(@attachment, :notice => 'Attachment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_attachment.update(user_attachment_params)\n format.html { redirect_to @user_attachment, notice: 'User attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cc_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n if params[:project_attachments]\n params[:project_attachments].each do |a|\n # logger.debug \"New attachment: #{a}\"\n @project_attachment = @project.project_attachments.create!(attachment: a)\n end\n end\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n flash[:notice] = 'Attachment was successfully updated.'\n format.html { redirect_to(@attachment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @file_attachment = FileAttachment.find(params[:id])\n\n respond_to do |format|\n if @file_attachment.update_attributes(params[:file_attachment])\n flash[:notice] = 'FileAttachment was successfully updated.'\n format.html { redirect_to(@file_attachment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @file_attachment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def of_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment_changed = true\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update\n respond_to do |format|\n if @event_attachment.update(event_attachment_params)\n format.html { redirect_to @event_attachment, notice: 'Event attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_attachment }\n else\n format.html { render :edit }\n format.json { render json: @event_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attached = Attached.find(params[:id])\n\n respond_to do |format|\n if @attached.update_attributes(params[:attached])\n format.html { redirect_to @attached, notice: 'Attached was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attached.errors, status: :unprocessable_entity }\n end\n end\n end",
"def si_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment_changed = true\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update\n respond_to do |format|\n if @order_attachment.update(order_attachment_params)\n format.html { redirect_to @order_attachment, notice: 'Order attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_attachment }\n else\n format.html { render :edit }\n format.json { render json: @order_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_attachment.update(cms_attachment_params)\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_attachment }\n else\n format.html { render :edit }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_attachment.update(cms_attachment_params)\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_attachment }\n else\n format.html { render :edit }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_note\n id = unsafe_params[:id].to_i\n fail \"id needs to be an Integer\" unless id.is_a?(Integer)\n\n title = unsafe_params[:title]\n fail \"title needs to be a String\" unless title.is_a?(String)\n\n content = unsafe_params[:content] || \"\"\n fail \"content needs to be a String\" unless content.is_a?(String)\n\n attachments_to_save = unsafe_params[:attachments_to_save] || []\n fail \"attachments_to_save needs to be an array\" unless attachments_to_save.is_a?(Array)\n\n attachments_to_delete = unsafe_params[:attachments_to_delete] || []\n fail \"attachments_to_delete neeeds to be an array\" unless attachments_to_delete.is_a?(Array)\n\n note = nil\n Note.transaction do\n note = Note.find_by!(id: unsafe_params[:id])\n fail '' unless note.editable_by?(@context)\n\n attachments_to_save.each do |uid|\n item = item_from_uid(uid)\n note.attachments.find_or_create_by(item: item)\n end\n\n attachments_to_delete.each do |uid|\n item = item_from_uid(uid)\n note.attachments.where(item: item).destroy_all\n end\n\n note.update!(title: title, content: content)\n end\n\n render json: {\n id: note.id,\n path: note_path(note),\n }\n end",
"def update\n respond_to do |format|\n if @attachment.update(programs_attachment_params)\n format.js {}\n format.json { head :no_content, status: :updated }\n else\n format.js { render status: :unprocessable_entity }\n format.json { render json: @attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attachfile.update(attachfile_params)\n format.html { redirect_to @attachfile, notice: 'Attachfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @attachfile }\n else\n format.html { render :edit }\n format.json { render json: @attachfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pattachment = Pattachment.find(params[:id])\n\n respond_to do |format|\n if @pattachment.update_attributes(params[:pattachment])\n format.html { redirect_to @pattachment, notice: 'Pattachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n upload = params.require(:file)\n handler = create_handler(params[:id], upload)\n\n if handler.valid?\n render json: attachment_json(handler.call)\n else\n render json: errors_json(handler), status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @incidentattachment.update(incidentattachment_params)\n format.html { redirect_to @incidentattachment, notice: 'Incidentattachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentattachment }\n else\n format.html { render :edit }\n format.json { render json: @incidentattachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n expire_action( news_url(:slug=>@post.slug) )\n expire_action( news_url(nil) )\n expire_action( home_url() )\n\n # Add/Remove attachments\n params[:attachments].each do |att|\n @post.attachments.create :uploadedfile=>att\n end if params.has_key?( :attachments )\n params[:removed_attachments].each do |att_id|\n begin # Let's be safe about it...\n @post.attachments.find(att_id).destroy\n rescue\n STDERR.puts \"#{att_id} isn't a valid ID for this post.\"\n end\n end if params.has_key?( :removed_attachments )\n\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to posts_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def put_attachment(name)\n return unless attachments[name]\n result = JSON.parse(RestClient.put(\"#{ uri }/#{ CGI.escape(name) }#{ '?rev=' + @_rev if @_rev }\", attachments[name][:file], {:content_type => attachments[name][:content_type], :accept => 'text/json'}))\n @_rev = result['rev']\n end",
"def update\n respond_to do |format|\n if @friends_attachment.update(friends_attachment_params)\n format.html { redirect_to @friends_attachment, notice: \"Friends attachment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friends_attachment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @friends_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attachment_datum = AttachmentDatum.find(params[:id])\n\n respond_to do |format|\n if @attachment_datum.update_attributes(params[:attachment_datum])\n format.html { redirect_to @attachment_datum, notice: 'Attachment datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attachment_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n attachment = Attachment.find_by!(:slug => params[:id],\n :conversation_id => current_account.conversation_ids + [nil])\n\n if params[:task_list] and !params[:task_list][:tasks].empty?\n attachment.update_attribute(:tasks, params[:task_list][:tasks])\n end\n\n render :json => attachment\n end",
"def attachment_edit\n c_user = current_user()\n return ( render status: 401, json: { result: \"Not Authorized\" } ) unless logged_in? # Ensure the user is logged in\n course = Course.where(id: params[:course_id]).first()\n\n # Course Not Found case\n if course.nil?\n return ( render status: 404, json: { result: \"Course Not Found\" } )\n end\n\n # Course found case\n if attach_type_params[:type] == \"Document\"\n attache = Document.where(id: params[:attach_id], attachable_id: course.id).first()\n elsif attach_type_params[:type] == \"Embed\"\n attache = Embed.where(id: params[:attach_id], attachable_id: course.id).first()\n else\n render status: 400, json: { result: \"Invalid Type\" }\n end\n\n # Attachment not found case\n if attache.nil?\n return ( render status: 404, json: { result: \"Attachable Not Found\" } )\n end\n\n # Draft Course case\n if course.visibility == Visibility.draft and course.user_id == c_user.id and attache.class != Embed\n status = update_attachable(params[:attach_id], course.id, attach_params)\n if status\n render status: 200, json: { result: attache }\n else\n render status: 400, json: { result: attache.errors }\n end\n\n # Privledged User case\n elsif c_user.role == Role.admin or c_user.role == Role.moderator\n status = update_attachable(params[:attach_id], course.id, attach_params) \n if status\n render status: 200, json: { result: attache }\n else\n render status: 400, json: { result: attache.errors }\n end\n\n # Course is not (owned by user and editable) AND (user is not privledged)\n else\n render status: 401, json: { result: \"Not Authorized\" }\n end\n end",
"def update\n respond_to do |format|\n if @link_attachment.update(link_attachment_params)\n format.html { redirect_to @link_attachment, notice: 'Link attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @body = args[:body] if args.key?(:body)\n @create_time = args[:create_time] if args.key?(:create_time)\n @name = args[:name] if args.key?(:name)\n @permissions = args[:permissions] if args.key?(:permissions)\n @title = args[:title] if args.key?(:title)\n @trash_time = args[:trash_time] if args.key?(:trash_time)\n @trashed = args[:trashed] if args.key?(:trashed)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @initiator = args[:initiator] if args.key?(:initiator)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] unless args[:attachment_id].nil?\n @data = args[:data] unless args[:data].nil?\n @size = args[:size] unless args[:size].nil?\n end",
"def update\n respond_to do |format|\n if @embedded_attachment.update(embedded_attachment_params)\n format.html { redirect_to @embedded_attachment, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @embedded_attachment }\n else\n format.html { render :edit }\n format.json { render json: @embedded_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @note_attachment.update(note_attachment_params)\n format.html { redirect_to @note_attachment.note, notice: 'Note attachment was successfully updated.' }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @boat_attachment.update(boat_attachment_params)\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_attachment }\n else\n format.html { render :edit }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @pdf_attachment.update(pdf_attachment_params)\n format.html { redirect_to @pdf_attachment, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @pdf_attachment }\n else\n format.html { render :edit }\n format.json { render json: @pdf_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n respond_to do |format|\n if @case.update(case_params)\n params[:case_attachments]['photo'].each do |a|\n @case_attachment = @case.case_attachments.create!(:photo => a, :case_id => @case.id)\n end\n format.html { redirect_to admin_cases_path, notice: \"Caso Clínico (#{@case.title}), alterado com sucesso!\" }\n format.json { render :show, status: :ok, location: [:admin, @case] }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting.update(edit_params)\n @meeting.file.attach(params[:meeting][:my_file])\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n analyze\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property_attachment.update(property_attachment_params)\n format.html { redirect_to @property_attachment, notice: \"Property attachment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property_attachment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachments = args[:attachments] if args.key?(:attachments)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @value = args[:value] if args.key?(:value)\n end",
"def update\n respond_to do |format|\n if @teacher_attachment.update(teacher_attachment_params)\n format.html { redirect_to @teacher_attachment, notice: 'Teacher attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher_attachment }\n else\n format.html { render :edit }\n format.json { render json: @teacher_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @capa = Capa.find(params[:id])\n\n respond_to do |format|\n if @capa.update_attributes(params[:capa])\n unless params[:capa_files].blank?\n params[:capa_files]['file'].each do |a|\n @capa_file = @capa.capa_files.create!(:file => a, :capa_id => @capa.id)\n end\n end\n format.html { redirect_to @capa, notice: 'Capa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n \n if @cookbook.update_attributes_individually params[:cookbook]\n flash[:notice] = 'The template was updated.'\n end\n respond_to do |format|\n format.js { render :update, content_type: \"text/plain\" }\n end\n end",
"def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end",
"def update\n respond_to do |format|\n if @product_attachment.update(product_attachment_params)\n format.html { redirect_to @product_attachment, notice: 'Product attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_attachment }\n else\n format.html { render :edit }\n format.json { render json: @product_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @knowledge_article.update(knowledge_article_params)\n #update file attachments\n\n format.html { redirect_to @knowledge_article, notice: 'Knowledge article was successfully updated.' }\n format.json { render :show, status: :ok, location: @knowledge_article }\n else\n format.html { render :edit }\n format.json { render json: @knowledge_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @travel_post_attachment.update(travel_post_attachment_params)\n format.html { redirect_to @travel_post_attachment, notice: 'Travel post attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_post_attachment }\n else\n format.html { render :edit }\n format.json { render json: @travel_post_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attached_asset = AttachedAsset.find(params[:id])\n\n respond_to do |format|\n if @attached_asset.update_attributes(params[:attached_asset])\n format.html { redirect_to @attached_asset, notice: 'Attached asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attached_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @client_name_space = args[:client_name_space] if args.key?(:client_name_space)\n @comment = args[:comment] if args.key?(:comment)\n @messages = args[:messages] if args.key?(:messages)\n @type_id = args[:type_id] if args.key?(:type_id)\n end",
"def update\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Updated successfully.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_name = args[:attachment_name] if args.key?(:attachment_name)\n @namespaced_type = args[:namespaced_type] if args.key?(:namespaced_type)\n @data = args[:data] if args.key?(:data)\n end",
"def update\n # if params[:filename].present? \n # display_name = params[:filename] \n # else \n # display_name = \"#{@lookbook.name}-lookbook-#{@lookbook.galleries.count + 1}\"\n # end\n # @latestAttach = LookbookPhotoGallery.create(:attachment => params[:attachment], :attachable => @lookbook, :file_name => display_name) if params[:attachment]\n\n @lookbook.update ( admin_lookbook_params )\n \n respond_to do |format|\n if @lookbook.save\n if admin_lookbook_params[:status] == 'enable'\n Lookbook.where.not(id: @lookbook).update_all(status: 'disable')\n end\n\n format.html { redirect_to edit_admin_lookbook_path(@lookbook), notice: 'Successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: :back }\n format.json { render json: @lookbook.errors, status: :unprocessable_entity }\n end\n end\n\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 @design_image_attachment.update(design_image_attachment_params)\n format.html { redirect_to @design_image_attachment, notice: 'Design image attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @design_image_attachment }\n else\n format.html { render :edit }\n format.json { render json: @design_image_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attachment(args={})\n raise ArgumentError unless args[:file] && args[:name]\n return unless has_attachment?(args[:name])\n delete_attachment(args[:name])\n set_attachment_attr(args)\n rescue ArgumentError => e\n raise ArgumentError, 'You must specify :file and :name'\n end",
"def update\n respond_to do |format|\n if @gallery_attachment.update(gallery_attachment_params)\n format.html { redirect_to @gallery_attachment.gallery, notice: 'Gallery attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @gallery_attachment }\n else\n format.html { render :edit }\n format.json { render json: @gallery_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n end",
"def update\n respond_to do |format|\n if @pub_attachment.update(pub_attachment_params)\n format.html { redirect_to root_path, notice: 'Pub attachment was successfully updated.' }\n format.js\n else\n format.html { render :edit }\n format.js\n end\n end\n end",
"def update!(**args)\n @body = args[:body] unless args[:body].nil?\n @filename = args[:filename] unless args[:filename].nil?\n @headers = args[:headers] unless args[:headers].nil?\n @mime_type = args[:mime_type] unless args[:mime_type].nil?\n @part_id = args[:part_id] unless args[:part_id].nil?\n @parts = args[:parts] unless args[:parts].nil?\n end",
"def update\n respond_to do |format|\n if @work_order_attachment.update(work_order_attachment_params)\n format.html { redirect_to @work_order_attachment, notice: 'Work order attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_order_attachment }\n else\n format.html { render :edit }\n format.json { render json: @work_order_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post_attachment.update(post_attachment_params)\n format.html { redirect_to @post_attachment.post, notice: 'Post attachment was successfully updated.' }\n end \n end\nend",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @aboutshetuan = Aboutshetuan.find(params[:id])\n\n respond_to do |format|\n if @aboutshetuan.update_attributes(params[:aboutshetuan])\n Attachment.create(:attachment => params[:attachment], :attachmentable => @aboutshetuan) if params[:attachment]\n format.html { redirect_to @aboutshetuan, notice: 'Aboutshetuan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aboutshetuan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify(name: nil, avatar: nil, channel_id: nil)\n RestClient.patch(@url, { name: name, avatar: avatarise(avatar), channel_id: channel_id }.compact.to_json, content_type: :json)\n end",
"def update\n respond_to do |format|\n if @stock_attachment.update(stock_attachment_params)\n format.html { redirect_to @stock_attachment, notice: 'Stock attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_attachment }\n else\n format.html { render :edit }\n format.json { render json: @stock_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n unless params[:draft_img].blank?\n attachment = Attachment.create(attachment_entity_type: \"Article\",attachment_entity_id: @article.id , path: params[:draft_img], created_by: 1 ) \n @article.cover_img = attachment.id\n @article.save\n end\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.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!(**args)\n @addon_attachments = args[:addon_attachments] if args.key?(:addon_attachments)\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n @content_name = args[:content_name] if args.key?(:content_name)\n @content_type = args[:content_type] if args.key?(:content_type)\n @download_uri = args[:download_uri] if args.key?(:download_uri)\n @drive_data_ref = args[:drive_data_ref] if args.key?(:drive_data_ref)\n @name = args[:name] if args.key?(:name)\n @source = args[:source] if args.key?(:source)\n @thumbnail_uri = args[:thumbnail_uri] if args.key?(:thumbnail_uri)\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n @content_name = args[:content_name] if args.key?(:content_name)\n @content_type = args[:content_type] if args.key?(:content_type)\n @download_uri = args[:download_uri] if args.key?(:download_uri)\n @drive_data_ref = args[:drive_data_ref] if args.key?(:drive_data_ref)\n @name = args[:name] if args.key?(:name)\n @source = args[:source] if args.key?(:source)\n @thumbnail_uri = args[:thumbnail_uri] if args.key?(:thumbnail_uri)\n end",
"def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end",
"def update\n respond_to do |format|\n if @pin_attachment.update(pin_attachment_params)\n format.html { redirect_to @pin_attachment, notice: 'Pin attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pin_attachment }\n else\n format.html { render :edit }\n format.json { render json: @pin_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @deliverable = Deliverable.find(params[:id])\n\n\n there_is_an_attachment = params[:deliverable_attachment][:attachment]\n if there_is_an_attachment\n\n @attachment = DeliverableAttachment.new(params[:deliverable_attachment])\n @attachment.submitter = current_person\n @deliverable.attachment_versions = @attachment\n @attachment.deliverable = @deliverable\n\n if @attachment.valid? and @deliverable.valid? and @deliverable.update_attributes(params[:deliverable])\n @deliverable.send_deliverable_upload_email(url_for(@deliverable))\n flash[:notice] = 'Deliverable was successfully updated.'\n redirect_to(@deliverable)\n else\n render :action => \"edit\"\n end\n else\n if @deliverable.valid? and @deliverable.update_attributes(params[:deliverable])\n flash[:notice] = 'Deliverable was successfully updated.'\n redirect_to(@deliverable)\n else\n render :action => \"edit\"\n end\n end\n\n\n end",
"def update\n @specification.attachment.updated_by = current_user\n if @specification.update_attributes(specification_params)\n CommonActions.notification_process('Specification', @specification)\n respond_with @specification\n else\n respond_with @specification\n end\n end",
"def update\n respond_to do |format|\n if @subject_file.update(subject_file_params)\n format.html { redirect_to @subject_file, notice: 'Subject file was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_file }\n else\n format.html { render :edit }\n format.json { render json: @subject_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n\n if params[:photo_attachment]\n @video.photo_attachment.delete if @video.photo_attachment\n Attachment.create(media: params[:photo_attachment], attachmentable: @video) \n end\n\n if params[:video_attachment]\n @video.video_attachment.delete if @video.video_attachment\n Attachment.create(media: params[:video_attachment], attachmentable: @video) \n end\n\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_issue_attachements\n log_user('jsmith', 'jsmith')\n\n post 'issues/edit/1',\n :notes => 'Some notes',\n :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}\n assert_redirected_to \"issues/show/1\"\n \n # make sure attachment was saved\n attachment = Issue.find(1).attachments.find_by_filename(\"testfile.txt\")\n assert_kind_of Attachment, attachment\n assert_equal Issue.find(1), attachment.container\n assert_equal 'This is an attachment', attachment.description\n # verify the size of the attachment stored in db\n #assert_equal file_data_1.length, attachment.filesize\n # verify that the attachment was written to disk\n assert File.exist?(attachment.diskfile)\n \n # remove the attachments\n Issue.find(1).attachments.each(&:destroy)\n assert_equal 0, Issue.find(1).attachments.length\n end",
"def connect_attachments(params)\n json_attachments = params['data'].try(:[], 'relationships').try(:[], 'attachments')\n return if json_attachments.blank?\n\n attachment_list = resource_list('attachment', json_attachments)\n\n attachment_list.each do |attachment|\n attachment.attachable = self\n attachment.save\n end\n end",
"def update!(**args)\n @attachment = args[:attachment] if args.key?(:attachment)\n @segment = args[:segment] if args.key?(:segment)\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update\n error = []\n attachment = params[:kyu_entry].delete :attachment\n respond_to do |format|\n if @kyu_entry.update_attributes(params[:kyu_entry])\n update_entry = render_to_string(partial: \"kyu_entry\",\n locals:{kyu_entry: @kyu_entry})\n format.json { render json: update_entry.to_json}\n else\n format.json { render json: @kyu_entry.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end"
] |
[
"0.7022153",
"0.6942577",
"0.69111156",
"0.68939614",
"0.68939614",
"0.6827708",
"0.6826713",
"0.6723745",
"0.662861",
"0.66023237",
"0.6596154",
"0.6584143",
"0.65676963",
"0.653716",
"0.65124995",
"0.63956416",
"0.63918567",
"0.63918567",
"0.63719565",
"0.63521653",
"0.6332685",
"0.63236463",
"0.6316503",
"0.6313843",
"0.62944484",
"0.6289597",
"0.6274754",
"0.62542367",
"0.6246101",
"0.6246101",
"0.62265444",
"0.6226288",
"0.621339",
"0.6201651",
"0.61825013",
"0.6172367",
"0.6164207",
"0.61631763",
"0.6142435",
"0.61246234",
"0.6105734",
"0.6102595",
"0.6081364",
"0.6076413",
"0.6065365",
"0.60355663",
"0.60230726",
"0.60226977",
"0.60160774",
"0.5992131",
"0.5990701",
"0.5969575",
"0.5969477",
"0.59491146",
"0.5946962",
"0.5945499",
"0.5938844",
"0.5935553",
"0.59350514",
"0.59113157",
"0.59042466",
"0.59005886",
"0.5893759",
"0.5886383",
"0.5884757",
"0.58824795",
"0.58815134",
"0.5874336",
"0.5868616",
"0.58679146",
"0.58665806",
"0.58440155",
"0.58256245",
"0.5823869",
"0.5811526",
"0.5809323",
"0.58048064",
"0.58038014",
"0.5793216",
"0.57912254",
"0.578898",
"0.57576203",
"0.57405084",
"0.5739821",
"0.573543",
"0.57302755",
"0.57302755",
"0.5715781",
"0.5713713",
"0.57125396",
"0.5709154",
"0.5708684",
"0.5704343",
"0.57036406",
"0.5701305",
"0.56985295",
"0.5683208",
"0.5682927",
"0.56686425"
] |
0.68190664
|
8
|
DELETE /attachments/1 DELETE /attachments/1.json
|
def destroy
@attachment.destroy
respond_to do |format|
format.html { redirect_to attachments_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @attachment = Attachment.find_by_name(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.present?\n @attachments.destroy\n render :json=>{:response=>\"success\"}\n\t\tend\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message_attachment = MessageAttachment.find(params[:id])\n @message_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to message_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.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 @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(attachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_upload_attachment.destroy\n respond_to do |format|\n format.html { redirect_to file_upload_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n #TODO: delete file from disk (folder too)\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.js { render :nothing => true }\n format.json { render :json => true }\n end\n end",
"def destroy\n @attachment_datum = AttachmentDatum.find(params[:id])\n @attachment_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to attachment_data_url }\n format.json { head :no_content }\n end\n end",
"def delete\n model.delete_attachment(@path)\n end",
"def destroy\n @link_attachment.destroy\n respond_to do |format|\n format.html { redirect_to link_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.detach\n head :no_content\n end",
"def destroy\n @post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to post_attachments_url, notice: 'Post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.file.purge\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: 'Attachment was successfully destroyed.' }\n end\n end",
"def delete\n Attachment.destroy(params[:id]) unless params[:id].blank? if request.delete?\n @attachment_count = params[:attachment_number] || 0\n end",
"def destroy\n @attachfile.destroy\n respond_to do |format|\n format.html { redirect_to attachfiles_url, notice: 'Attachfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(pad_attachments_path(@pad)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pattachment = Pattachment.find(params[:id])\n @pattachment.destroy\n\n respond_to do |format|\n format.html { redirect_to pattachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy_attachment\n a = Attachment.find(1) rescue nil\n if !a.nil?\n a.destroy\n end\n end",
"def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n flash[:notice] = 'attachment was successfully destroyed.'.t\n respond_to do |format|\n format.html { redirect_to page_attachments_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @note_attachment.destroy\n respond_to do |format|\n format.html { redirect_to note_attachments_url, notice: 'Note attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incidentattachment.destroy\n respond_to do |format|\n format.html { redirect_to incidentattachments_url, notice: 'Incidentattachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_post_attachment.destroy\n respond_to do |format|\n format.html { redirect_to travel_post_attachments_url, notice: 'Travel post attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attachment.destroy\n respond_to do |format|\n format.js {}\n end\n\n end",
"def destroy\n @event_attachment.destroy\n respond_to do |format|\n format.html { redirect_to event_attachments_url, notice: 'Event attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_attachment.destroy\n respond_to do |format|\n format.html { redirect_to order_attachments_url, notice: 'Order attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pdf_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pdf_attachments_url, notice: 'File was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attached_asset = AttachedAsset.find(params[:id])\n @attached_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to attached_assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission_detail.attachment = nil\n @submission_detail.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Document was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_attachment.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'Your image was successfully deleted.'\n redirect_to :back\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat_attachment.destroy\n respond_to do |format|\n format.html { redirect_to boat_attachments_url, notice: 'Boat attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friends_attachment.destroy\n respond_to do |format|\n format.html { redirect_to friends_attachments_url, notice: \"Friends attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n Attachment.find(@equip_person.id_attachment).destroy\n @equip_person.destroy\n respond_to do |format|\n format.html { redirect_to equip_people_url, notice: 'Le membre de l\\'équipe a bien été retiré.' }\n format.json { head :no_content }\n end\n end",
"def delete_attachment(name,id)\n delete_attachment_queue[name] = id if id.is_a?(BSON::ObjectId)\n write_attribute(\"#{name}_id\", nil)\n write_attribute(\"#{name}_name\", nil)\n write_attribute(\"#{name}_size\", nil)\n write_attribute(\"#{name}_type\", nil)\n end",
"def destroy\n \n @attachment = Attachment.find(params[:attachment_id])\n @attachment.destroy\n Keys.where(attachment_id: @attachment.id).destroy_all\n GetModel(params[:type]).where(file_id: @attachment.id).destroy_all\n \n respond_to do |format| \n format.html { redirect_to '/imports/'+params[:profile_id].to_s+'/csv/'+params[:type].to_s,notice: 'File has been deleted!' }\n end\n \n end",
"def delete_attachment(attachable:)\n raw_response = connection.post do |request|\n request.url \"#{realm_id}/attachable?operation=delete\"\n request.body = attachable.to_json\n end\n\n response(raw_response, entity: :attachable)\n end",
"def destroy\n @subject_file.destroy\n respond_to do |format|\n format.html { redirect_to subject_files_path(:subject => \"all\"), notice: 'Subject file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_attachment = FileAttachment.find(params[:id])\n @test_case = @file_attachment.test_case\n @file_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(@test_case || file_attachments_path) }\n format.xml { head :ok }\n end\n end",
"def delete_image_attachment\n @image = ActiveStorage::Attachment.find(params[:id])\n @image.purge\n redirect_back(fallback_location: items_path)\n end",
"def destroy\n @attachinaryfile.destroy\n respond_to do |format|\n format.html { redirect_to attachinaryfiles_url, notice: 'Attachinaryfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @design_image_attachment.destroy\n respond_to do |format|\n format.html { redirect_to design_image_attachments_url, notice: 'Design image attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery_attachment.destroy\n respond_to do |format|\n format.html { redirect_to gallery_attachments_url, notice: 'Gallery attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n attachable_id = attachable.try(:id) || attachable\n response = api.delete(\n \"user/#{api.user_name}/\" \\\n \"realestate/#{attachable_id}/\" \\\n \"attachment/#{id}\"\n )\n handle_response(response)\n self\n end",
"def delete_attachment(id, name)\n unless @model = model_class.get(id)\n flash[:error] = \"No such #{model_class.to_s.downcase} (#{h id}) exists.\"\n redirect rs()\n end\n\n # You need to be able to edit the model before removing attachments!\n for_auth do |u|\n u.can_edit? @model\n end\n\n unless attachment = @model.attachment(name)\n flash[:error] = \"No such attachment (#{h name}) exists.\"\n redirect @model.url\n end\n\n begin\n attachment.delete\n flash[:notice] = \"Deleted attachment #{h name}.\"\n rescue => e\n flash[:error] = \"Couldn't delete attachment #{h name}: #{h e.message}.\"\n end\n\n redirect @model.url\n end",
"def destroy\n @teacher_attachment.destroy\n respond_to do |format|\n format.html { redirect_to teacher_attachments_url, notice: 'Teacher attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @embedded_attachment.destroy\n respond_to do |format|\n format.html { redirect_to embedded_attachments_url, notice: 'Video was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts \"------------------------\"\n document_item = ActiveStorage::Attachment.find(@document.doc.id)\n p document_item.purge\n puts \"------------------------\"\n\n @document.destroy\n respond_to do |format|\n\n\n\n\n format.html { redirect_to property_property_unit_documents_path(@property, @property_unit), notice: 'Dokumentet ble slettet.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attached = Attached.find(params[:id])\n @event = Event.find(@attached.event_id)\n @attached.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/manage_attached/\" + @event.id.to_s }\n format.json { head :no_content }\n end\n end",
"def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end",
"def delete(path = '/files/', params = {})\n request :delete, path, params\n end",
"def destroy_unsaved_attachments\n @client_side_timestamp = params[:client_side_timestamp]\n @filename = params[:filename]\n @cas_user = session[:cas_user]\n\n RecordAttachment.where(:client_side_timestamp => @client_side_timestamp, \n :filename => @filename, :cas_user_name => @cas_user).destroy_all\n render :nothing => true\n end",
"def destroy\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_path, notice: 'Destroyed successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @battle_attachment.destroy\n respond_to do |format|\n format.html { redirect_to battle_attachments_url, notice: 'Battle attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bulletin_file = BulletinFile.find(params[:id])\n @bulletin_file.destroy\n\n respond_to do |format|\n format.html { redirect_to bulletin_files_url }\n format.json { head :no_content }\n end\n end",
"def delete_file(file)\n delete_attachment(file)\n end",
"def destroy\n @article.images.purge if @article.images.attached?\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: '記事を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_attachment.destroy\n respond_to do |format|\n format.html { redirect_to product_attachments_url, notice: 'Product attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_attachments\n delete_attachment_queue.each {|k,v| delete_grid_attachment(k,v)}\n end",
"def destroy\n @property_attachment.destroy\n respond_to do |format|\n format.html { redirect_to property_attachments_url, notice: \"Property attachment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kf_course_knowledge_attachment = Kf::CourseKnowledgeAttachment.find(params[:id])\n @kf_course_knowledge_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_course_knowledge_attachments_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_attachment_file.destroy\n respond_to do |format|\n format.html { redirect_to product_attachment_files_url, notice: 'Product attachment file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pin_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pin_attachments_url, notice: 'Pin attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_grid_attachment(name,id)\n grid.delete(id) if id.is_a?(BSON::ObjectId)\n delete_attachment_queue.delete(name)\n end",
"def destroy\n @pub_attachment.destroy\n respond_to do |format|\n format.js { head :ok, notice: 'Anexo excluído com sucesso.' }\n end\n end",
"def destroy\n @work_order_attachment.destroy\n respond_to do |format|\n format.html { redirect_to work_order_attachments_url, notice: 'Work order attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @job_application_attachment = JobApplicationAttachment.find(params[:id])\n @job_application_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_application_attachments_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_media_by_id id\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 << \"/media/{id}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"id\" => id,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"Content-Type\" => Configuration.content_type\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.delete query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n else \r\n puts \"Media ID Deleted\"\r\n end\r\n\r\n response.body\r\n end",
"def destroy\n @paperclip_client = PaperclipClient.find(params[:id])\n @client = @paperclip_client\n @paperclip_client.destroy\n\n respond_to do |format|\n format.html { redirect_to(paperclip_clients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_attachment.destroy\n respond_to do |format|\n format.html { redirect_to school_attachments_url, notice: 'School attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_attachments_from_existing_note(note, attachments)\n attachments.each do |attach|\n logger.info \"Removing attachment '#{attach.file_name}' from note ID #{note.id}\"\n wait_for_update_and_click existing_note_attachment_delete_button(note, attach)\n confirm_delete\n existing_note_attachment_delete_button(note, attach).when_not_visible Utils.short_wait\n note.attachments.delete attach\n attach.deleted_at = Time.now\n note.updated_date = Time.now\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @post_file.destroy\n respond_to do |format|\n format.html { redirect_to post_files_url, notice: 'Post file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @center_attachment.destroy\n respond_to do |format|\n format.html { redirect_to center_attachments_url, notice: 'Center attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_attachment(resource_id, attachment_id)\n http.delete(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n true\n end\n end",
"def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def delete_attachment(message_id, slot)\n @api.delete(\"#{@api.path}/List/#{@id}/Email/#{message_id}/#{slot}\")\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @filename.destroy\n respond_to do |format|\n format.html { redirect_to filenames_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @digital_content_file = DigitalContentFile.find(params[:id])\n @digital_content_file.destroy\n\n respond_to do |format|\n format.html { redirect_to digital_content_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_attachment.destroy\n respond_to do |format|\n format.html { redirect_to stock_attachments_url, notice: 'Stock attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\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 destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload = @upload = Upload.find_by(id: params[:id], user_id: current_or_guest_user.id)\n @file = ActiveStorage::Attachment.find(params[:file])\n @file&.purge\n @upload.destroy unless @upload.files.present?\n flash[:success] = 'File Deleted Successful!'\n redirect_to root_path\n rescue StandardError => error\n flash[:danger] = 'File Does Not Exist!'\n flash[:error] = error.message\n redirect_to root_path\n end"
] |
[
"0.79157954",
"0.7911116",
"0.78474337",
"0.7647964",
"0.75549096",
"0.7526275",
"0.7526275",
"0.7502211",
"0.7485029",
"0.747136",
"0.74386835",
"0.7387519",
"0.7363478",
"0.73250425",
"0.7315343",
"0.7278889",
"0.72639626",
"0.7230356",
"0.7229833",
"0.72171277",
"0.72171277",
"0.72155374",
"0.7209419",
"0.7202963",
"0.71719486",
"0.7162536",
"0.709499",
"0.70775336",
"0.7038299",
"0.7038015",
"0.7029512",
"0.70256466",
"0.70217896",
"0.6999708",
"0.6985702",
"0.69845986",
"0.69814587",
"0.695042",
"0.6941032",
"0.69367373",
"0.69035953",
"0.690224",
"0.6897807",
"0.6893601",
"0.6874938",
"0.6867954",
"0.68655336",
"0.686263",
"0.6844585",
"0.68388563",
"0.6835563",
"0.6835015",
"0.6777564",
"0.67721623",
"0.6765091",
"0.675072",
"0.6731248",
"0.6724236",
"0.6705725",
"0.67055935",
"0.67053264",
"0.6694642",
"0.6689436",
"0.6684656",
"0.6682715",
"0.6680849",
"0.6674064",
"0.6670404",
"0.6669494",
"0.6631294",
"0.66233414",
"0.6622567",
"0.66191524",
"0.6614759",
"0.65831673",
"0.65768033",
"0.6574755",
"0.6569262",
"0.656726",
"0.65650755",
"0.6549058",
"0.65407574",
"0.65357774",
"0.6535704",
"0.6532793",
"0.65142334",
"0.6509254",
"0.6506321",
"0.6506285",
"0.6501076",
"0.64943784",
"0.6493571",
"0.64870185",
"0.64870185",
"0.64845353",
"0.6477371",
"0.6469374",
"0.64662594"
] |
0.78026474
|
4
|
Use callbacks to share common setup or constraints between actions.
|
def set_attachment
@attachment = Attachment.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 attachment_params
params.require(:attachment).permit(:employee_id, :name, :describe)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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 pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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 get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] |
0.0
|
-1
|
Configure Rails Mini Profiler You may use this to configure where and how Rails Mini Profiler stores profiling and storage information.
|
def configure
yield(configuration)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _miniprofiler\n if %w(development).include?(Rails.env)\n #if %w(development staging).include?(Rails.env)\n if APP_CONFIG['debug']['miniprofiler_enabled'] && user_signed_in? && current_user.has_role?('admin')\n Rack::MiniProfiler.authorize_request\n else\n Rack::MiniProfiler.deauthorize_request\n end\n end\n end",
"def profiler_start\n start_perf_profiler\n end",
"def config\n # This could be a single global but it doesn't use enough RAM or CPU\n # cycles that I care.\n @config ||= PoiseProfiler::Config.new\n end",
"def enable_profiling\n if current_user && CurateND::AdminConstraint.is_admin?(current_user.username)\n Rack::MiniProfiler.authorize_request\n end\n end",
"def authorize_mini_profiler\n if can? :monitor , :all\n Rack::MiniProfiler.authorize_request\n end\n end",
"def disable_profiling; end",
"def prof_file\n base_info_file + '.profile'\n end",
"def manage_profiling(env)\n start_profiling if @count == 10\n if @count == 500\n stop_profiling\n save_report\n end\n end",
"def profiler; end",
"def profiler; end",
"def with_profiling\n if options.profile?\n begin\n require \"memory_profiler\"\n MemoryProfiler.report(:top => 10_240) { yield }.pretty_print({\\\n :to_file => \"mem.txt\"\n })\n rescue LoadError\n $stderr.puts \"The gem 'memory_profiler' wasn't found.\"\n $stderr.puts \"You can install it with `gem install memory_profiler'\"\n abort \"Hope you install it so you can report back.\"\n end\n\n else\n yield\n end\n\n rescue Excon::Errors::SocketError\n $stderr.puts \"Unable to connect to your Docker Instance.\"\n $stderr.puts \"Are you absolutely sure that you have the Docker installed?\"\n abort \"Unable to build your images.\"\n\n rescue Exception\n raise unless $ERROR_POSITION\n $ERROR_POSITION.delete_if do |source|\n source =~ %r!#{Regexp.escape(\n __FILE__\n )}!o\n end\n\n raise\n end",
"def reset\n @enabled = proc { |_env| Rails.env.development? || Rails.env.test? }\n @flamegraph_enabled = true\n @flamegraph_sample_rate = 0.5\n @logger = RailsMiniProfiler::Logger.new(Rails.logger)\n @skip_paths = []\n @storage = Storage.new\n @ui = UserInterface.new\n @user_provider = proc { |env| Rack::Request.new(env).ip }\n end",
"def startMultiprofiling(filename, bufferSize=ProfilerControl::DEFAULT_BUFFER_SIZE, mode=ProfilerControl::PROFILE_IN_RAM)\n\n puts \"html> Start Profiling ...\"\n case mode\n when ProfilerControl::PROFILE_IN_RAM\n # Allocate Buffer\n profilerMallocRamBuffer(bufferSize)\n\n # Start profiling\n profilerEnableProfiling(true, ProfilerControl::PROFILE_IN_RAM)\n \n # We dump the whole buffer in the end, exit here\n return\n\n when ProfilerControl:: PROFILE_ON_TRACE\n # Start profiling\n profilerEnableProfiling(true, ProfilerControl:: PROFILE_ON_TRACE)\n\n # Start a thread to dump in real-time in the file.\n @@MultiprofilerThread = Thread.new {\n myfile=File.open(filename, \"wb\")\n\n myfile << \"DBGP\"\n myfile << [0,1,0,1].pack(\"c*\")\n\n firstTs = nil\n lastpfTsWrap = 0\n\n mybypass = CHBPConnection.new($CURRENTCONNECTION, [0x94])\n mybypass.open(false)\n begin\n\n loop {\n begin\n a = mybypass.getPacket(0)\n rescue CHBPConnectionTimeout\n sleep 0.01 \n #Sleep when there ain't no packets \n redo\n end\n CRVERBOSE(a.inspect, 2)\n data = a[1]\n ts = (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | data[0]\n # tag = (data[5] << 8) | data[4]\n # puts \"@%12d: %04x\" % [ts,tag]\n if ( firstTs.nil? ) then\n firstTs = ts;\n end\n relTs=ts-firstTs;\n # trace timestamp is based on Greenstone uptime @16384Hz on 32bits\n # profiling format is defined with 1Mhz timespamp on 13 bits\n pfTs=relTs*1000000/16384\n\n while ((pfTs - lastpfTsWrap) > (1<<13)) do\n myfile << [0xff,0xff,0xff,0x7f].pack(\"c*\")\n lastpfTsWrap += (1<<13)\n end\n\n pfts = (pfTs - lastpfTsWrap)\n data[6] = pfts & 0xff\n data[7] = (pfts >> 8) & 0xff\n\n myfile << data[4..7].pack(\"c*\")\n\n }\n rescue Exception => e\n errputs \"Exception happened in trace profiling thread.\"\n CRExceptionPrint e\n ensure\n myfile << [0xff,0xff,0xfe,0x7f].pack(\"c*\")\n myfile.close\n\n mybypass.close\n CRVERBOSE(\"Thread's dead\",2)\n end\n }\n end # case mode\nend",
"def sidekiq_setup\n Sidekiq.configure_server do |config|\n config.server_middleware do |chain|\n chain.add SidekiqPrometheus::JobMetrics\n end\n\n if periodic_metrics_enabled?\n config.on(:startup) { SidekiqPrometheus::PeriodicMetrics.reporter.start }\n config.on(:shutdown) { SidekiqPrometheus::PeriodicMetrics.reporter.stop }\n end\n\n config.on(:startup) { SidekiqPrometheus.metrics_server }\n config.on(:shutdown) { SidekiqPrometheus.metrics_server.kill }\n end\n end",
"def initialize(app, options={})\n\t\t\t@@instance = self\n\t\t\t@options = {\n\t\t\t\t:auto_inject => true,\t# automatically inject on every html page\n\t\t\t\t:base_url_path => \"/mini-profiler-resources\",\n\t\t\t\t:authorize_cb => lambda {|env| return true;} # callback returns true if this request is authorized to profile\n\t\t\t}.merge(options)\n\t\t\t@app = app\n\t\t\t@options[:base_url_path] += \"/\" unless @options[:base_url_path].end_with? \"/\"\n\t\t\t@timer_struct_cache = {}\n\t\t\t@timer_struct_lock = Mutex.new\n\t\tend",
"def disable_profiling=(_arg0); end",
"def setup_tracer\n Contrib::Rails::Framework.setup\n end",
"def memory_profiled enabled = true, &block\n if enabled\n require 'memory_profiler'\n report = MemoryProfiler.report &block\n report.pretty_print\n else\n yield\n end\nend",
"def complete_profiling!\n profiled_request.user_id = User.current_user\n profiled_request.request = @request\n profiled_request.response = @response\n total_time = traces.find { |trace| trace.name == 'rails_mini_profiler.total_time' }\n profiled_request.total_time = total_time\n @complete = true\n end",
"def configure!(options={})\n self.local_config = options\n end",
"def set_profile\n end",
"def profilerEnableProfiling(enable, mode=ProfilerControl::PROFILE_IN_RAM, connection=$CURRENTCONNECTION)\r\n myCon = CHEmptyConnection.new()\r\n\r\n # Duplicate connection.\r\n myCon = connection.copyConnection()\r\n myCon.open(false)\r\n\r\n # Build accessor\r\n profilerCtrlCfg = $map_table.>(myCon).hal_access.>(myCon).profileControl.config\r\n\r\n val = profilerCtrlCfg.read(myCon)\r\n val = profilerCtrlCfg.prepl(val)\r\n\r\n\r\n case mode\r\n when ProfilerControl::PROFILE_IN_RAM\r\n val = profilerCtrlCfg.Global_Enable_Ram.wl(val, (enable)?(1):(0))\r\n\r\n when ProfilerControl::PROFILE_ON_TRACE\r\n val = profilerCtrlCfg.Global_Enable_Trace.wl(val, (enable)?(1):(0))\r\n\r\n end\r\n\r\n # Clear status if start\r\n if (enable)\r\n $map_table.>(myCon).hal_access.>(myCon).profileControl.status.write(myCon, 0)\r\n end\r\n\r\n # Write register\r\n profilerCtrlCfg.write(myCon, val)\r\n\r\nensure\r\n myCon.close()\r\n\r\nend",
"def profilerEnableProfiling(enable, mode=ProfilerControl::PROFILE_IN_RAM, levelmask = 0xFFFF, connection=$CURRENTCONNECTION)\n myCon = CHEmptyConnection.new()\n\n # Duplicate connection.\n myCon = connection.copyConnection()\n myCon.open(false)\n\n # Build accessor (dereference in the wind to gain some time).\n pc = $map_table.>(myCon).hal_access.>(myCon).profileControl\n\n val = pc.config.read(myCon)\n val = pc.config.prepl(val)\n\n case mode\n when ProfilerControl::PROFILE_IN_RAM\n val = pc.config.Global_Enable_Ram.wl(val, (enable)?(1):(0))\n \n when ProfilerControl::PROFILE_ON_TRACE\n val = pc.config.Global_Enable_Trace.wl(val, (enable)?(1):(0))\n end\n \n val = pc.config.Enable_Pxts_Tag_Reserved_0.wl(val, (levelmask>>0)&1 )\n val = pc.config.Enable_Pxts_Tag_Boot.wl(val, (levelmask>>1)&1 )\n val = pc.config.Enable_Pxts_Tag_Hal.wl(val, (levelmask>>2)&1 )\n val = pc.config.Enable_Pxts_Tag_Sx.wl(val, (levelmask>>3)&1 )\n val = pc.config.Enable_Pxts_Tag_Pal.wl(val, (levelmask>>4)&1 )\n val = pc.config.Enable_Pxts_Tag_Edrv.wl(val, (levelmask>>5)&1 )\n val = pc.config.Enable_Pxts_Tag_Svc.wl(val, (levelmask>>6)&1 )\n val = pc.config.Enable_Pxts_Tag_Stack.wl(val, (levelmask>>7)&1 )\n val = pc.config.Enable_Pxts_Tag_Csw.wl(val, (levelmask>>8)&1 )\n val = pc.config.Enable_Pxts_Tag_Reserved_9.wl(val, (levelmask>>9)&1 )\n val = pc.config.Enable_Pxts_Tag_Reserved_10.wl(val, (levelmask>>10)&1 )\n val = pc.config.Enable_Pxts_Tag_Reserved_11.wl(val, (levelmask>>11)&1 )\n val = pc.config.Enable_Pxts_Tag_Bb_Irq.wl(val, (levelmask>>12)&1 )\n val = pc.config.Enable_Pxts_Tag_Spal.wl(val, (levelmask>>13)&1 )\n val = pc.config.Enable_Pxts_Tag_Spp.wl(val, (levelmask>>14)&1 )\n val = pc.config.Enable_Pxts_Tag_Spc.wl(val, (levelmask>>15)&1 )\n\n # Clear status if start\n if (enable)\n pc.status.write(myCon, 0)\n end\n\n # Write register\n pc.config.write(myCon, val)\n\nensure\n myCon.close()\nend",
"def enable_performance_cache_logging\n performance_cache_logger.level = Logger::DEBUG\n end",
"def profile(action, name = '')\n case action\n when :start\n MemoryProfiler.start\n when :stop\n MemoryProfiler.stop.pretty_print(\n to_file: File.join(DIR_LOGS, 'memory_profile.txt'),\n scale_bytes: true,\n detailed_report: true,\n normalize_paths: true\n )\n end\nrescue => e\n lex(e, 'Failed to do memory profiling')\nend",
"def mini_profiler(bin_check)\n bin_check.check do |config|\n config.command \"grep 'rack-mini-profiler' Gemfile.lock >> /dev/null\"\n config.reversed_exit true\n config.files ['Gemfile.lock']\n end\n end",
"def startup(options)\n tester.set_timeset('arm_debug', 40)\n end",
"def run\n return unless profile\n\n @locked = true\n\n log :info, \"StackProf#{config.raw? ? \" (raw)\" : \"\"} enabled globally: \" \\\n \"mode – #{config.mode}, target – #{config.target}\"\n\n at_exit { dump(\"total\") } if config.suite?\n end",
"def profiling=(yesno)\n @profiling = (yesno == true)\n self.execution_time = 0 unless self.profiling?\n end",
"def init\n @running = false\n @stack = []\n @nodes = []\n @roots = []\n\n log :info, \"FactoryProf enabled (#{config.mode} mode)\"\n\n FACTORY_BUILDERS.each(&:patch)\n end",
"def profile_mode\n super\n end",
"def profile_mode\n super\n end",
"def simplecov_configuration\n proc do\n gemfile = Eaco::Rake::Utils.gemfile\n coverage_dir \"coverage/#{gemfile}\"\n add_filter ['/features', '/spec']\n end\n end",
"def initialize\n reset\n @debugging = !ENV['MM_CHEAT'].nil?\n puts \"*** DEBUG ENABLED ***\" if @debugging\n end",
"def initialize(app)\n @app = app\n @count = 0\n\n # Hard-coded sample:\n sample_interval_ns = 100_000\n\n # Or, you could use your expected sample time and have the system\n # figure out an appropriate sampling rate. E.g., if an unprofiled run\n # takes 10 seconds of CPU time, then the following calculates the\n # appropriate sample rate.\n #\n # unprofiled_cputime_seconds = 10\n # sample_interval_ns = Maglev::Gprof.compute_interval(unprofiled_cputime_seconds)\n\n @gprof_monitor = Maglev::Gprof.create(sample_interval_ns)\n end",
"def set_prof\n @prof = Prof.find(params[:id])\n end",
"def set_prof\n @prof = Prof.find(params[:id])\n end",
"def initialize(config={})\n @stopped = false\n @config = config\n @domain = config[:domain] || ModernTimes::DEFAULT_DOMAIN\n # Unless specifically unconfigured (i.e., Rails.env == test), then enable jmx\n if config[:jmx] != false\n @jmx_server = JMX::MBeanServer.new\n bean = ManagerMBean.new(@domain, self)\n @jmx_server.register_mbean(bean, ModernTimes.manager_mbean_object_name(@domain))\n end\n @supervisors = []\n @dummy_host = config[:dummy_host]\n self.persist_file = config[:persist_file]\n self.worker_file = config[:worker_file]\n @allowed_workers = config[:allowed_workers]\n stop_on_signal if config[:stop_on_signal]\n end",
"def start\n unless @enabled\n logger.debug \"[bigcommerce-prometheus][#{@process_name}] Prometheus disabled, skipping web start...\"\n return\n end\n\n setup_before_fork\n setup_after_fork\n setup_middleware\n rescue StandardError => e\n logger.error \"[bigcommerce-prometheus][#{@process_name}] Failed to start web instrumentation - #{e.message} - #{e.backtrace[0..4].join(\"\\n\")}\"\n end",
"def system_profiler_plist\n tmp_path = \"/tmp/system_profiler_#{rand(1001)}.plist\"\n `/usr/sbin/system_profiler -xml SPHardwareDataType SPSoftwareDataType SPPrintersDataType > #{tmp_path}`\n tmp_path\nend",
"def set_profile!(profile)\n if profile.kind_of?(Symbol)\n if CSS_PROFILES.has_key?(profile)\n profile = profile.to_s\n else\n return\n end\n end\n @options[:profile] = profile\n end",
"def configure!\n raise(AlreadyConfiguredError, @configured_by) if already_configured?\n\n debug! if config.debug?\n\n configurators.each do |(group, block)|\n group group\n class_eval(&block)\n group nil\n end\n\n # Register metrics in adapters after evaluating all configuration blocks\n # to ensure that all global settings (like default tags) will be applied.\n adapters.each_value do |adapter|\n metrics.each_value do |metric|\n adapter.register!(metric)\n end\n end\n\n @configured_by = caller_locations(1, 1)[0].to_s\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup\n SidekiqPrometheus::Metrics.register_sidekiq_job_metrics\n SidekiqPrometheus::Metrics.register_sidekiq_gc_metric if gc_metrics_enabled?\n SidekiqPrometheus::Metrics.register_sidekiq_worker_gc_metrics if gc_metrics_enabled? && periodic_metrics_enabled?\n SidekiqPrometheus::Metrics.register_sidekiq_global_metrics if global_metrics_enabled? && periodic_metrics_enabled?\n sidekiq_setup\n end",
"def profiler_stop\n stop_perf_profiler\n end",
"def profiler_report(label='', extra_pids={})\n report_perf_profiler(label, extra_pids)\n end",
"def initialize\n @statistics = { settings: {}, profiles: {} }.with_indifferent_access\n end",
"def profiling?\n @profiling\n end",
"def setup\n generate_profile\n load_profile\n create_namespace\n end",
"def set_metrics\n if rails?\n @metrics = MetricFu::AVAILABLE_METRICS + [:stats, :rails_best_practices]\n else\n @metrics = MetricFu::AVAILABLE_METRICS\n end\n end",
"def reconfigure(config)\n icfg = config.internal\n\n icfg.processing.coordinator_class = Processing::Coordinator\n icfg.processing.partitioner_class = Processing::Partitioner\n icfg.processing.scheduler = Processing::Scheduler.new\n icfg.processing.jobs_builder = Processing::JobsBuilder.new\n\n icfg.active_job.consumer_class = ActiveJob::Consumer\n icfg.active_job.dispatcher = ActiveJob::Dispatcher.new\n icfg.active_job.job_options_contract = ActiveJob::JobOptionsContract.new\n\n config.monitor.subscribe(PerformanceTracker.instance)\n end",
"def install_instrumentation\n _install_instrumentation\n end",
"def setup_common\n options[:log].each do |spec|\n mod, level, file = spec.split(\":\")\n app.log_setup(mod, level, file)\n end\n\n if options[:debug]\n app.public_logs = true\n app.filter_backtraces = false\n require \"roby/app/debug\"\n end\n\n nil\n end",
"def setup_config\n # To be Extended\n end",
"def configure(options, cfg)\n cfg = super(options, cfg)\n cfg[:offline_queueing] = options[:offline_queueing]\n cfg[:filter_params] = options[:filter_params]\n cfg\n end",
"def setup!\n Fission.registration.each do |key, klasses|\n klasses.each do |klass|\n args = [:fission, :workers, *key.split('.')]\n num = nil\n until(args.empty? || num)\n num = Carnivore::Config.get(*args)\n unless(num.is_a?(Fixnum))\n num = nil\n args.pop\n end\n end\n klass.workers = num.is_a?(Fixnum) ? num : 0\n src_key = key.split('.').first\n src = Carnivore::Source.source(src_key)\n if(src)\n name = klass.to_s.split('::').last\n src.add_callback(name, klass)\n else\n Carnivore::Utils.warn \"Workers defined for non-registered source: #{key}\"\n end\n end\n end\n\n # Setup process manager if needed\n # if(Carnivore::Config.get(:fission, :utils, :process, :max_processes).to_i > 0)\n # require 'fission/utils/process'\n # if(Carnivore::Config.get(:fission, :utils, :process, :spawn))\n # ChildProcess.posix_spawn = true\n # end\n # Utils::Process.supervise_as :process_manager\n # end\n end",
"def setup()\n super() ;\n setupScatterPolicy(getConf(:scatterPolicy)) ;\n end",
"def define_config(tool, options={}, &block)\n tool = tool.to_s\n\n @setup ||= {}\n\n if block\n @setup[tool] = Setup.new(tool, options, &block)\n\n # REMOVED: Doing this automatically made it impossible for tools to set the profile.\n #if tool == current_tool\n # configure_tool(tool) unless autoconfig?\n #end\n end \n\n @setup[tool]\n end",
"def add_profile(profile)\n RSpec.configuration.formatters\n .find_all { |c| c.is_a?(Inspec::Formatters::Base) }\n .each do |fmt|\n fmt.add_profile(profile)\n end\n end",
"def config\n config = PcaprLocal::Config.config\n config['couch']['database'] = \"#{config['couch']['database']}_test\"\n config['install_dir'] = \"/tmp/pcapr_local_test\"\n config['pcap_dir'] = \"/tmp/pcapr_local_test/pcaps\"\n config['index_dir'] = \"/tmp/pcapr_local_test/indexes\"\n config['app']['port'] = config['app']['port'].to_i + 1\n config\n end",
"def config\n config = PcaprLocal::Config.config\n config['couch']['database'] = \"#{config['couch']['database']}_test\"\n config['install_dir'] = \"/tmp/pcapr_local_test\"\n config['pcap_dir'] = \"/tmp/pcapr_local_test/pcaps\"\n config['index_dir'] = \"/tmp/pcapr_local_test/indexes\"\n config['app']['port'] = config['app']['port'].to_i + 1\n config\n end",
"def add_persistence_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end",
"def set_sb_conf\n # resources allocated for sandboxes' sake\n @conf[:mem_sb] = (@conf[:mem] * 0.8).round\n @conf[:hd_sb] = (@conf[:hd] * 0.8).round\n @conf[:cpu_sb] = @conf[:cpu]\n\n @conf[:sandboxes] = []\n @conf[:sandboxes].push({:name => 'sb0', :type => 'first'})\n end",
"def start(launcher)\n @launcher = launcher\n\n @statsd = PumaStatsd.new\n if @statsd.enabled?\n @launcher.events.debug \"statsd: enabled (host: #{@statsd.host})\"\n register_hooks\n else\n @launcher.events.debug \"statsd: not enabled (no statsd client configured)\"\n end\n end",
"def config(tool, profile, &block)\n tool = tool.to_sym\n if @too_configs.key?(tool)\n config = @tool_configs[tool]\n else\n config = ToolConfigs.new(tool)\n @tool_configs[tool] = config\n end\n config.add(profile, &block)\n end",
"def show_toolbar(token)\n @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]\n return erb nil, status: 404 if @collection.nil?\n\n @collectors = Rack::WebProfiler.config.collectors.all\n\n erb \"profiler.erb\"\n end",
"def configure\n load_all_configs \n end",
"def fixup_request( request )\n\t\tRubyProf.start if request.params && request.params['profile']\n\n\t\tsuper\n\tend",
"def setup\n setup_methods.each { |m| self.send(m) }\n start_services\n \n wait_time = cfg('wait-after-startup')\n if not wait_time.nil?\n 1.upto(wait_time) do |i|\n puts \"Waiting #{wait_time-i} seconds before commencing benchmarks\"\n sleep 1\n end\n end\n end",
"def set_profile(opts)\n opts = check_params(opts,[:profiles])\n super(opts)\n end",
"def profile\n profile_memory do\n profile_time do\n profile_gc do\n yield\n end\n end\n end\n end",
"def show_toolbar(token)\n @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]\n return erb nil, status: 404 if @collection.nil?\n\n @collectors = Rack::WebProfiler.config.collectors.all\n # @todo process the callector views\n # @collectors = Rack::WebProfiler::Collector.render_tabs(@record)\n\n erb \"profiler.erb\"\n end",
"def initialize(options={})\n @options = options.clone\n\n @options[:subtract_overhead] = true if @options[:subtract_overhead].nil? # Never use ||= with booleans\n\n @measurements = {} # A hash of Measure\n @current_path = nil\n @instrumented_methods = {METHOD_TYPE_INSTANCE=>[],METHOD_TYPE_CLASS=>[]}\n @subtract_overhead = @options[:subtract_overhead]\n if @@overhead.nil?\n @@overhead = measure_overhead\n @measurements = {} # A hash of Measure; must repeat here to cleanup what measure_overhead did\n end\n end",
"def load(name)\n name = name.to_sym\n raise \"Could not find SimpleCov Profile called '#{name}'\" unless key?(name)\n\n SimpleCov.configure(&self[name])\n end",
"def enable_debug(file = nil)\n set_debug_file(file.to_s)\n end",
"def initialize(options={})\n @timers = []\n @settings = options[:settings]\n @logger = options[:logger]\n @redis = options[:redis]\n @options = @settings.to_hash.fetch(:tessen, {})\n end",
"def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n @system_profiler = SystemProfiler.new\n @last_request_metrics = nil\n end",
"def setup\n logger.info 'setup workers'\n\n setup_refresh_timer\n setup_analyze_timer\n end",
"def configure\n Rollbar.reconfigure do |config|\n # special test access token\n config.access_token = test_access_token\n config.logger = ::Rails.logger\n config.root = ::Rails.root\n config.framework = \"Rails: #{::Rails::VERSION::STRING}\"\n config.request_timeout = 60\n end\n end",
"def set_probe_configuration\n @probe_configuration = ProbeConfiguration.find(params[:id])\n end",
"def initialize debug_options = {}\n @debug_options = debug_options\n end",
"def metric_config\n # This is bad... but I just want things to work!!!!!\n @mount_dir = ::ArchiveRoot\n\tdefault = Defaults.new\n\tdefault.metric_taxonomy= 'hsa'\n\tdefault.metric_instrument_type = 'ORBI'\n\tdefault\n end",
"def trace_options\n @trace_data.trace_options\n end",
"def profile\n env['profile']\n end",
"def setup\n @configure = Hatemile::Util::Configure.new\n end",
"def setup_profiled(**args)\n super(**args)\n default_env_vars.each do |key, value|\n set_env_default key, value\n end\n end",
"def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end",
"def setup_fetcher(options={})\n @fetch_base_url = options[:fetch_base_url] || \"\"\n\n @fetch_count=0\n\n\n @record_directory=options[:record_directory]\n @playback_directory=options[:playback_directory]\n\n @throttler=options[:throttler] || Nanikore::Throttler.new(options)\n end",
"def set_config\n @me = current_user\n @profile = Profile.find_by user_id: current_user.id\n @preference = Preference.find_by user_id: current_user.id\n end",
"def initialize(opt = nil)\n @opt = DEFAULTS.merge(opt || {})\n\n # make sure paths exist\n PATH_KEYS.each do |key|\n FileUtils.mkdir_p(File.dirname(@opt[\"runner.#{key}.path\"]), {\n # restict access to owner\n :mode => 0700\n })\n end\n\n # create logger\n @log = Logger.new(@opt['runner.log.path'])\n @log.level = Logger.const_get(@opt['runner.log.level'].upcase)\n @log.datetime_format = @opt['runner.log.format']\n @log.info('Log started.')\n\n # create backing store\n path = @opt['runner.store.path'] \n @log.debug(\"Creating backing store \\\"#{path}\\\".\")\n pstore = ::PStore.new(path)\n @store = Store::PStore::All.new(pstore)\n end",
"def configure_manager\n end",
"def set_profile(value)\n path = \"#{root}/.balancer/profiles/#{value}.yml\"\n unless File.exist?(path)\n puts \"The profile file #{path} does not exist. Exiting.\".colorize(:red)\n exit 1\n end\n ENV['BALANCER_PROFILE'] = value\n end",
"def setup(settings = {})\n @configuration = defaults.merge(settings)\n \n unless @configuration[:reload_classes]\n @configuration[:fork_for_class_load] = false\n end\n \n @configuration\n end",
"def profile(options:)\n @options = options\n @connection = nil\n case options[:profile].to_sym\n when :stats\n print_all_node_stats\n when :all\n print_all_nodes\n when :roots\n print_root_nodes\n when :images\n print_image_information\n when :memmory\n print_memmory_usage\n when :textures\n print_texture_information\n else\n print_nodes_by_id(options[:profile])\n end\n @connection.close if @connection\n end",
"def server_side_config_options\n [:eager_loading, :klass]\n end",
"def server_side_config_options\n [:eager_loading, :klass]\n end",
"def global_cpu_usage_extended_information\n super\n end",
"def initialize(project_root, file_path, profile, autoscaling_force_size)\n Config.project_root = project_root;\n Config.json = JSON.parse(File.read(absolute_path(file_path)))\n @profile = profile\n @colors_enabled = conf \"colors-enabled\"\n @region = conf \"region\"\n @iam = IamConfig.new\n @autoscaling = AutoScalingConfig.new(autoscaling_force_size)\n @route53 = Route53Config.new\n @security = SecurityConfig.new\n @cloudfront = CloudFrontConfig.new\n @s3 = S3Config.new\n @elb = ELBConfig.new\n @vpc = VpcConfig.new\n @kinesis = KinesisConfig.new\n @sqs = SQSConfig.new\n @ec2 = EC2Config.new\n end",
"def setup\n\t\n # create an instance of the measure\n @measure = VentilationQAQC.new\n \n #create an instance of the runner\n @runner = OpenStudio::Ruleset::OSRunner.new\t\n\t\n # get arguments \n @arguments = @measure.arguments()\n\n # make argument map\n make_argument_map\n\t\n # Make an empty model\n @model = OpenStudio::Model::Model.new\n\[email protected](@model)\n\t\n\t# Create a fake sql file - our measure will crash if @runner has no sql file set.\n\t# We don't get data from this file because we get data from our patched SqlFile class instead (see above)\n\tsqlFile = OpenStudio::SqlFile.new(OpenStudio::Path.new(sqlPath))\n\[email protected](OpenStudio::Path.new(sqlPath))\n\t\n\t$serieses[\"Zone Mechanical Ventilation Mass Flow Rate|ZONE1\"] = OpenStudio::TimeSeries.new(OpenStudio::Date.new, OpenStudio::Time.new(1.0), (0..364).to_a.to_vector, \"m^3/s\")\n end"
] |
[
"0.6429279",
"0.63404876",
"0.5803759",
"0.5777419",
"0.55314577",
"0.5265451",
"0.523015",
"0.5227075",
"0.5219919",
"0.5219919",
"0.51583105",
"0.5144832",
"0.50996673",
"0.50848943",
"0.49967018",
"0.49221063",
"0.48974776",
"0.4820689",
"0.4814132",
"0.47953397",
"0.47721052",
"0.47498748",
"0.47370133",
"0.47339675",
"0.4707933",
"0.4688138",
"0.468636",
"0.46391678",
"0.46322957",
"0.4601549",
"0.45980287",
"0.45980287",
"0.45960313",
"0.45850396",
"0.45840022",
"0.4567118",
"0.4567118",
"0.4563659",
"0.45477813",
"0.4544506",
"0.45425567",
"0.45381597",
"0.4531054",
"0.4531054",
"0.4531054",
"0.45210543",
"0.45198545",
"0.44965062",
"0.44937164",
"0.44924328",
"0.44859976",
"0.44517994",
"0.4449669",
"0.44405273",
"0.44402605",
"0.44281945",
"0.44274053",
"0.44194278",
"0.44001946",
"0.43974963",
"0.43958458",
"0.43861148",
"0.43861148",
"0.4381202",
"0.43660533",
"0.4364216",
"0.43618834",
"0.436073",
"0.43532732",
"0.43458337",
"0.43380415",
"0.4332438",
"0.43172672",
"0.43171045",
"0.43133116",
"0.4295557",
"0.42765036",
"0.42735437",
"0.42724293",
"0.42610678",
"0.42554682",
"0.4246854",
"0.42414618",
"0.42365533",
"0.42339963",
"0.42323157",
"0.42298016",
"0.42262673",
"0.42225048",
"0.42223912",
"0.42207837",
"0.4202516",
"0.4202338",
"0.42012346",
"0.41932684",
"0.41927943",
"0.4192586",
"0.4192586",
"0.41876352",
"0.4185802",
"0.41798934"
] |
0.0
|
-1
|
Access the current logger
|
def logger
@logger ||= configuration.logger
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_logger; @logger; end",
"def logger\n @log\n end",
"def logger\n @log\n end",
"def logger\n @logger\n end",
"def logger\n @logger\n end",
"def logger\n @__logger\n end",
"def logger\n reset_logger! unless defined? @@logger\n @@logger\n end",
"def logger\n @logger\n end",
"def logger\n\n return @logger\n\n end",
"def logger\n @logger ||= Logging.get_logger(self)\n end",
"def logger\n @logger ||= build_logger\n end",
"def logger\n LOGGER\n end",
"def logger\n @logger ||= Logger.new(self)\n end",
"def logger\n @logger ||= default_logger\n end",
"def logger\n unless defined? @logger\n logger = Logging.logger[self]\n @logger = Kernel.const_defined?('Rails') ? Rails.logger : logger\n end\n @logger\n end",
"def logger\n Logging.logger\n end",
"def logger\n @logger ||= _new_logger\n end",
"def logger\n return @logger ||= default_logger\n end",
"def logger\n self.class.logger\n end",
"def logger\n @logger ||= self.class.logger\n end",
"def logger\n @_logger ||= Logger.new(self)\n end",
"def logger\r\n self.class.logger\r\n end",
"def logger\n @logger ||= default_logger\n end",
"def logger\n @logger ||= Rails.logger\n end",
"def logger\n self.configuration.logger\n end",
"def logger\n\t\treturn Loggability[ self ]\n\tend",
"def logger\n @master_logger\n end",
"def log\n Logger.instance\n end",
"def logger\n @logger ||= Rails.logger\n end",
"def logger\n @logger ||= Rails.logger\n end",
"def log\n @log ||= Logging.logger[self]\n end",
"def logger\n Logging.logger\n end",
"def logger\n @logger ||= Logging.logger_for(self.class.name)\n end",
"def logger\n self.configuration.logger\n end",
"def logger\n @logger ||= create_logger\n end",
"def logger\n @logger ||= create_logger\n end",
"def logger\n @logger ||= set_logger\n end",
"def logger\n @logger || default_logger\n end",
"def logger\n @logger || default_logger\n end",
"def logger\n backend.logger\n end",
"def log\n LOGGER\n end",
"def logger\n initialize_logger unless @logger\n @logger\n end",
"def logger\n @loggers.first\n end",
"def logger\n env.logger\n end",
"def logger \n klass = self.class\n klass.logger\n end",
"def logger\n init unless @initialized\n logger = @logger\n end",
"def logger\n classname = (self.is_a? Module) ? self : self.class.name\n @logger ||= Loggable.logger_for(classname)\n end",
"def log\n @log ||= Logging.logger[File.basename($0)]\n end",
"def logger\n @logger ||= NilLogger.new\n end",
"def logger\n @logger ||= Logger.get_logger(config.robot.log_level, config.robot.log_formatter)\n end",
"def logger\n @logger ||= Doing.logger\n end",
"def logger\n return @logger if @logger\n if defined?(Rails)\n Rails.logger\n else\n unless @log\n require 'logger'\n @log = Logger.new(STDOUT)\n @log.level = Logger::INFO\n end\n @log\n end\n end",
"def logger\n @logger ||= Logger.new(STDOUT)\n end",
"def logger\n @logger ||= Logger.get_logger(config.robot.log_level)\n end",
"def logger\n RAILS_DEFAULT_LOGGER\n end",
"def logger\n @logger || Rcal::Util::Loggable.default_logger\n end",
"def logger\n @logger ||=\n begin\n logger = SemanticLogger::Processor.logger.clone\n logger.name = self.class.name\n logger\n end\n end",
"def logger\n @logger || StartupLogger.instance\n end",
"def logger\n @logger ||= Logger.new(STDOUT)\n end",
"def logger\n Crate.project.logger\n end",
"def logger\n adapter.logger\n end",
"def logger\n adapter.logger\n end",
"def logger\n @logger ||= Esi.config.logger || Logger.new(Esi.config.log_target).tap do |l|\n l.level = Logger.const_get(Esi.config.log_level.upcase)\n end\n end",
"def logger\n if @logger.nil?\n @logger = Logger::new(STDOUT)\n \n # formatter\n default = Logger::Formatter::new\n @logger.formatter = proc do |severity, datetime, progname, msg|\n progname = @targets.from\n msg = \"##{Thread.current.object_id} \" + msg \n default.call(severity, datetime, progname, msg)\n end\n end\n \n return @logger\n end",
"def logger\n @pm.logger\n end",
"def logger\n ScoutApm::Agent.instance.context.logger\n end",
"def logger\n @logger ||= ::Logger.new STDOUT\n end",
"def logger\n @logger ||= ::Logger.new STDOUT\n end",
"def logger\n @logger ||= ::Logger.new STDOUT\n end",
"def logger\n @app.logger\n end",
"def logger\n @logger ||= ::Logger.new(STDOUT)\n end",
"def logger\n @scope.logger\n end",
"def logger\n Rails.logger ||= ::Logger.new(STDOUT)\n @logger ||= Rails.logger\n end",
"def logger\n\t\t\t@system_lock.synchronize {\n\t\t\t\treturn @systems[0].logger unless @systems.empty?\n\t\t\t}\n\t\t\tSystem.logger\n\t\tend",
"def log\n @logger ||= Logger.new(nil)\n @logger\n end",
"def log\n unless self.class._slflogger\n self.class.createlogger\n end\n return self.class._slflogger\n end",
"def logger; settings(:logger); end",
"def logger\n instance ? instance.logger : Kitchen.logger\n end",
"def logger\n instance ? instance.logger : Kitchen.logger\n end",
"def logger\n Rails.logger\n end",
"def logger\n @_logger ||= ::Logger.new(log_file)\n end",
"def logger\n adapter.logger if adapter\n end",
"def logger\n options.logger\n end",
"def logger\n raise NotImplementedError\n end",
"def logger\n @cycler.logger\n end",
"def logger\n @logger ||= Logger.new(@log_file_name)\n\n @logger.formatter = proc do |severity, datetime, progname, msg|\n \"%s, [%s #%d] (%s) %5s -- %s: %s\\n\" % [severity[0..0], datetime, $$, Conf.global_conf[:hostname], severity, progname, msg]\n end\n\n if Conf.global_conf[:debug]\n @logger.level = Logger::DEBUG\n else\n @logger.level = Logger::INFO\n end\n @logger\n end",
"def logger\n self.configuration.logger || Logger.new($stdout)\n end",
"def logger\n init_logger if Log4r::Logger[STANDARD_LOGGER].nil?\n Log4r::Logger[STANDARD_LOGGER]\n end",
"def logger\n classname = self.class.name\n methodname = caller[0][/`([^']*)'/, 1]\n\n @_logger ||= ProjectHanlon::Logging.logger_for(classname, methodname)\n @_logger.progname = \"#{caller[0]}>>#{classname}\\##{methodname}\"\n @_logger\n end",
"def logger\n if request.respond_to? :logger\n request.logger\n else\n Logger.new(STDOUT)\n end\n end",
"def _logger\n @logger ||= Log4r::Logger.new(self.class.to_s)\n end",
"def logger\n @logger ||= (defined?(Rails) ? Rails.logger : Logger.new('monocle.log'))\n end",
"def logger\n options.logger\n end",
"def logger\n Thread.current[:merb_logger] ||= Merb::Logger.new\n end",
"def logger\n JsonApiServer.configuration.logger\n end",
"def logger\n @logger ||= defined?(Rails) ? Rails.logger : ::Logger.new($stdout)\n end",
"def logger\n @logger ||= SubscriberLogger.new(self)\n end",
"def logger\n @logger ||= ADAL::Logger.new(Logging.log_output, Logging.correlation_id)\n @logger.level = Logging.log_level || DEFAULT_LOG_LEVEL\n @logger\n end",
"def logger\n unless @logger\n if defined?(Rails) && ::Rails.logger\n @logger = ::Rails.logger\n else\n @logger = ::Logger.new(STDERR)\n end\n end\n @logger\n end",
"def logger\n @logger ||= Logger.new($stdout).tap do |log|\n log.progname = self.class.name\n end\n end"
] |
[
"0.84841424",
"0.84564626",
"0.84564626",
"0.8434215",
"0.8434215",
"0.83566713",
"0.8309358",
"0.82900506",
"0.82646453",
"0.8196551",
"0.8192056",
"0.81491107",
"0.81439626",
"0.8136586",
"0.8129685",
"0.8129355",
"0.8118863",
"0.8117452",
"0.8101169",
"0.8094447",
"0.8087581",
"0.80842274",
"0.8078487",
"0.8061588",
"0.8058886",
"0.80557525",
"0.80480474",
"0.8017846",
"0.80155253",
"0.80155253",
"0.8015169",
"0.7991836",
"0.7991622",
"0.7974733",
"0.7962953",
"0.7962953",
"0.7956864",
"0.79412174",
"0.79412174",
"0.7902328",
"0.7871186",
"0.7856653",
"0.7839849",
"0.78230286",
"0.78180146",
"0.78008705",
"0.7787374",
"0.776242",
"0.7758868",
"0.7746762",
"0.77377206",
"0.77334124",
"0.7730404",
"0.77274466",
"0.7716891",
"0.77161044",
"0.77101564",
"0.76887465",
"0.76843375",
"0.76703763",
"0.7664097",
"0.7664097",
"0.76629764",
"0.7648432",
"0.7641545",
"0.76408386",
"0.76395845",
"0.76395845",
"0.76395845",
"0.76077545",
"0.7604917",
"0.7593341",
"0.7588134",
"0.7568977",
"0.7565486",
"0.7554501",
"0.7551944",
"0.7551111",
"0.7551111",
"0.7550365",
"0.754513",
"0.7537862",
"0.75237167",
"0.7520846",
"0.75022024",
"0.74971074",
"0.7493649",
"0.74900067",
"0.7477799",
"0.7468958",
"0.7468222",
"0.7451096",
"0.73941493",
"0.73918915",
"0.7387153",
"0.73860115",
"0.73787624",
"0.73783404",
"0.7364328",
"0.7358979"
] |
0.7978824
|
33
|
Authorize the current user for this request
|
def authorize!(current_user)
RailsMiniProfiler::User.current_user = current_user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AUTHORIZER.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n end",
"def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n puts \"Authorize request\"\n @current_user = nil\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_user\n puts \"AUTHORIZE USER\"\n puts \"params[:id] \" + params[:id].to_s\n # render json: { status: 401, message: 'Unauthorized' } unless get_current_user.id == params[:id].to_i\n render json: { status: 401, message: 'Unauthorized' } unless get_current_user\n end",
"def authorize_request\n @current_user = ( AuthorizeApiRequest.new( request.headers ).call )[ :user ]\n end",
"def authorize_user\n puts \"AUTHORIZE USER\"\n puts \"user id: #{get_current_user.id}\"\n puts \"params: #{params[:id]}\"\n render json: { status: 401, message: 'Unauthorized' } unless get_current_user.id == params[:id].to_i\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n @exp = (AuthorizeApiRequest.new(request.headers).call)[:exp]\n end",
"def authorize_request\n puts \"request --------> #{request}\"\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def authorize_request\n authenticate_with_http_token do |token, option|\n User.find_by(token: token)\n end\n end",
"def authorize\n if @api_user\n authorize_user\n else\n authorize_unauthenticated_user\n end\n end",
"def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend",
"def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\n end",
"def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\n end",
"def authorize\n puts \"********** current user app controller *****************\"\n puts @current_user\n puts current_user\n puts '*********************************************************'\n # NOTE: to self: current_user method is called, it then decodes the JSON WEB Token,\n # grabs the user_id, and uses that id to make a query to find the user that matches that id and returns it. Then on that returned user we do a .id to get the id and compare it to the parameter :id\n\n render json: {status: 401, message: \"unauthorized\"} unless current_user.id == params[:id].to_i\n end",
"def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end",
"def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end",
"def authorize\n\t\tredirect_to '/login' unless current_user\n\tend",
"def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end",
"def set_current_user\n current_user\n authorize\n end",
"def authorize_request\n # request.headers[\"Authorization\"] = JsonWebToken.encode(user_id: 1)\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end",
"def set_authorization\n @user ||= current_user\n authorize @user\n end",
"def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def authorize\n return if current_user\n\n redirect_to login_url\n end",
"def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def current_user\n @current_user ||= authorize_request\n end",
"def current_user\n @current_user ||= authorize_request\n end",
"def authorize_user\n render json: {message: \"Unauthorized\"}, status: 401 unless get_current_user.id == params[:user_id].to_i\n end",
"def set_user\n authorize\n @user = current_user\n end",
"def current_user\n @current_user ||= authorize_request\n end",
"def authorize_request\n if request.path_info.include?('clients')\n @current_user = AuthorizeClientApiRequest.new(request.parameters[:client_uuid], request.headers).call[:user]\n elsif request.path_info.include?('apps')\n @current_device = AuthorizeDeviceApiRequest.new(request.parameters[:device_uuid], request.headers).call[:device]\n @current_user = @current_device.user unless @current_device.nil?\n else\n raise(ExceptionHandler::AuthenticationError, Message.unauthorized)\n end\n end",
"def authorize_user!\n if !current_user.present?\n render json: {error: 'No user error'}\n end\n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def show\n @user = current_user\n authorize @user\n end",
"def authorize_user\n if @user.nil? and not current_user.is_a? AdminUser\n # TODO check if we can rewrite the URL and scope the resources\n # only for the current_user, instead of redirecting\n redirect_to root_url\n end\n end",
"def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end",
"def authorize\n end",
"def authorize\n end",
"def request_authorization\n create_ticket\n verify_resource_owner or return\n render_authorize_form\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n \t\t\tunless User.find_by(id: session[:user_id])\n \t\t\t\tredirect_to login_url, notice: \"Please Log-in\"\n \t\t\tend\n \t\tend",
"def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end",
"def authorize\n @user = User.find_by_id_and_multitrack_token(params[:user_id], params[:token])\n head(@user ? :ok : :forbidden)\n end",
"def authorized\n\t\tif current_user\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def authorize!\n redirect to(\"/login?to=#{request.path}\", true, false) unless has_auth?\n end",
"def current_user\n\t\t@current_user ||= authorize_request\n\tend",
"def auth_as(min = :none)\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n unless @current_user.has_role? min\n raise(ExceptionHandler::AuthenticationError, Message.invalid_credentials)\n end\n end",
"def authorized_by(user)\n user.id == self.id\n end",
"def authorize\n if current_user.nil?\n redirect_to login_path, alert: 'You must be logged in to access this page.'\n end\n end",
"def authenticate_and_authorize( request )\n\t\tcredentials = nil\n\t\tcredentials = self.provide_authentication( request ) if self.request_should_auth?( request )\n\t\trequest.authenticated_user = credentials\n\n\t\tself.provide_authorization( credentials, request )\n\tend",
"def authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end",
"def authorize\n if !logged_in? || current_user.nil?\n redirect '/login'\n else\n @user = current_user\n @user_chores = current_user.chores\n @user_gadgets = current_user.gadgets\n end\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def user_authorize\n if session[:user_id]\n return true\n else\n redirect_to new_session_path\n return false\n end\n end",
"def authorize\n if current_user.nil?\n redirect_to login_url, alert: \"Please Log in or Sign Up to comment!\"\n \tend\n end",
"def authenticate_user!\n return true if current_user\n # get token and options\n authenticate_or_request_with_http_token do |token, options|\n access_token = AccountAccessToken.where('token_value = ? AND expires > ?', token, Date.today).first\n if access_token\n sign_in access_token.account\n else\n unauthenticated!\n end\n end\n end",
"def authenticate_request\n return unless authorization_token_valid?\n\n @current_user = User.find_by_id authorization_token_content.id\n\n @current_user.last_request_ip = request.remote_ip\n @current_user.touch :last_request_at\n\n @current_user\n end",
"def authorize?(_user)\n true\n end",
"def authorize?(_user)\n true\n end",
"def authorize\n\t if session[:user_id].nil?\n\t\t session[:original_uri] = request.request_uri\n\t\t redirect_to(login_path)\n\t\t flash[:notice] = \"Please login or sign up to access The Mashera Project!\"\n\t end\n end",
"def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend",
"def authorize\n if current_user.nil?\n flash[:danger] = \"Not authorized, please login first\"\n redirect_to login_url\n end\n end",
"def authenticate_user\n if current_user\n true\n else\n raise Exceptions::AuthorizationError.new('invalid user authorization')\n end\n end",
"def authenticate_user\n unauthorized unless current_user\n end",
"def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end",
"def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n\n # Check if the user record is ban and cancel all actions\n json_response({ error: 'Bannis' }, :unauthorized_request) if @current_user.isBan\n\n # Check achievements in all queries by the user, three times out of ten\n @current_user.check_achievements if rand(10) >= 7\n end",
"def authorize_user\n unless current_user\n flash[:notice] = \"Sorry, you need to be logged in to access that feature\"\n redirect_to new_session_path\n end\n end",
"def show\n authorize User\n end",
"def show\n authorize User\n end"
] |
[
"0.7938921",
"0.7710668",
"0.7687778",
"0.7662587",
"0.76419526",
"0.76419526",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.7524629",
"0.75187236",
"0.7489292",
"0.7486242",
"0.7485402",
"0.7483632",
"0.7452051",
"0.74405915",
"0.7439804",
"0.74294835",
"0.73832434",
"0.7355123",
"0.7339771",
"0.7337825",
"0.728931",
"0.7277784",
"0.7251434",
"0.7237782",
"0.720823",
"0.7183941",
"0.7138419",
"0.71312356",
"0.71006",
"0.7085233",
"0.70629025",
"0.70629025",
"0.7061436",
"0.7056308",
"0.7022343",
"0.7021941",
"0.6992809",
"0.697527",
"0.6923096",
"0.6897491",
"0.68800277",
"0.687232",
"0.687232",
"0.684583",
"0.6827263",
"0.6827263",
"0.6827263",
"0.6827263",
"0.6827263",
"0.6827263",
"0.6827263",
"0.6827263",
"0.6819436",
"0.68179905",
"0.6813466",
"0.68122303",
"0.68102163",
"0.680039",
"0.6794798",
"0.67919517",
"0.67917913",
"0.67894965",
"0.67777735",
"0.675267",
"0.6745123",
"0.6739177",
"0.66706026",
"0.66702634",
"0.6669805",
"0.66688406",
"0.66673857",
"0.6664378",
"0.6661039",
"0.665507",
"0.665507",
"0.6653046",
"0.6639539",
"0.663882",
"0.6636168",
"0.66342956",
"0.6620318",
"0.6613623",
"0.66115224",
"0.6606856",
"0.6600468",
"0.6595606",
"0.6595606"
] |
0.67787844
|
75
|
Set the current user for this request
|
def current_user=(current_user)
RailsMiniProfiler::User.current_user = current_user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_user_as_current_user\n @user = @current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user \n end",
"def set_user\r\n @user = current_user\r\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_user\n @user = @current_user\n end",
"def set_current_user\n User.current = current_user\n end",
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user\n # for access to authenticate method\n t = ActionController::HttpAuthentication::Token\n @current_user = t.authenticate(self, &AUTH_PROC)\n end",
"def set_user\n begin\n if user_signed_in?\n User.send :class_variable_set, :@@current, current_user\n end\n rescue Exception => exception\n logger.error \"Could not set User.current. Error was #{exception.to_s}\"\n end\n end",
"def set_current_user\n \t\tif session[:user_id]\n \t\t\tCurrent.user = User.find_by(id: session[:user_id])\n \t\tend\n \tend",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user\n if logged_in?\n User.current_user = current_user\n else\n User.current_user = nil\n end\n end",
"def set_current_user\n User.current_user = current_user\n end",
"def set_current_user\n if logged_in?\n @current_user = current_user\n end\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n if user.present?\n set_current_user_for_request_and_session(user)\n else\n clear_current_user_for_request_and_session\n end\n end",
"def current_user=(user)\n if user.present?\n set_current_user_for_request_and_session(user)\n else\n clear_current_user_for_request_and_session\n end\n end",
"def current_user=(user)\n if user.present?\n set_current_user_for_request_and_session(user)\n else\n clear_current_user_for_request_and_session\n end\n end",
"def set_user\n authorize\n @user = current_user\n end",
"def set_current_user(current_user)\n @current_user = current_user\n end",
"def set_user\n @user = @current_user.admin ? User.find(params['id']) : @current_user\n end",
"def current_user=(user)\n master.current_user = user\n end",
"def set_self_as_user\n @user = self.current_user\n end",
"def current_user=(user)\n\t\t@current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user= (user)\n\t\t@current_user = user\n\tend",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user_for_auth\n Authorization.current_user = current_user\n end",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def current_user=(user)\n\t\t@current_user = user\n\tend",
"def user=(user)\n Thread.current[\"current_user\"] = user\n end",
"def set_current_user(user)\n if user.new_record?\n set_unlogged_in_user(user)\n else\n set_logged_in_user(user)\n end\n end",
"def current_user=(user)\n\t\t# Create an instance variable so that it can be viewed by the controller and view\n\t\t@current_user = user\n\tend",
"def set_user\n @client = current_client\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end"
] |
[
"0.8638259",
"0.8526614",
"0.8526614",
"0.8526614",
"0.8526614",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.8365462",
"0.83307874",
"0.83170813",
"0.83170813",
"0.83096564",
"0.82837796",
"0.8177769",
"0.8173566",
"0.8173566",
"0.8173566",
"0.8173566",
"0.8173566",
"0.8173566",
"0.8173566",
"0.8173566",
"0.8173566",
"0.81605005",
"0.81605005",
"0.8114906",
"0.8114906",
"0.8065474",
"0.8065474",
"0.8065474",
"0.8065474",
"0.8065474",
"0.8054948",
"0.80150735",
"0.7970169",
"0.7964222",
"0.792864",
"0.79272807",
"0.791934",
"0.79052407",
"0.79049337",
"0.78969896",
"0.78969896",
"0.78969896",
"0.78904414",
"0.78837883",
"0.7880957",
"0.78746057",
"0.78645617",
"0.78544325",
"0.78493494",
"0.7845806",
"0.7836759",
"0.7827778",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78224474",
"0.78218746",
"0.7818021",
"0.7808438",
"0.77988696",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505",
"0.7785505"
] |
0.0
|
-1
|
Gets a path to the java binary: 1) If "java_bin" is configured with the LWRP, then use it 2) Runs a "which java" in shell, and retrieve stdout 3) When all else fails, return "/usr/bin/java"
|
def get_java_path(resource)
return resource.java_bin if !resource.java_bin.nil? && !resource.java_bin.empty?
cmd = Mixlib::ShellOut.new('which java').tap(&:run_command)
cmd_output = cmd.stdout.chomp
!cmd_output.empty? ? cmd_output : '/usr/bin/java'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ruby_bin\n @ruby_bin ||= begin\n c = ::Config::CONFIG\n File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']\n end\n end",
"def path_to_bin(name = nil)\n home = ENV['JAVA_HOME'] or fail 'Are we forgetting something? JAVA_HOME not set.'\n bin = Util.normalize_path(File.join(home, 'bin'))\n fail 'JAVA_HOME environment variable does not point to a valid JRE/JDK installation.' unless File.exist? bin\n Util.normalize_path(File.join(bin, name.to_s))\n end",
"def which(cmd)\n path = \"/usr/local/bin/#{cmd}\"\n if not File.exists?(path)\n path = \"/sw/bin/#{cmd}\"\n end\n return path;\nend",
"def binary\n @binary ||= begin\n if brewed?\n # If the python is brewed we always prefer it!\n # Note, we don't support homebrew/versions/pythonXX.rb, though.\n Formula.factory(@name).opt_prefix/\"bin/python#{@min_version.major}\"\n else\n # Using the ORIGINAL_PATHS here because in superenv, the user\n # installed external Python is not visible otherwise.\n which(@name, ORIGINAL_PATHS.join(':'))\n end\n end\n end",
"def python_binary\n ::File.join('', 'usr', 'bin', system_package_name)\n end",
"def ruby_gem_bindir\n cmd = shell_out!([new_resource.parent_ruby.gem_binary, 'environment'])\n # Parse a line like:\n # - EXECUTABLE DIRECTORY: /usr/local/bin\n matches = cmd.stdout.scan(/EXECUTABLE DIRECTORY: (.*)$/).first\n if matches\n matches.first\n else\n raise PoiseApplicationRuby::Error.new(\"Cannot find EXECUTABLE DIRECTORY: #{cmd.stdout}\")\n end\n end",
"def bin_path\n '/usr/local/bin'.p\n end",
"def which(cmd)\n ENV[\"PATH\"] = \"\" if ENV[\"PATH\"].nil?\n paths = (ENV['PATH'].split(::File::PATH_SEPARATOR) + %w(/bin /usr/bin /sbin /usr/sbin))\n\n paths.each do |path|\n possible = File.join(path, cmd)\n return possible if File.executable?(possible)\n end\n\n nil\n end",
"def run_java_home\n `/usr/libexec/java_home`.to_s.strip\n end",
"def ruby_bin_path\n #config_section.ruby_bin_path || ENV['_'] =~ /ruby/ ||\n require 'rbconfig'\n File.expand_path(Config::CONFIG['RUBY_INSTALL_NAME'], Config::CONFIG['bindir'])\n end",
"def whichfile(cmd)\n\n Chef::Log.debug(\"Executing which #{cmd}\")\n\n shell = Mixlib::ShellOut.new(\"which \" + cmd, :env => { 'PATH' => '/usr/bin:/usr/local/bin:/bin' })\n shell.run_command\n\n unless shell.exitstatus == 0\n return false\n else\n return true\n end\nend",
"def pg_ctl\n @pg_ctl ||= begin\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"pg_ctl#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n raise \"No `pg_ctl` executable found!\"\n end\n end",
"def python_binary\n @python_binary ||= begin\n `which python2`\n $?.success? ? \"python2\" : \"python\"\n end\n end",
"def default_installed_bin_dir\n if Gem.win_platform?\n # TODO: Also support Windows without cygwin\n '/cygdrive/c/Program\\ Files/Puppet\\ Labs/DevelopmentKit/bin'\n else\n '/opt/puppetlabs/bin'\n end\nend",
"def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each { |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable? exe\r\n }\r\n end\r\n return nil\r\nend",
"def find_shell_wrapper_or_executable prog\n @bindir.each do |dir|\n fname = File.join(dir, \"#{prog}.sh\")\n\n# $stderr.print \"Checking '#{fname}'\\n\"\n\n return fname if File.executable_real? fname\n end\n\n return find_executable(prog)\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\nreturn nil\nend",
"def which_path(bin_name)\n bin_path = `which #{bin_name}`.strip\n bin_path.empty? ? nil : bin_path\n end",
"def java_version\n ver_str = `java -version 2>&1 | grep \"java version\"`\n Chef::Log.info \"Java version string: #{ver_str}\"\n # Strip the 'java version \"..\"' from the string\n (!ver_str.nil? && !ver_str.empty?) ? ver_str.gsub(/[java version *,\",\\n]/, '') : `Chef::Log.error \"Java version is empty. Cannot Proceed further...\"`\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n\n return nil\nend",
"def which(bin, *path)\n path = path + ['/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin']\n path += ENV['PATH'].split(File::PATH_SEPARATOR)\n path.flatten.uniq.each do |dir|\n dest = File.join(dir, bin)\n return dest if FileTest.file? dest and FileTest.executable? dest\n end\n return false\n rescue StandardError => e\n logger.warn e\n return false\n end",
"def which cmd\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which cmd\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend",
"def startcmd\n if @resource[:binary]\n return @resource[:binary]\n else\n raise Puppet::Error,\n \"Services must specify a start command or a binary\"\n end\n end",
"def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\n end",
"def gem_bindir\n cmd = shell_out!([new_resource.absolute_gem_binary, 'environment'])\n # Parse a line like:\n # - EXECUTABLE DIRECTORY: /usr/local/bin\n matches = cmd.stdout.scan(/EXECUTABLE DIRECTORY: (.*)$/).first\n if matches\n matches.first\n else\n raise Error.new(\"Cannot find EXECUTABLE DIRECTORY: #{cmd.stdout}\")\n end\n end",
"def cmd_path\n return @cmd_path unless @cmd_path.nil?\n\n @cmd_path = File.join(context.root_path, 'bin', cmd)\n # Return the path to the command if it exists on disk, or we have a gemfile (i.e. Bundled install)\n # The Bundle may be created after the prepare_invoke so if the file doesn't exist, it may not be an error\n return @cmd_path if PDK::Util::Filesystem.exist?(@cmd_path) || !PDK::Util::Bundler::BundleHelper.new.gemfile.nil?\n\n # But if there is no Gemfile AND cmd doesn't exist in the default path, we need to go searching...\n @cmd_path = alternate_bin_paths.map { |alternate_path| File.join(alternate_path, cmd) }\n .find { |path| PDK::Util::Filesystem.exist?(path) }\n return @cmd_path unless @cmd_path.nil?\n\n # If we can't find it anywhere, just let the OS find it\n @cmd_path = cmd\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each {|ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n nil\nend",
"def which(cmd)\n\t# Stolen from http://stackoverflow.com/questions/210872\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each { |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\t}\n\tend\n \treturn nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|\n exts.each do |ext|\n path = File.join(dir, \"#{cmd}#{ext}\")\n if File.executable?(path) && File.file?(path)\n return path\n end\n end\n end\n nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n # return nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n return nil\nend",
"def java_path\n @java_path || DEFAULT_JAVA_PATH\n end",
"def which(cmd)\n return nil unless cmd && cmd.length > 0\n if cmd.include?(File::SEPARATOR)\n return cmd if File.executable? cmd\n end\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n binary = File.join(path, \"#{cmd}\")\n return binary if File.executable? binary\n end\n return nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend",
"def which(cmd)\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each do |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\tend\n\tend\n\treturn nil\nend",
"def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend",
"def which(*bins)\n bins.flatten.each do |bin|\n ENV[\"PATH\"].split(\":\").each do |dir|\n full_path = File.join(dir, bin)\n return full_path if File.exist? full_path\n end\n end\n nil\nend",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end",
"def launchctl\n @launchctl ||= which(\"launchctl\")\n end",
"def launchctl\n @launchctl ||= which(\"launchctl\")\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n\n nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end",
"def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n nil\n end",
"def get_java_pkg_location\n cookbook = node.app_name.downcase\n base_url = get_mirror_svc('jdk')\n\n version = node.java.version\n update = get_update_ver\n pkg = node.java.jrejdk\n extn = get_pkg_extn\n artifact = \"#{version}u#{update}-linux\"\n\n # Replace any $version/$flavor/$jrejdk placeholder variables present in the URL\n # e.x: http://<mirror>/some/path/$flavor/$jrejdk/$version/$jrejdk-$version-$arch.$extn\n base_url = base_url.gsub('$version', artifact)\n .gsub('$jrejdk', pkg)\n .gsub('$flavor', node[cookbook][:flavor])\n .gsub('$arch', node.java.arch)\n .gsub('$extn', extn)\n exit_with_err(\"Invalid package base URL: #{base_url}\") unless url_valid?(base_url)\n\n if base_url.end_with? (extn)\n # Got full mirror url with file name.\n file_name = File.basename(URI.parse(base_url).path)\n base_url = File.dirname(base_url)\n else\n # Use JDK file name convention.\n file_name = \"#{pkg}-#{artifact}-#{node.java.arch}.#{extn}\"\n end\n\n Chef::Log.info(\"Package url: #{base_url}/#{file_name}\")\n extract_dir = get_extract_dir(pkg, version, update)\n return base_url, file_name, extract_dir\n\n end",
"def which(cmd)\n\tpaths = ENV[\"PATH\"].split(\":\")\n\tpaths.push(\"/usr/local/bin\", \"/usr/bin\", \"/bin\").uniq!\n\tpaths.each do |dir|\n\t\tfile = dir + \"/\" + cmd\n\t\tif File.file?(file) and File.executable?(file)\n\t\t\treturn true end\n\tend\n\treturn\nend",
"def which(cmd, extra_path: %w{/bin /usr/bin /sbin /usr/sbin}, path: nil)\n # If it was already absolute, just return that.\n return cmd if cmd =~ /^(\\/|([a-z]:)?\\\\)/i\n # Allow passing something other than the real env var.\n path ||= ENV['PATH']\n # Based on Chef::Mixin::Which#which\n # Copyright 2010-2015, Chef Softare, Inc.\n paths = path.split(File::PATH_SEPARATOR) + extra_path\n paths.each do |candidate_path|\n filename = ::File.join(candidate_path, cmd)\n return filename if ::File.executable?(filename)\n end\n false\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each {|ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end",
"def which(command)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{command}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end",
"def shell_ruby_platform\n `ruby -rrbconfig -e \"puts RbConfig::CONFIG['sitearchdir']\"`\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{ path }/#{ cmd }#{ ext }\"\n return exe if File.executable?(exe)\n end\n end\n\n nil\n end",
"def ruby_path\n ext = ((RbConfig::CONFIG['ruby_install_name'] =~ /\\.(com|cmd|exe|bat|rb|sh)$/) ? \"\" : RbConfig::CONFIG['EXEEXT'])\n File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + ext).sub(/.*\\s.*/m, '\"\\&\"')\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{ path }/#{ cmd }#{ ext }\"\n return exe if File.executable?(exe)\n end\n end\n\n nil\n end",
"def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end",
"def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end",
"def rvm_ruby\n @@env.expanded_name.match(/([\\w\\-\\.]+)/)[1]\n end",
"def build_ruby\n bin = RbConfig::CONFIG[\"RUBY_INSTALL_NAME\"] || RbConfig::CONFIG[\"ruby_install_name\"]\n bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')\n File.join(RbConfig::CONFIG['bindir'], bin)\n end",
"def bin_wrapper_file\n rbconfig('ruby_install_name').match /^(.*)ruby(.*)$/\n File.join(Config.bin_dir, \"#{$1}#{@bin_name}#{$2}\")\n end",
"def shabang_or_fallback(interpreter)\n if interpreter == \"/bin/bash\"\n Chef::Log.warn(\"Yum executable interpreter is /bin/bash. Falling back to default python.\")\n \"/usr/bin/python\"\n else\n interpreter\n end\n end",
"def get_pkg_extn\n node.java.version == '6' ? 'bin' : node[:java]['package']['extn']\n end",
"def which(command)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{command}#{ext}\")\n return exe if File.executable? exe\n end\n end\n nil\n end",
"def ruby_path\n File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})\n end",
"def get_path\n cmd_exec('echo $PATH').to_s\n rescue\n raise \"Unable to determine path\"\n end"
] |
[
"0.63929486",
"0.62440574",
"0.6168697",
"0.61093855",
"0.6097962",
"0.5963003",
"0.5901154",
"0.5894257",
"0.5864119",
"0.58336717",
"0.58215153",
"0.5816257",
"0.5805665",
"0.5772197",
"0.5766898",
"0.57611716",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5696143",
"0.5692377",
"0.56873906",
"0.5670512",
"0.56701815",
"0.5666114",
"0.5666114",
"0.5657172",
"0.56320375",
"0.56320375",
"0.56320375",
"0.56320375",
"0.56320375",
"0.56320375",
"0.56320375",
"0.5625462",
"0.5625462",
"0.56246144",
"0.56132174",
"0.5601318",
"0.55897766",
"0.5579269",
"0.55778617",
"0.5576601",
"0.5574024",
"0.55729926",
"0.55729926",
"0.55729926",
"0.55729926",
"0.5572453",
"0.55652326",
"0.5564622",
"0.55640763",
"0.55622846",
"0.55622846",
"0.55622846",
"0.55622846",
"0.5541999",
"0.55405605",
"0.5533055",
"0.5527742",
"0.5527742",
"0.5527121",
"0.5527121",
"0.5526022",
"0.5524959",
"0.55169505",
"0.55169505",
"0.54816014",
"0.54808956",
"0.54646164",
"0.54534644",
"0.54477394",
"0.5442152",
"0.54420084",
"0.5427964",
"0.5424483",
"0.5422087",
"0.5416553",
"0.5414046",
"0.54093486",
"0.54093486",
"0.53955203",
"0.53948975",
"0.538241",
"0.53823245",
"0.53560114",
"0.53294235",
"0.5327633",
"0.53193116"
] |
0.81067604
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.